Allow shell to enable/disable individual component in test package

Test: cts-tradefed run cts --module DevicePolicyManager --test com.android.cts.devicepolicy.ManagedProfileTest#testAppLinks_enabledStatus

Bug: 32695379
Change-Id: I0fa22f50f1aa344195b7c6bc1e6ee97879d91c46
This commit is contained in:
Tony Mak
2016-11-08 19:30:55 +00:00
parent 12a0f1190c
commit 13810374a4

View File

@@ -18088,8 +18088,10 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
}
synchronized (mPackages) {
if (uid == Process.SHELL_UID) {
if (uid == Process.SHELL_UID
&& (pkgSetting.pkgFlags & ApplicationInfo.FLAG_TEST_ONLY) == 0) {
// Shell can only change whole packages between ENABLED and DISABLED_USER states
// unless it is a test package.
int oldState = pkgSetting.getEnabled(userId);
if (className == null
&&