OSDN Git Service

Use the correct lock to protect members in PolicyControl
authortiger_huang <tiger_huang@htc.com>
Mon, 29 Jun 2015 09:17:30 +0000 (17:17 +0800)
committerTiger Huang <tiger_huang@htc.com>
Mon, 29 Jun 2015 09:22:01 +0000 (09:22 +0000)
Members in PolicyControl can be accessed by multiple threads via the
public functions called by PhoneWindowManager. Most of the functions
are called with the window-manager-lock held, but reloadFromSetting()
is an exception.

In this patch, we acquire the window-manager-lock before calling
reloadFromSetting() to ensure accessing the members with the same
lock held.

Change-Id: I54ac5cab2a2d74c568fa96145f7a6741c6d99e36

policy/src/com/android/internal/policy/impl/PhoneWindowManager.java

index d4c530b..1e047b9 100644 (file)
@@ -1567,6 +1567,8 @@ public class PhoneWindowManager implements WindowManagerPolicy {
             if (mImmersiveModeConfirmation != null) {
                 mImmersiveModeConfirmation.loadSetting(mCurrentUserId);
             }
+        }
+        synchronized (mWindowManagerFuncs.getWindowManagerLock()) {
             PolicyControl.reloadFromSetting(mContext);
         }
         if (updateRotation) {