Loading services/java/com/android/server/wm/WindowManagerService.java +33 −1 Original line number Diff line number Diff line Loading @@ -746,6 +746,14 @@ public class WindowManagerService extends IWindowManager.Stub mActivityManager = ActivityManagerNative.getDefault(); mBatteryStats = BatteryStatsService.getService(); mAppOps = (AppOpsManager)context.getSystemService(Context.APP_OPS_SERVICE); mAppOps.startWatchingMode(AppOpsManager.OP_SYSTEM_ALERT_WINDOW, null, new AppOpsManager.Callback() { @Override public void opChanged(int op, String packageName) { updateAppOpsState(); } } ); // Get persisted window scale setting mWindowAnimationScale = Settings.Global.getFloat(context.getContentResolver(), Loading Loading @@ -2150,7 +2158,10 @@ public class WindowManagerService extends IWindowManager.Stub win.attach(); mWindowMap.put(client.asBinder(), win); if (win.mAppOp != AppOpsManager.OP_NONE) { mAppOps.startOpNoThrow(win.mAppOp, win.getOwningUid(), win.getOwningPackage()); if (mAppOps.startOpNoThrow(win.mAppOp, win.getOwningUid(), win.getOwningPackage()) != AppOpsManager.MODE_ALLOWED) { win.setAppOpVisibilityLw(false); } } if (type == TYPE_APPLICATION_STARTING && token.appWindowToken != null) { Loading Loading @@ -2439,6 +2450,27 @@ public class WindowManagerService extends IWindowManager.Stub mInputMonitor.updateInputWindowsLw(true /*force*/); } public void updateAppOpsState() { synchronized(mWindowMap) { boolean changed = false; for (int i=0; i<mDisplayContents.size(); i++) { DisplayContent display = mDisplayContents.valueAt(i); WindowList windows = display.getWindowList(); for (int j=0; j<windows.size(); j++) { final WindowState win = windows.get(j); if (win.mAppOp != AppOpsManager.OP_NONE) { changed |= win.setAppOpVisibilityLw(mAppOps.checkOpNoThrow(win.mAppOp, win.getOwningUid(), win.getOwningPackage()) == AppOpsManager.MODE_ALLOWED); } } } if (changed) { scheduleAnimationLocked(); } } } static void logSurface(WindowState w, String msg, RuntimeException where) { String str = " SURFACE " + msg + ": " + w; if (where != null) { Loading services/java/com/android/server/wm/WindowState.java +28 −1 Original line number Diff line number Diff line Loading @@ -96,6 +96,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { int mSystemUiVisibility; boolean mPolicyVisibility = true; boolean mPolicyVisibilityAfterAnim = true; boolean mAppOpVisibility = true; boolean mAppFreezing; boolean mAttachedHidden; // is our parent window hidden? boolean mWallpaperVisible; // for wallpaper, what was last vis report? Loading Loading @@ -982,6 +983,10 @@ final class WindowState implements WindowManagerPolicy.WindowState { + this + ", type " + mAttrs.type + ", belonging to " + mOwnerUid); return false; } if (!mAppOpVisibility) { // Being hidden due to app op request. return false; } if (mPolicyVisibility && mPolicyVisibilityAfterAnim) { // Already showing. return false; Loading Loading @@ -1053,6 +1058,25 @@ final class WindowState implements WindowManagerPolicy.WindowState { return true; } public boolean setAppOpVisibilityLw(boolean state) { if (mAppOpVisibility != state) { mAppOpVisibility = state; if (state) { // If the policy visibility had last been to hide, then this // will incorrectly show at this point since we lost that // information. Not a big deal -- for the windows that have app // ops modifies they should only be hidden by policy due to the // lock screen, and the user won't be changing this if locked. // Plus it will quickly be fixed the next time we do a layout. showLw(true, false); } else { hideLw(true, false); } return true; } return false; } @Override public boolean isAlive() { return mClient.asBinder().isBinderAlive(); Loading Loading @@ -1179,11 +1203,14 @@ final class WindowState implements WindowManagerPolicy.WindowState { pw.print(" mSystemUiVisibility=0x"); pw.println(Integer.toHexString(mSystemUiVisibility)); } if (!mPolicyVisibility || !mPolicyVisibilityAfterAnim || mAttachedHidden) { if (!mPolicyVisibility || !mPolicyVisibilityAfterAnim || !mAppOpVisibility || mAttachedHidden) { pw.print(prefix); pw.print("mPolicyVisibility="); pw.print(mPolicyVisibility); pw.print(" mPolicyVisibilityAfterAnim="); pw.print(mPolicyVisibilityAfterAnim); pw.print(" mAppOpVisibility="); pw.print(mAppOpVisibility); pw.print(" mAttachedHidden="); pw.println(mAttachedHidden); } if (!mRelayoutCalled || mLayoutNeeded) { Loading Loading
services/java/com/android/server/wm/WindowManagerService.java +33 −1 Original line number Diff line number Diff line Loading @@ -746,6 +746,14 @@ public class WindowManagerService extends IWindowManager.Stub mActivityManager = ActivityManagerNative.getDefault(); mBatteryStats = BatteryStatsService.getService(); mAppOps = (AppOpsManager)context.getSystemService(Context.APP_OPS_SERVICE); mAppOps.startWatchingMode(AppOpsManager.OP_SYSTEM_ALERT_WINDOW, null, new AppOpsManager.Callback() { @Override public void opChanged(int op, String packageName) { updateAppOpsState(); } } ); // Get persisted window scale setting mWindowAnimationScale = Settings.Global.getFloat(context.getContentResolver(), Loading Loading @@ -2150,7 +2158,10 @@ public class WindowManagerService extends IWindowManager.Stub win.attach(); mWindowMap.put(client.asBinder(), win); if (win.mAppOp != AppOpsManager.OP_NONE) { mAppOps.startOpNoThrow(win.mAppOp, win.getOwningUid(), win.getOwningPackage()); if (mAppOps.startOpNoThrow(win.mAppOp, win.getOwningUid(), win.getOwningPackage()) != AppOpsManager.MODE_ALLOWED) { win.setAppOpVisibilityLw(false); } } if (type == TYPE_APPLICATION_STARTING && token.appWindowToken != null) { Loading Loading @@ -2439,6 +2450,27 @@ public class WindowManagerService extends IWindowManager.Stub mInputMonitor.updateInputWindowsLw(true /*force*/); } public void updateAppOpsState() { synchronized(mWindowMap) { boolean changed = false; for (int i=0; i<mDisplayContents.size(); i++) { DisplayContent display = mDisplayContents.valueAt(i); WindowList windows = display.getWindowList(); for (int j=0; j<windows.size(); j++) { final WindowState win = windows.get(j); if (win.mAppOp != AppOpsManager.OP_NONE) { changed |= win.setAppOpVisibilityLw(mAppOps.checkOpNoThrow(win.mAppOp, win.getOwningUid(), win.getOwningPackage()) == AppOpsManager.MODE_ALLOWED); } } } if (changed) { scheduleAnimationLocked(); } } } static void logSurface(WindowState w, String msg, RuntimeException where) { String str = " SURFACE " + msg + ": " + w; if (where != null) { Loading
services/java/com/android/server/wm/WindowState.java +28 −1 Original line number Diff line number Diff line Loading @@ -96,6 +96,7 @@ final class WindowState implements WindowManagerPolicy.WindowState { int mSystemUiVisibility; boolean mPolicyVisibility = true; boolean mPolicyVisibilityAfterAnim = true; boolean mAppOpVisibility = true; boolean mAppFreezing; boolean mAttachedHidden; // is our parent window hidden? boolean mWallpaperVisible; // for wallpaper, what was last vis report? Loading Loading @@ -982,6 +983,10 @@ final class WindowState implements WindowManagerPolicy.WindowState { + this + ", type " + mAttrs.type + ", belonging to " + mOwnerUid); return false; } if (!mAppOpVisibility) { // Being hidden due to app op request. return false; } if (mPolicyVisibility && mPolicyVisibilityAfterAnim) { // Already showing. return false; Loading Loading @@ -1053,6 +1058,25 @@ final class WindowState implements WindowManagerPolicy.WindowState { return true; } public boolean setAppOpVisibilityLw(boolean state) { if (mAppOpVisibility != state) { mAppOpVisibility = state; if (state) { // If the policy visibility had last been to hide, then this // will incorrectly show at this point since we lost that // information. Not a big deal -- for the windows that have app // ops modifies they should only be hidden by policy due to the // lock screen, and the user won't be changing this if locked. // Plus it will quickly be fixed the next time we do a layout. showLw(true, false); } else { hideLw(true, false); } return true; } return false; } @Override public boolean isAlive() { return mClient.asBinder().isBinderAlive(); Loading Loading @@ -1179,11 +1203,14 @@ final class WindowState implements WindowManagerPolicy.WindowState { pw.print(" mSystemUiVisibility=0x"); pw.println(Integer.toHexString(mSystemUiVisibility)); } if (!mPolicyVisibility || !mPolicyVisibilityAfterAnim || mAttachedHidden) { if (!mPolicyVisibility || !mPolicyVisibilityAfterAnim || !mAppOpVisibility || mAttachedHidden) { pw.print(prefix); pw.print("mPolicyVisibility="); pw.print(mPolicyVisibility); pw.print(" mPolicyVisibilityAfterAnim="); pw.print(mPolicyVisibilityAfterAnim); pw.print(" mAppOpVisibility="); pw.print(mAppOpVisibility); pw.print(" mAttachedHidden="); pw.println(mAttachedHidden); } if (!mRelayoutCalled || mLayoutNeeded) { Loading