From 837f1035a608d2d36aef5fb448ec1fbd1d927f5f Mon Sep 17 00:00:00 2001 From: Benjamin Franz Date: Tue, 21 Apr 2015 14:38:48 +0100 Subject: Recover status bar enabled state for all users Move the update of status bar enabled setting to loadSettingsLocked and thereby recovering the enabled state for all users, not only the user owner. Bug: 20416833 Change-Id: Iee3d6e0f3ea8ebc5d72c0ed165bea4595ed073ba --- .../devicepolicy/DevicePolicyManagerService.java | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index e22a2cc..687bbf8 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -1634,6 +1634,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { syncDeviceCapabilitiesLocked(policy); updateMaximumTimeToLockLocked(policy); updateLockTaskPackagesLocked(policy, userHandle); + if (!policy.mStatusBarEnabledState) { + setStatusBarEnabledStateInternal(policy.mStatusBarEnabledState, userHandle); + } } private void updateLockTaskPackagesLocked(DevicePolicyData policy, int userId) { @@ -1708,7 +1711,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { if (!mHasFeature) { return; } - DevicePolicyData policy = getUserData(UserHandle.USER_OWNER); + getUserData(UserHandle.USER_OWNER); loadDeviceOwner(); cleanUpOldUsers(); // Register an observer for watching for user setup complete. @@ -1724,11 +1727,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { updateScreenCaptureDisabledInWindowManager(userHandle, getScreenCaptureDisabled(null, userHandle)); } - - if (mDeviceOwner != null && mDeviceOwner.hasDeviceOwner() - && !policy.mStatusBarEnabledState) { - setStatusBarEnabledStateInternal(STATUS_BAR_DISABLE_MASK, UserHandle.USER_OWNER); - } } private void cleanUpOldUsers() { @@ -5871,22 +5869,20 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { DevicePolicyData policy = getUserData(userId); if (policy.mStatusBarEnabledState != enabled) { policy.mStatusBarEnabledState = enabled; - setStatusBarEnabledStateInternal( - enabled ? StatusBarManager.DISABLE_NONE : STATUS_BAR_DISABLE_MASK, - userId); + setStatusBarEnabledStateInternal(enabled, userId); saveSettingsLocked(userId); } } } - private void setStatusBarEnabledStateInternal(int flags, int userId) { + private void setStatusBarEnabledStateInternal(boolean enabled, int userId) { long ident = Binder.clearCallingIdentity(); try { IStatusBarService statusBarService = IStatusBarService.Stub.asInterface( ServiceManager.checkService(Context.STATUS_BAR_SERVICE)); if (statusBarService != null) { - statusBarService.disableForUser(flags, mToken, - mDeviceOwner.getDeviceOwnerPackageName(), userId); + int flags = enabled ? StatusBarManager.DISABLE_NONE : STATUS_BAR_DISABLE_MASK; + statusBarService.disableForUser(flags, mToken, mContext.getPackageName(), userId); } } catch (RemoteException e) { Slog.e(LOG_TAG, "Failed to disable the status bar", e); -- cgit v1.1