Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f2f1b6c9 authored by Martin Wallgren's avatar Martin Wallgren Committed by Johan Redestig
Browse files

Adding test cases for getInstalledPackages

There was an earlier fix for a case where the binder
heap would run out of space when calling the
getInstalledPackages. This could happen when there were
a lot of installed packages.

This change adds some test cases to verify that fix.

Change-Id: I8e0c5f674bf2098adcff6d40893f94162961031f
parent 0748a569
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := tests

LOCAL_SRC_FILES := $(call all-subdir-java-files)

LOCAL_PACKAGE_NAME := FrameworkCoreTests_install_complete_package_info

include $(BUILD_PACKAGE)
+54 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2011 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<manifest
    xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.android.frameworks.coretests.install_complete_package_info">

<!--
     This manifest declares at least one of each of the components that
     can be retrieved by PackageManager.getInstalledPackages.
     All the implementing classes are empty implementations
-->

    <uses-feature
        android:name="com.android.frameworks.coretests.nonexistent" />
    <uses-configuration
        android:reqFiveWayNav="false" />

    <instrumentation
        android:name="android.test.InstrumentationTestRunner"
        android:targetPackage="com.android.frameworks.coretests"
        android:label="Frameworks Core Tests" />

    <permission
        android:label="test permission"
        android:name="test_permission"
        android:protectionLevel="normal" />

    <application
        android:hasCode="true">
        <activity
            android:name="com.android.frameworks.coretests.TestActivity">
        </activity>
        <provider
            android:name="com.android.frameworks.coretests.TestProvider"
            android:authorities="com.android.frameworks.coretests.testprovider" />
        <receiver
            android:name="com.android.frameworks.coretests.TestReceiver" />
        <service
            android:name="com.android.frameworks.coretests.TestService" />
    </application>
</manifest>
+24 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2011 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.android.frameworks.coretests;

import android.app.Activity;

public class TestActivity extends Activity {

}
+57 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2011 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.android.frameworks.coretests;

import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;

public class TestProvider extends ContentProvider {

    @Override
    public boolean onCreate() {
        return false;
    }

    @Override
    public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
            String sortOrder) {
        return null;
    }

    @Override
    public String getType(Uri uri) {
        return null;
    }

    @Override
    public Uri insert(Uri uri, ContentValues values) {
        return null;
    }

    @Override
    public int delete(Uri uri, String selection, String[] selectionArgs) {
        return 0;
    }

    @Override
    public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
        return 0;
    }
}
+57 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2011 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package com.android.frameworks.coretests;

import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;

public class TestReceiver extends ContentProvider {

    @Override
    public boolean onCreate() {
        return false;
    }

    @Override
    public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
            String sortOrder) {
        return null;
    }

    @Override
    public String getType(Uri uri) {
        return null;
    }

    @Override
    public Uri insert(Uri uri, ContentValues values) {
        return null;
    }

    @Override
    public int delete(Uri uri, String selection, String[] selectionArgs) {
        return 0;
    }

    @Override
    public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {
        return 0;
    }
}
Loading