Loading services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +190 −132 File changed.Preview size limit exceeded, changes collapsed. Show changes services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -5728,6 +5728,7 @@ public class DevicePolicyManagerTest extends DpmTestBase { // Device owner should be allowed to request Device ID attestation. // Device owner should be allowed to request Device ID attestation. dpms.enforceCallerCanRequestDeviceIdAttestation(dpms.getCallerIdentity(admin1)); dpms.enforceCallerCanRequestDeviceIdAttestation(dpms.getCallerIdentity(admin1)); mContext.binder.callingUid = DpmMockContext.ANOTHER_UID; // Another package must not be allowed to request Device ID attestation. // Another package must not be allowed to request Device ID attestation. assertExpectException(SecurityException.class, null, assertExpectException(SecurityException.class, null, () -> dpms.enforceCallerCanRequestDeviceIdAttestation( () -> dpms.enforceCallerCanRequestDeviceIdAttestation( Loading Loading @@ -5757,6 +5758,7 @@ public class DevicePolicyManagerTest extends DpmTestBase { dpms.enforceCallerCanRequestDeviceIdAttestation(dpms.getCallerIdentity(admin1)); dpms.enforceCallerCanRequestDeviceIdAttestation(dpms.getCallerIdentity(admin1)); // But not another package. // But not another package. mContext.binder.callingUid = DpmMockContext.ANOTHER_UID; assertExpectException(SecurityException.class, null, assertExpectException(SecurityException.class, null, () -> dpms.enforceCallerCanRequestDeviceIdAttestation( () -> dpms.enforceCallerCanRequestDeviceIdAttestation( dpms.getCallerIdentity(null, admin2.getPackageName()))); dpms.getCallerIdentity(null, admin2.getPackageName()))); Loading Loading
services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +190 −132 File changed.Preview size limit exceeded, changes collapsed. Show changes
services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java +2 −0 Original line number Original line Diff line number Diff line Loading @@ -5728,6 +5728,7 @@ public class DevicePolicyManagerTest extends DpmTestBase { // Device owner should be allowed to request Device ID attestation. // Device owner should be allowed to request Device ID attestation. dpms.enforceCallerCanRequestDeviceIdAttestation(dpms.getCallerIdentity(admin1)); dpms.enforceCallerCanRequestDeviceIdAttestation(dpms.getCallerIdentity(admin1)); mContext.binder.callingUid = DpmMockContext.ANOTHER_UID; // Another package must not be allowed to request Device ID attestation. // Another package must not be allowed to request Device ID attestation. assertExpectException(SecurityException.class, null, assertExpectException(SecurityException.class, null, () -> dpms.enforceCallerCanRequestDeviceIdAttestation( () -> dpms.enforceCallerCanRequestDeviceIdAttestation( Loading Loading @@ -5757,6 +5758,7 @@ public class DevicePolicyManagerTest extends DpmTestBase { dpms.enforceCallerCanRequestDeviceIdAttestation(dpms.getCallerIdentity(admin1)); dpms.enforceCallerCanRequestDeviceIdAttestation(dpms.getCallerIdentity(admin1)); // But not another package. // But not another package. mContext.binder.callingUid = DpmMockContext.ANOTHER_UID; assertExpectException(SecurityException.class, null, assertExpectException(SecurityException.class, null, () -> dpms.enforceCallerCanRequestDeviceIdAttestation( () -> dpms.enforceCallerCanRequestDeviceIdAttestation( dpms.getCallerIdentity(null, admin2.getPackageName()))); dpms.getCallerIdentity(null, admin2.getPackageName()))); Loading