summaryrefslogtreecommitdiff
path: root/tests/permission/src
diff options
context:
space:
mode:
author Christopher Tate <ctate@google.com> 2014-03-24 16:25:51 -0700
committer Christopher Tate <ctate@google.com> 2014-03-27 12:37:47 -0700
commitf1977b4500e82b72ea6aa5c46d97406a20017caf (patch)
tree9d6b4e63bc4b4c70eb9fbd5eb2cff9587ba45485 /tests/permission/src
parent9ad8a5331ca5eb6390c702ec57952043b56170bf (diff)
Expand install observer semantics
...and now fail conservatively when two apps both attempt to define the same permission. Apps signed with the same certificate are permitted to redefine permissions. We also finally have a (hidden) interface class for observing package installation so that we can now rev the interface without breaking existing callers. Bug 13551375 Change-Id: Ifa4e59154dcccbb286ee46a35a6f25e4ad0f0f01
Diffstat (limited to 'tests/permission/src')
-rw-r--r--tests/permission/src/com/android/framework/permission/tests/PmPermissionsTests.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/permission/src/com/android/framework/permission/tests/PmPermissionsTests.java b/tests/permission/src/com/android/framework/permission/tests/PmPermissionsTests.java
index b690c459874a..93aa555ca46b 100644
--- a/tests/permission/src/com/android/framework/permission/tests/PmPermissionsTests.java
+++ b/tests/permission/src/com/android/framework/permission/tests/PmPermissionsTests.java
@@ -16,7 +16,7 @@
package com.android.framework.permission.tests;
-import junit.framework.TestCase;
+import android.app.PackageInstallObserver;
import android.content.pm.PackageManager;
import android.test.AndroidTestCase;
import android.test.suitebuilder.annotation.SmallTest;
@@ -68,10 +68,14 @@ public class PmPermissionsTests extends AndroidTestCase {
* This test verifies that PackageManger.installPackage enforces permission
* android.permission.INSTALL_PACKAGES
*/
+ private class TestInstallObserver extends PackageInstallObserver {
+ }
+
@SmallTest
public void testInstallPackage() {
+ TestInstallObserver observer = new TestInstallObserver();
try {
- mPm.installPackage(null, null, 0, null);
+ mPm.installPackage(null, observer, 0, null);
fail("PackageManager.installPackage" +
"did not throw SecurityException as expected");
} catch (SecurityException e) {