Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed969e18 authored by Rubin Xu's avatar Rubin Xu
Browse files

Reactivate backup service after device owner is cleared.

Bug: 23474411
Change-Id: I99da846493eb749828517d27f4384ab3fe647df5
parent 75344663
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -4236,6 +4236,17 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                mDeviceOwner.clearDeviceOwner();
                mDeviceOwner.writeOwnerFile();
                updateDeviceOwnerLocked();
                // Reactivate backup service.
                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 reactivating backup service.", e);
                } finally {
                    Binder.restoreCallingIdentity(ident);
                }
            }
        }
    }