diff options
author | Sander Alewijnse <salewijnse@google.com> | 2014-07-29 12:01:38 +0100 |
---|---|---|
committer | Sander Alewijnse <salewijnse@google.com> | 2014-07-31 09:16:46 +0000 |
commit | a87863a8bddb033ca9ace11e7d78932d70d08ce3 (patch) | |
tree | 4bbd16fdf6b8a8149309b5f3f287a631fba5640b /services/devicepolicy | |
parent | d5ce9759524740cfb02638fd1d7b44315957b422 (diff) | |
download | frameworks_base-a87863a8bddb033ca9ace11e7d78932d70d08ce3.zip frameworks_base-a87863a8bddb033ca9ace11e7d78932d70d08ce3.tar.gz frameworks_base-a87863a8bddb033ca9ace11e7d78932d70d08ce3.tar.bz2 |
Fix deadlock window manager and device policy manager.
Removed all communication from wm to device policy manager.
Added initialization of cache in wm by dpms.
Change-Id: Ifa0b8bfcd625464b156d5cc0fb66d342deda1c27
Diffstat (limited to 'services/devicepolicy')
-rw-r--r-- | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 6ab504c..c6730bf 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -791,6 +791,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { policyFile.delete(); Slog.i(LOG_TAG, "Removed device policy file " + policyFile.getAbsolutePath()); } + updateScreenCaptureDisabledInWindowManager(userHandle, false /* default value */); } void loadDeviceOwner() { @@ -1367,6 +1368,16 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { new SetupContentObserver(mHandler).register(mContext.getContentResolver()); // Initialize the user setup state, to handle the upgrade case. updateUserSetupComplete(); + + // Update the screen capture disabled cache in the window manager + List<UserInfo> users = mUserManager.getUsers(true); + final int N = users.size(); + for (int i = 0; i < N; i++) { + int userHandle = users.get(i).id; + updateScreenCaptureDisabledInWindowManager(userHandle, + getScreenCaptureDisabled(null, userHandle)); + } + } private void cleanUpOldUsers() { @@ -3062,11 +3073,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { if (ap.disableScreenCapture != disabled) { ap.disableScreenCapture = disabled; saveSettingsLocked(userHandle); - try { - getWindowManager().updateScreenCaptureDisabled(userHandle); - } catch (RemoteException e) { - Log.w(LOG_TAG, "Unable to notify WindowManager.", e); - } + updateScreenCaptureDisabledInWindowManager(userHandle, disabled); } } } @@ -3097,6 +3104,17 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } } + private void updateScreenCaptureDisabledInWindowManager(int userHandle, boolean disabled) { + long ident = Binder.clearCallingIdentity(); + try { + getWindowManager().setScreenCaptureDisabled(userHandle, disabled); + } catch (RemoteException e) { + Log.w(LOG_TAG, "Unable to notify WindowManager.", e); + } finally { + Binder.restoreCallingIdentity(ident); + } + } + /** * The system property used to share the state of the camera. The native camera service * is expected to read this property and act accordingly. |