summaryrefslogtreecommitdiffstats
path: root/core/tests
diff options
context:
space:
mode:
authorAdnan Begovic <adnan@cyngn.com>2016-01-19 16:13:21 -0800
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-01-22 15:28:25 -0800
commit5f31f27783f19a5cc4368eca3c8005d290a10247 (patch)
treeac50a148702ff5d913fe0e3ad07b9c8375b1711f /core/tests
parent35671166550919d7db37b2084ca2bc6d9595e71a (diff)
downloadframeworks_base-5f31f27783f19a5cc4368eca3c8005d290a10247.zip
frameworks_base-5f31f27783f19a5cc4368eca3c8005d290a10247.tar.gz
frameworks_base-5f31f27783f19a5cc4368eca3c8005d290a10247.tar.bz2
fw: Fix protected apps implementation.
Currently a protected component could be accessed from any other means other than the launcher, entirely defeating its purpose. Instead, hook into the activity stack supervisor and quelch attempts at invocation of protected components. This implementation also provides feedback to the user on any attempt to start the component when its in a protected state. TICKET: CYNGNOS-84 Change-Id: Ib0165e7504adb08e21e9566c7394b37dffd280d4
Diffstat (limited to 'core/tests')
-rw-r--r--core/tests/coretests/src/android/content/pm/PackageManagerTests.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
index a4214cf..8b4030a 100644
--- a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
+++ b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
@@ -27,6 +27,7 @@ import static android.system.OsConstants.S_IXOTH;
import android.app.PackageInstallObserver;
import android.content.BroadcastReceiver;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -3847,4 +3848,21 @@ public class PackageManagerTests extends AndroidTestCase {
* how to do tests on updated system apps?
* verify updates to system apps cannot be installed on the sdcard.
*/
+
+ //CM Tests
+ public void testIsComponentProtectedFromSamePackage() {
+ ComponentName testComponentName = new ComponentName("com.android.test",
+ "com.android.test.component.protected");
+ getPm().setComponentProtectedSetting(testComponentName, true);
+ assertFalse(getPm().isComponentProtected(testComponentName.getPackageName(),
+ testComponentName));
+ }
+
+ public void testIsComponentProtectedFromManagers() {
+ ComponentName testComponentName = new ComponentName("com.android.test",
+ "com.android.test.component.protected");
+ getPm().setComponentProtectedSetting(testComponentName, true);
+ assertFalse(getPm().isComponentProtected(testComponentName.getPackageName(),
+ testComponentName));
+ }
}