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

Commit 56d7022d authored by Vladislav Kuzkokov's avatar Vladislav Kuzkokov Committed by android-build-merger
Browse files

Fix backup for users hit by erroneous backup disabling

am: 1975021d

Change-Id: I4421e9642c2e89bf17535ef3212617d268c1c9d2
parents 62c89396 1975021d
Loading
Loading
Loading
Loading
+15 −6
Original line number Original line Diff line number Diff line
@@ -496,6 +496,12 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                    }
                    }
                });
                });
            }
            }
            // STOPSHIP: Remove this code once all dogfood devices are fixed. See b/31754835
            if (Intent.ACTION_BOOT_COMPLETED.equals(action) && !mOwners.hasDeviceOwner()
                    && !isBackupServiceEnabledInternal()) {
                setBackupServiceEnabledInternal(true);
                Slog.w(LOG_TAG, "Fix backup for device that is not in Device Owner mode.");
            }
            if (Intent.ACTION_USER_UNLOCKED.equals(action)
            if (Intent.ACTION_USER_UNLOCKED.equals(action)
                    || Intent.ACTION_USER_STARTED.equals(action)
                    || Intent.ACTION_USER_STARTED.equals(action)
                    || KeyChain.ACTION_STORAGE_CHANGED.equals(action)) {
                    || KeyChain.ACTION_STORAGE_CHANGED.equals(action)) {
@@ -9319,6 +9325,10 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        }
        }
        synchronized (this) {
        synchronized (this) {
            getActiveAdminForCallerLocked(admin, DeviceAdminInfo.USES_POLICY_DEVICE_OWNER);
            getActiveAdminForCallerLocked(admin, DeviceAdminInfo.USES_POLICY_DEVICE_OWNER);
            return isBackupServiceEnabledInternal();
        }
    }
    private boolean isBackupServiceEnabledInternal() {
        try {
        try {
            IBackupManager ibm = mInjector.getIBackupManager();
            IBackupManager ibm = mInjector.getIBackupManager();
            return ibm != null && ibm.isBackupServiceActive(UserHandle.USER_SYSTEM);
            return ibm != null && ibm.isBackupServiceActive(UserHandle.USER_SYSTEM);
@@ -9327,4 +9337,3 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        }
        }
    }
    }
}
}
}