Loading core/java/android/app/IActivityManager.aidl +0 −1 Original line number Diff line number Diff line Loading @@ -510,7 +510,6 @@ interface IActivityManager { void noteAlarmFinish(in IIntentSender sender, in WorkSource workSource, int sourceUid, in String tag); @UnsupportedAppUsage int getPackageProcessState(in String packageName, in String callingPackage); void updateDeviceOwner(in String packageName); // Start of N transactions // Start Binder transaction tracking for all applications. Loading services/core/java/com/android/server/am/ActivityManagerService.java +0 −17 Original line number Diff line number Diff line Loading @@ -694,12 +694,6 @@ public class ActivityManagerService extends IActivityManager.Stub return (isFg) ? mFgBroadcastQueue : mBgBroadcastQueue; } /** * The package name of the DeviceOwner. This package is not permitted to have its data cleared. * <p>Not actually used</p> */ private volatile String mDeviceOwnerName; private volatile int mDeviceOwnerUid = INVALID_UID; /** Loading Loading @@ -6237,17 +6231,6 @@ public class ActivityManagerService extends IActivityManager.Stub return ActivityClient.getInstance().getTaskForActivity(token, onlyRoot); } @Override public void updateDeviceOwner(String packageName) { final int callingUid = Binder.getCallingUid(); if (callingUid != 0 && callingUid != SYSTEM_UID) { throw new SecurityException("updateDeviceOwner called from non-system process"); } synchronized (this) { mDeviceOwnerName = packageName; } } @Override public void updateLockTaskPackages(int userId, String[] packages) { mActivityTaskManager.updateLockTaskPackages(userId, packages); Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +0 −22 Original line number Diff line number Diff line Loading @@ -1999,9 +1999,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { mOwners.load(); setDeviceOwnershipSystemPropertyLocked(); findOwnerComponentIfNecessaryLocked(); // TODO PO may not have a class name either due to b/17652534. Address that too. updateDeviceOwnerLocked(); } } Loading Loading @@ -3142,23 +3139,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { } } private void updateDeviceOwnerLocked() { long ident = mInjector.binderClearCallingIdentity(); try { // TODO This is to prevent DO from getting "clear data"ed, but it should also check the // user id and also protect all other DAs too. final ComponentName deviceOwnerComponent = mOwners.getDeviceOwnerComponent(); if (deviceOwnerComponent != null) { mInjector.getIActivityManager() .updateDeviceOwner(deviceOwnerComponent.getPackageName()); } } catch (RemoteException e) { // Not gonna happen. } finally { mInjector.binderRestoreCallingIdentity(ident); } } static void validateQualityConstant(int quality) { switch (quality) { case PASSWORD_QUALITY_UNSPECIFIED: Loading Loading @@ -8590,7 +8570,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { mOwners.setDeviceOwner(admin, ownerName, userId); mOwners.writeDeviceOwner(); updateDeviceOwnerLocked(); setDeviceOwnershipSystemPropertyLocked(); //TODO(b/180371154): when provisionFullyManagedDevice is used in tests, remove this Loading Loading @@ -8951,7 +8930,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { mOwners.clearDeviceOwner(); mOwners.writeDeviceOwner(); updateDeviceOwnerLocked(); clearDeviceOwnerUserRestriction(UserHandle.of(userId)); mInjector.securityLogSetLoggingEnabledProperty(false); Loading services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java +0 −16 Original line number Diff line number Diff line Loading @@ -1137,9 +1137,6 @@ public class DevicePolicyManagerTest extends DpmTestBase { mContext.binder.callingUid = DpmMockContext.CALLER_SYSTEM_USER_UID; // Verify internal calls. verify(getServices().iactivityManager, times(1)).updateDeviceOwner( eq(admin1.getPackageName())); verify(getServices().userManager, times(1)).setUserRestriction( eq(UserManager.DISALLOW_ADD_MANAGED_PROFILE), eq(true), eq(UserHandle.SYSTEM)); Loading Loading @@ -1205,9 +1202,6 @@ public class DevicePolicyManagerTest extends DpmTestBase { assertThat(dpm.getDeviceOwnerComponentOnAnyUser()).isEqualTo(admin1); // Verify internal calls. verify(getServices().iactivityManager).updateDeviceOwner( eq(admin1.getPackageName())); verify(mContext.spiedContext).sendBroadcastAsUser( MockUtils.checkIntentAction(DevicePolicyManager.ACTION_DEVICE_OWNER_CHANGED), MockUtils.checkUserHandle(UserHandle.USER_SYSTEM)); Loading Loading @@ -1392,11 +1386,6 @@ public class DevicePolicyManagerTest extends DpmTestBase { setUpPackageManagerForAdmin(admin1, DpmMockContext.CALLER_SYSTEM_USER_UID); dpm.setActiveAdmin(admin1, /* replace =*/ false); assertThat(dpm.setDeviceOwner(admin1, "owner-name", UserHandle.USER_SYSTEM)).isTrue(); // Verify internal calls. verify(getServices().iactivityManager, times(1)).updateDeviceOwner( eq(admin1.getPackageName())); assertThat(dpm.getDeviceOwnerComponentOnAnyUser()).isEqualTo(admin1); dpm.addUserRestriction(admin1, UserManager.DISALLOW_ADD_USER); Loading Loading @@ -1501,11 +1490,6 @@ public class DevicePolicyManagerTest extends DpmTestBase { setUpPackageManagerForAdmin(admin1, DpmMockContext.CALLER_SYSTEM_USER_UID); dpm.setActiveAdmin(admin1, /* replace =*/ false); assertThat(dpm.setDeviceOwner(admin1, "owner-name", UserHandle.USER_SYSTEM)).isTrue(); // Verify internal calls. verify(getServices().iactivityManager, times(1)).updateDeviceOwner( eq(admin1.getPackageName())); assertThat(dpm.getDeviceOwnerComponentOnAnyUser()).isEqualTo(admin1); // Now call clear from the secondary user, which should throw. Loading Loading
core/java/android/app/IActivityManager.aidl +0 −1 Original line number Diff line number Diff line Loading @@ -510,7 +510,6 @@ interface IActivityManager { void noteAlarmFinish(in IIntentSender sender, in WorkSource workSource, int sourceUid, in String tag); @UnsupportedAppUsage int getPackageProcessState(in String packageName, in String callingPackage); void updateDeviceOwner(in String packageName); // Start of N transactions // Start Binder transaction tracking for all applications. Loading
services/core/java/com/android/server/am/ActivityManagerService.java +0 −17 Original line number Diff line number Diff line Loading @@ -694,12 +694,6 @@ public class ActivityManagerService extends IActivityManager.Stub return (isFg) ? mFgBroadcastQueue : mBgBroadcastQueue; } /** * The package name of the DeviceOwner. This package is not permitted to have its data cleared. * <p>Not actually used</p> */ private volatile String mDeviceOwnerName; private volatile int mDeviceOwnerUid = INVALID_UID; /** Loading Loading @@ -6237,17 +6231,6 @@ public class ActivityManagerService extends IActivityManager.Stub return ActivityClient.getInstance().getTaskForActivity(token, onlyRoot); } @Override public void updateDeviceOwner(String packageName) { final int callingUid = Binder.getCallingUid(); if (callingUid != 0 && callingUid != SYSTEM_UID) { throw new SecurityException("updateDeviceOwner called from non-system process"); } synchronized (this) { mDeviceOwnerName = packageName; } } @Override public void updateLockTaskPackages(int userId, String[] packages) { mActivityTaskManager.updateLockTaskPackages(userId, packages); Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +0 −22 Original line number Diff line number Diff line Loading @@ -1999,9 +1999,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { mOwners.load(); setDeviceOwnershipSystemPropertyLocked(); findOwnerComponentIfNecessaryLocked(); // TODO PO may not have a class name either due to b/17652534. Address that too. updateDeviceOwnerLocked(); } } Loading Loading @@ -3142,23 +3139,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { } } private void updateDeviceOwnerLocked() { long ident = mInjector.binderClearCallingIdentity(); try { // TODO This is to prevent DO from getting "clear data"ed, but it should also check the // user id and also protect all other DAs too. final ComponentName deviceOwnerComponent = mOwners.getDeviceOwnerComponent(); if (deviceOwnerComponent != null) { mInjector.getIActivityManager() .updateDeviceOwner(deviceOwnerComponent.getPackageName()); } } catch (RemoteException e) { // Not gonna happen. } finally { mInjector.binderRestoreCallingIdentity(ident); } } static void validateQualityConstant(int quality) { switch (quality) { case PASSWORD_QUALITY_UNSPECIFIED: Loading Loading @@ -8590,7 +8570,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { mOwners.setDeviceOwner(admin, ownerName, userId); mOwners.writeDeviceOwner(); updateDeviceOwnerLocked(); setDeviceOwnershipSystemPropertyLocked(); //TODO(b/180371154): when provisionFullyManagedDevice is used in tests, remove this Loading Loading @@ -8951,7 +8930,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager { mOwners.clearDeviceOwner(); mOwners.writeDeviceOwner(); updateDeviceOwnerLocked(); clearDeviceOwnerUserRestriction(UserHandle.of(userId)); mInjector.securityLogSetLoggingEnabledProperty(false); Loading
services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java +0 −16 Original line number Diff line number Diff line Loading @@ -1137,9 +1137,6 @@ public class DevicePolicyManagerTest extends DpmTestBase { mContext.binder.callingUid = DpmMockContext.CALLER_SYSTEM_USER_UID; // Verify internal calls. verify(getServices().iactivityManager, times(1)).updateDeviceOwner( eq(admin1.getPackageName())); verify(getServices().userManager, times(1)).setUserRestriction( eq(UserManager.DISALLOW_ADD_MANAGED_PROFILE), eq(true), eq(UserHandle.SYSTEM)); Loading Loading @@ -1205,9 +1202,6 @@ public class DevicePolicyManagerTest extends DpmTestBase { assertThat(dpm.getDeviceOwnerComponentOnAnyUser()).isEqualTo(admin1); // Verify internal calls. verify(getServices().iactivityManager).updateDeviceOwner( eq(admin1.getPackageName())); verify(mContext.spiedContext).sendBroadcastAsUser( MockUtils.checkIntentAction(DevicePolicyManager.ACTION_DEVICE_OWNER_CHANGED), MockUtils.checkUserHandle(UserHandle.USER_SYSTEM)); Loading Loading @@ -1392,11 +1386,6 @@ public class DevicePolicyManagerTest extends DpmTestBase { setUpPackageManagerForAdmin(admin1, DpmMockContext.CALLER_SYSTEM_USER_UID); dpm.setActiveAdmin(admin1, /* replace =*/ false); assertThat(dpm.setDeviceOwner(admin1, "owner-name", UserHandle.USER_SYSTEM)).isTrue(); // Verify internal calls. verify(getServices().iactivityManager, times(1)).updateDeviceOwner( eq(admin1.getPackageName())); assertThat(dpm.getDeviceOwnerComponentOnAnyUser()).isEqualTo(admin1); dpm.addUserRestriction(admin1, UserManager.DISALLOW_ADD_USER); Loading Loading @@ -1501,11 +1490,6 @@ public class DevicePolicyManagerTest extends DpmTestBase { setUpPackageManagerForAdmin(admin1, DpmMockContext.CALLER_SYSTEM_USER_UID); dpm.setActiveAdmin(admin1, /* replace =*/ false); assertThat(dpm.setDeviceOwner(admin1, "owner-name", UserHandle.USER_SYSTEM)).isTrue(); // Verify internal calls. verify(getServices().iactivityManager, times(1)).updateDeviceOwner( eq(admin1.getPackageName())); assertThat(dpm.getDeviceOwnerComponentOnAnyUser()).isEqualTo(admin1); // Now call clear from the secondary user, which should throw. Loading