summaryrefslogtreecommitdiffstats
path: root/core/tests
diff options
context:
space:
mode:
authordcashman <dcashman@google.com>2014-07-12 13:04:20 -0700
committerdcashman <dcashman@google.com>2014-07-12 13:04:20 -0700
commit5de7377feca5242fe7127e2d4dc7792d4886d365 (patch)
treec7ac7801388c9572702b3c2440f0efc60ccc17b3 /core/tests
parent405912bce074e9e59a246e2357a108e50dffabf8 (diff)
downloadframeworks_base-5de7377feca5242fe7127e2d4dc7792d4886d365.zip
frameworks_base-5de7377feca5242fe7127e2d4dc7792d4886d365.tar.gz
frameworks_base-5de7377feca5242fe7127e2d4dc7792d4886d365.tar.bz2
Revert "Initial KeySet API."
This reverts commit 9a643fe02bc960e266484547dda5572b094a4c72.
Diffstat (limited to 'core/tests')
-rw-r--r--core/tests/coretests/AndroidManifest.xml7
-rw-r--r--core/tests/coretests/apks/keyset/Android.mk17
-rw-r--r--core/tests/coretests/apks/keyset/api_test/AndroidManifest.xml20
-rw-r--r--core/tests/coretests/src/android/content/pm/PackageManagerTests.java170
4 files changed, 0 insertions, 214 deletions
diff --git a/core/tests/coretests/AndroidManifest.xml b/core/tests/coretests/AndroidManifest.xml
index b524177..a2cc40c 100644
--- a/core/tests/coretests/AndroidManifest.xml
+++ b/core/tests/coretests/AndroidManifest.xml
@@ -1257,11 +1257,4 @@
<instrumentation android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.android.frameworks.coretests"
android:label="Frameworks Core Tests" />
- <key-sets>
- <key-set android:name="A" >
- <public-key android:name="keyA"
- android:value="MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAJoN1Nsgqf0V4C/bbN8wo8O2X/S5D76+5Mb9mlIsHkUTUTbHCNk+LxHIUYLm89YbP9zImrV0bUHLUAZUyoMUCiMCAwEAAQ=="/>
- </key-set>
- <upgrade-key-set android:name="A"/>
- </key-sets>
</manifest>
diff --git a/core/tests/coretests/apks/keyset/Android.mk b/core/tests/coretests/apks/keyset/Android.mk
index 306dc90..e44ac6c 100644
--- a/core/tests/coretests/apks/keyset/Android.mk
+++ b/core/tests/coretests/apks/keyset/Android.mk
@@ -88,21 +88,4 @@ LOCAL_PACKAGE_NAME := keyset_sau_ub
LOCAL_CERTIFICATE := $(LOCAL_PATH)/../../certs/keyset_A
LOCAL_ADDITIONAL_CERTIFICATES := $(LOCAL_PATH)/../../certs/keyset_B
LOCAL_MANIFEST_FILE := uB/AndroidManifest.xml
-include $(FrameworkCoreTests_BUILD_PACKAGE)
-
-#apks signed by platform only
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-LOCAL_PACKAGE_NAME := keyset_splat_api
-LOCAL_CERTIFICATE := platform
-LOCAL_MANIFEST_FILE := api_test/AndroidManifest.xml
-include $(FrameworkCoreTests_BUILD_PACKAGE)
-
-#apks signed by platform and keyset_A
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-LOCAL_PACKAGE_NAME := keyset_splata_api
-LOCAL_CERTIFICATE := platform
-LOCAL_ADDITIONAL_CERTIFICATES := $(LOCAL_PATH)/../../certs/keyset_A
-LOCAL_MANIFEST_FILE := api_test/AndroidManifest.xml
include $(FrameworkCoreTests_BUILD_PACKAGE) \ No newline at end of file
diff --git a/core/tests/coretests/apks/keyset/api_test/AndroidManifest.xml b/core/tests/coretests/apks/keyset/api_test/AndroidManifest.xml
deleted file mode 100644
index 4c7e968..0000000
--- a/core/tests/coretests/apks/keyset/api_test/AndroidManifest.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2010 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.keysets_api">
- <application android:hasCode="false">
- </application>
-</manifest>
diff --git a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
index 3a80309..0244425 100644
--- a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
+++ b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
@@ -26,7 +26,6 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.content.pm.KeySet;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
@@ -34,7 +33,6 @@ import android.content.pm.PackageParser.PackageParserException;
import android.content.res.Resources;
import android.content.res.Resources.NotFoundException;
import android.net.Uri;
-import android.os.Binder;
import android.os.Bundle;
import android.os.Environment;
import android.os.FileUtils;
@@ -3330,174 +3328,6 @@ public class PackageManagerTests extends AndroidTestCase {
}
/**
- * The following tests are related to testing KeySets-based API
- */
-
- /*
- * testGetSigningKeySetNull - ensure getSigningKeySet() returns null on null
- * input and when calling a package other than that which made the call.
- */
- public void testGetSigningKeySet() throws Exception {
- PackageManager pm = getPm();
- String mPkgName = mContext.getPackageName();
- String otherPkgName = "com.android.frameworks.coretests.keysets_api";
- KeySet ks;
- try {
- ks = pm.getSigningKeySet(null);
- assertTrue(false); // should have thrown
- } catch (NullPointerException e) {
- }
- try {
- ks = pm.getSigningKeySet("keysets.test.bogus.package");
- assertTrue(false); // should have thrown
- } catch (IllegalArgumentException e) {
- }
- installFromRawResource("keysetApi.apk", R.raw.keyset_splat_api,
- 0, false, false, -1, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
- try {
- ks = pm.getSigningKeySet(otherPkgName);
- assertTrue(false); // should have thrown
- } catch (SecurityException e) {
- }
- cleanUpInstall(otherPkgName);
- ks = pm.getSigningKeySet(mContext.getPackageName());
- assertNotNull(ks);
- }
-
- /*
- * testGetKeySetByAlias - same as getSigningKeySet, but for keysets defined
- * by this package.
- */
- public void testGetKeySetByAlias() throws Exception {
- PackageManager pm = getPm();
- String mPkgName = mContext.getPackageName();
- String otherPkgName = "com.android.frameworks.coretests.keysets_api";
- KeySet ks;
- try {
- ks = pm.getKeySetByAlias(null, null);
- assertTrue(false); // should have thrown
- } catch (NullPointerException e) {
- }
- try {
- ks = pm.getKeySetByAlias(null, "keysetBogus");
- assertTrue(false); // should have thrown
- } catch (NullPointerException e) {
- }
- try {
- ks = pm.getKeySetByAlias("keysets.test.bogus.package", null);
- assertTrue(false); // should have thrown
- } catch (NullPointerException e) {
- }
- try {
- ks = pm.getKeySetByAlias("keysets.test.bogus.package", "A");
- assertTrue(false); // should have thrown
- } catch(IllegalArgumentException e) {
- }
- try {
- ks = pm.getKeySetByAlias(mPkgName, "keysetBogus");
- assertTrue(false); // should have thrown
- } catch(IllegalArgumentException e) {
- }
- installFromRawResource("keysetApi.apk", R.raw.keyset_splat_api,
- 0, false, false, -1, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
- try {
- ks = pm.getKeySetByAlias(otherPkgName, "A");
- assertTrue(false); // should have thrown
- } catch (SecurityException e) {
- }
- cleanUpInstall(otherPkgName);
- ks = pm.getKeySetByAlias(mPkgName, "A");
- assertNotNull(ks);
- }
-
- public void testIsSignedBy() throws Exception {
- PackageManager pm = getPm();
- String mPkgName = mContext.getPackageName();
- String otherPkgName = "com.android.frameworks.coretests.keysets_api";
- KeySet mSigningKS = pm.getSigningKeySet(mPkgName);
- KeySet mDefinedKS = pm.getKeySetByAlias(mPkgName, "A");
-
- try {
- assertFalse(pm.isSignedBy(null, null));
- assertTrue(false); // should have thrown
- } catch (NullPointerException e) {
- }
- try {
- assertFalse(pm.isSignedBy(null, mSigningKS));
- assertTrue(false); // should have thrown
- } catch (NullPointerException e) {
- }
- try {
- assertFalse(pm.isSignedBy(mPkgName, null));
- assertTrue(false); // should have thrown
- } catch (NullPointerException e) {
- }
- try {
- assertFalse(pm.isSignedBy("keysets.test.bogus.package", mDefinedKS));
- } catch(IllegalArgumentException e) {
- }
- assertFalse(pm.isSignedBy(mPkgName, mDefinedKS));
- assertFalse(pm.isSignedBy(mPkgName, new KeySet(new Binder())));
- assertTrue(pm.isSignedBy(mPkgName, mSigningKS));
-
- installFromRawResource("keysetApi.apk", R.raw.keyset_splat_api,
- 0, false, false, -1, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
- assertFalse(pm.isSignedBy(otherPkgName, mDefinedKS));
- assertTrue(pm.isSignedBy(otherPkgName, mSigningKS));
- cleanUpInstall(otherPkgName);
-
- installFromRawResource("keysetApi.apk", R.raw.keyset_splata_api,
- 0, false, false, -1, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
- assertTrue(pm.isSignedBy(otherPkgName, mDefinedKS));
- assertTrue(pm.isSignedBy(otherPkgName, mSigningKS));
- cleanUpInstall(otherPkgName);
- }
-
- public void testIsSignedByExactly() throws Exception {
- PackageManager pm = getPm();
- String mPkgName = mContext.getPackageName();
- String otherPkgName = "com.android.frameworks.coretests.keysets_api";
- KeySet mSigningKS = pm.getSigningKeySet(mPkgName);
- KeySet mDefinedKS = pm.getKeySetByAlias(mPkgName, "A");
- try {
- assertFalse(pm.isSignedBy(null, null));
- assertTrue(false); // should have thrown
- } catch (NullPointerException e) {
- }
- try {
- assertFalse(pm.isSignedBy(null, mSigningKS));
- assertTrue(false); // should have thrown
- } catch (NullPointerException e) {
- }
- try {
- assertFalse(pm.isSignedBy(mPkgName, null));
- assertTrue(false); // should have thrown
- } catch (NullPointerException e) {
- }
- try {
- assertFalse(pm.isSignedByExactly("keysets.test.bogus.package", mDefinedKS));
- } catch(IllegalArgumentException e) {
- }
- assertFalse(pm.isSignedByExactly(mPkgName, mDefinedKS));
- assertFalse(pm.isSignedByExactly(mPkgName, new KeySet(new Binder())));
- assertTrue(pm.isSignedByExactly(mPkgName, mSigningKS));
-
- installFromRawResource("keysetApi.apk", R.raw.keyset_splat_api,
- 0, false, false, -1, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
- assertFalse(pm.isSignedByExactly(otherPkgName, mDefinedKS));
- assertTrue(pm.isSignedByExactly(otherPkgName, mSigningKS));
- cleanUpInstall(otherPkgName);
-
- installFromRawResource("keysetApi.apk", R.raw.keyset_splata_api,
- 0, false, false, -1, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
- assertFalse(pm.isSignedByExactly(otherPkgName, mDefinedKS));
- assertFalse(pm.isSignedByExactly(otherPkgName, mSigningKS));
- cleanUpInstall(otherPkgName);
- }
-
-
-
- /**
* The following tests are related to testing the checkSignatures api.
*/
private void checkSignatures(int apk1, int apk2, int expMatchResult) throws Exception {