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

Commit ac30688b authored by Craig Mautner's avatar Craig Mautner Committed by Android Git Automerger
Browse files

am f0b36c55: Merge "Refactor setAppOpVisibility implementation."

# Via Android (Google) Code Review (1) and Craig Mautner (1)
* commit 'f0b36c55':
  Refactor setAppOpVisibility implementation.
parents 58300de3 f0b36c55
Loading
Loading
Loading
Loading
+7 −14
Original line number Diff line number Diff line
@@ -2452,22 +2452,15 @@ public class WindowManagerService extends IWindowManager.Stub

    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);
            AllWindowsIterator iterator = new AllWindowsIterator();
            while (iterator.hasNext()) {
                final WindowState win = iterator.next();
                if (win.mAppOp != AppOpsManager.OP_NONE) {
                        changed |= win.setAppOpVisibilityLw(mAppOps.checkOpNoThrow(win.mAppOp,
                                win.getOwningUid(),
                                win.getOwningPackage()) == AppOpsManager.MODE_ALLOWED);
                    }
                    final int mode = mAppOps.checkOpNoThrow(win.mAppOp, win.getOwningUid(),
                            win.getOwningPackage());
                    win.setAppOpVisibilityLw(mode == AppOpsManager.MODE_ALLOWED);
                }
            }
            if (changed) {
                scheduleAnimationLocked();
            }
        }
    }

+3 −5
Original line number Diff line number Diff line
@@ -1064,7 +1064,7 @@ final class WindowState implements WindowManagerPolicy.WindowState {
        return true;
    }

    public boolean setAppOpVisibilityLw(boolean state) {
    public void setAppOpVisibilityLw(boolean state) {
        if (mAppOpVisibility != state) {
            mAppOpVisibility = state;
            if (state) {
@@ -1074,13 +1074,11 @@ final class WindowState implements WindowManagerPolicy.WindowState {
                // 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);
                showLw(true, true);
            } else {
                hideLw(true, false);
                hideLw(true, true);
            }
            return true;
        }
        return false;
    }

    @Override