summaryrefslogtreecommitdiffstats
path: root/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
diff options
context:
space:
mode:
authorDiogo Ferreira <diogo@underdev.org>2015-11-23 15:35:36 +0000
committerSteve Kondik <shade@chemlab.org>2015-11-27 05:41:41 -0800
commit27fd0c30b5b6e09e04a5d1100ae91f5b58cd15b2 (patch)
treec413b0c5e10aad13ae0b32f6b4368cd37b918661 /services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
parentc224db64965a67d5d2462eca5b0bc20def5fbb16 (diff)
downloadframeworks_base-27fd0c30b5b6e09e04a5d1100ae91f5b58cd15b2.zip
frameworks_base-27fd0c30b5b6e09e04a5d1100ae91f5b58cd15b2.tar.gz
frameworks_base-27fd0c30b5b6e09e04a5d1100ae91f5b58cd15b2.tar.bz2
services: devicepolicy: Restore backup service as system
Restoring the backup service must be performed by either system or root otherwise it will cause a SecurityException. This patch clears the uid, performs the call as system and then restores it. Fixes the following CTS tests: com.android.cts.devicepolicy.CustomDeviceOwnerTest -- testOwnerChangedBroadcast -- testSilentPackageInstall com.android.cts.devicepolicy.DeviceOwnerTest -- testCaCertManagement -- testCannotSetDeviceOwnerAgain -- testDeviceOwnerSetup -- testKeyManagement -- testLockTask -- testSystemUpdatePolicy -- testWifiConfigLockdown com.android.cts.devicepolicy.MixedDeviceOwnerTest -- testAccountManagement -- testApplicationRestrictions -- testDelegatedCertInstaller -- testPermissionGrant -- testPermissionGrantPreMApp -- testPermissionMixedPolicies -- testPermissionPolicy -- testPermissionPrompts -- testPersistentIntentResolving -- testScreenCaptureDisabled Change-Id: Ia26222f1fece14217554459c42679f82f7ceb980
Diffstat (limited to 'services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java')
-rw-r--r--services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index 3901082..b2cb2ff 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -4268,12 +4268,15 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
mDeviceOwner.writeOwnerFile();
updateDeviceOwnerLocked();
// Restore backup manager.
+ long ident = Binder.clearCallingIdentity();
try {
IBackupManager ibm = IBackupManager.Stub.asInterface(
ServiceManager.getService(Context.BACKUP_SERVICE));
ibm.setBackupServiceActive(UserHandle.USER_OWNER, true);
} catch (RemoteException e) {
throw new IllegalStateException("Failed activating backup service.", e);
+ } finally {
+ Binder.restoreCallingIdentity(ident);
}
}
}