From 26ac6a6fd0ef43803c6edd786c8f1fa715ae3cca Mon Sep 17 00:00:00 2001 From: Zoltan Szatmary-Ban Date: Thu, 13 Nov 2014 20:49:43 +0000 Subject: Shutdown backup manager service when device owner is set Bug: 16641441 Change-Id: I3fe54e43324c15dabd56834a923e8e8cb4eea98d --- .../server/devicepolicy/DevicePolicyManagerService.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'services') diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 0713772..6bf2606 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -34,6 +34,7 @@ import android.app.admin.DeviceAdminReceiver; import android.app.admin.DevicePolicyManager; import android.app.admin.DevicePolicyManagerInternal; import android.app.admin.IDevicePolicyManager; +import android.app.backup.IBackupManager; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.ContentResolver; @@ -3650,6 +3651,18 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { "Trying to set device owner but device owner is already set."); } + // Shutting down backup manager service permanently. + long ident = Binder.clearCallingIdentity(); + try { + IBackupManager ibm = IBackupManager.Stub.asInterface( + ServiceManager.getService(Context.BACKUP_SERVICE)); + ibm.setBackupServiceActive(UserHandle.USER_OWNER, false); + } catch (RemoteException e) { + throw new IllegalStateException("Failed deactivating backup service.", e); + } finally { + Binder.restoreCallingIdentity(ident); + } + if (mDeviceOwner == null) { // Device owner is not set and does not exist, set it. mDeviceOwner = DeviceOwner.createWithDeviceOwner(packageName, ownerName); -- cgit v1.1