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

Commit 8aafd3a8 authored by Filip Gruszczynski's avatar Filip Gruszczynski
Browse files

Refactoring: Delete AppWindowToken.willBeHidden field.

The only time AppWindowToken.willBeHidden is used is for determining
if the app should contribute to calculating orientation. In the same
check AppWindowToken.hiddenRequested will be or-ed with willBeHiden,
so it's enough that hiddenRequested to be set.

The only place where willBeHidden is set, is right before
WMS.setAppVisibility is called, which will set hiddenRequested.
Because of this willBeHidden is unnecessary.

Change-Id: Iea35f39f72e7f0dcd76205ef580f3a74cac72d08
parent 5e65d1a9
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -143,7 +143,6 @@ interface IWindowManager
    void setAppStartingWindow(IBinder token, String pkg, int theme,
    void setAppStartingWindow(IBinder token, String pkg, int theme,
            in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
            in CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes,
            int icon, int logo, int windowFlags, IBinder transferFrom, boolean createIfNeeded);
            int icon, int logo, int windowFlags, IBinder transferFrom, boolean createIfNeeded);
    void setAppWillBeHidden(IBinder token);
    void setAppVisibility(IBinder token, boolean visible);
    void setAppVisibility(IBinder token, boolean visible);
    void startAppFreezingScreen(IBinder token, int configChanges);
    void startAppFreezingScreen(IBinder token, int configChanges);
    void stopAppFreezingScreen(IBinder token, boolean force);
    void stopAppFreezingScreen(IBinder token, boolean force);
+0 −5
Original line number Original line Diff line number Diff line
@@ -1948,7 +1948,6 @@ final class ActivityStack {
                            ? AppTransition.TRANSIT_ACTIVITY_CLOSE
                            ? AppTransition.TRANSIT_ACTIVITY_CLOSE
                            : AppTransition.TRANSIT_TASK_CLOSE, false);
                            : AppTransition.TRANSIT_TASK_CLOSE, false);
                }
                }
                mWindowManager.setAppWillBeHidden(prev.appToken);
                mWindowManager.setAppVisibility(prev.appToken, false);
                mWindowManager.setAppVisibility(prev.appToken, false);
            } else {
            } else {
                if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION,
                if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION,
@@ -1964,10 +1963,6 @@ final class ActivityStack {
                                    : AppTransition.TRANSIT_TASK_OPEN, false);
                                    : AppTransition.TRANSIT_TASK_OPEN, false);
                }
                }
            }
            }
            if (false) {
                mWindowManager.setAppWillBeHidden(prev.appToken);
                mWindowManager.setAppVisibility(prev.appToken, false);
            }
        } else {
        } else {
            if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION, "Prepare open transition: no previous");
            if (DEBUG_TRANSITION) Slog.v(TAG_TRANSITION, "Prepare open transition: no previous");
            if (mNoAnimActivities.contains(next)) {
            if (mNoAnimActivities.contains(next)) {
+0 −5
Original line number Original line Diff line number Diff line
@@ -74,10 +74,6 @@ class AppWindowToken extends WindowToken {
    // case do not clear allDrawn until the animation completes.
    // case do not clear allDrawn until the animation completes.
    boolean deferClearAllDrawn;
    boolean deferClearAllDrawn;


    // Is this token going to be hidden in a little while?  If so, it
    // won't be taken into account for setting the screen orientation.
    boolean willBeHidden;

    // Is this window's surface needed?  This is almost like hidden, except
    // Is this window's surface needed?  This is almost like hidden, except
    // it will sometimes be true a little earlier: when the token has
    // it will sometimes be true a little earlier: when the token has
    // been shown, but is still waiting for its app transition to execute
    // been shown, but is still waiting for its app transition to execute
@@ -318,7 +314,6 @@ class AppWindowToken extends WindowToken {
                pw.print(" requestedOrientation="); pw.println(requestedOrientation);
                pw.print(" requestedOrientation="); pw.println(requestedOrientation);
        pw.print(prefix); pw.print("hiddenRequested="); pw.print(hiddenRequested);
        pw.print(prefix); pw.print("hiddenRequested="); pw.print(hiddenRequested);
                pw.print(" clientHidden="); pw.print(clientHidden);
                pw.print(" clientHidden="); pw.print(clientHidden);
                pw.print(" willBeHidden="); pw.print(willBeHidden);
                pw.print(" reportedDrawn="); pw.print(reportedDrawn);
                pw.print(" reportedDrawn="); pw.print(reportedDrawn);
                pw.print(" reportedVisible="); pw.println(reportedVisible);
                pw.print(" reportedVisible="); pw.println(reportedVisible);
        if (paused) {
        if (paused) {
+2 −24
Original line number Original line Diff line number Diff line
@@ -3211,8 +3211,7 @@ public class WindowManagerService extends IWindowManager.Stub


                // if we're about to tear down this window and not seek for
                // if we're about to tear down this window and not seek for
                // the behind activity, don't use it for orientation
                // the behind activity, don't use it for orientation
                if (!findingBehind
                if (!findingBehind && !atoken.hidden && atoken.hiddenRequested) {
                        && (!atoken.hidden && atoken.hiddenRequested)) {
                    if (DEBUG_ORIENTATION) Slog.v(TAG, "Skipping " + atoken
                    if (DEBUG_ORIENTATION) Slog.v(TAG, "Skipping " + atoken
                            + " -- going to hide");
                            + " -- going to hide");
                    continue;
                    continue;
@@ -3233,7 +3232,7 @@ public class WindowManagerService extends IWindowManager.Stub
                }
                }


                // We ignore any hidden applications on the top.
                // We ignore any hidden applications on the top.
                if (atoken.hiddenRequested || atoken.willBeHidden) {
                if (atoken.hiddenRequested) {
                    if (DEBUG_ORIENTATION) Slog.v(TAG, "Skipping " + atoken
                    if (DEBUG_ORIENTATION) Slog.v(TAG, "Skipping " + atoken
                            + " -- hidden on top");
                            + " -- hidden on top");
                    continue;
                    continue;
@@ -3733,7 +3732,6 @@ public class WindowManagerService extends IWindowManager.Stub
            if (!ttoken.hidden) {
            if (!ttoken.hidden) {
                wtoken.hidden = false;
                wtoken.hidden = false;
                wtoken.hiddenRequested = false;
                wtoken.hiddenRequested = false;
                wtoken.willBeHidden = false;
            }
            }
            if (wtoken.clientHidden != ttoken.clientHidden) {
            if (wtoken.clientHidden != ttoken.clientHidden) {
                wtoken.clientHidden = ttoken.clientHidden;
                wtoken.clientHidden = ttoken.clientHidden;
@@ -3789,25 +3787,6 @@ public class WindowManagerService extends IWindowManager.Stub
        }
        }
    }
    }


    @Override
    public void setAppWillBeHidden(IBinder token) {
        if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
                "setAppWillBeHidden()")) {
            throw new SecurityException("Requires MANAGE_APP_TOKENS permission");
        }

        AppWindowToken wtoken;

        synchronized(mWindowMap) {
            wtoken = findAppWindowToken(token);
            if (wtoken == null) {
                Slog.w(TAG, "Attempted to set will be hidden of non-existing app token: " + token);
                return;
            }
            wtoken.willBeHidden = true;
        }
    }

    public void setAppFullscreen(IBinder token, boolean toOpaque) {
    public void setAppFullscreen(IBinder token, boolean toOpaque) {
        synchronized (mWindowMap) {
        synchronized (mWindowMap) {
            AppWindowToken atoken = findAppWindowToken(token);
            AppWindowToken atoken = findAppWindowToken(token);
@@ -3844,7 +3823,6 @@ public class WindowManagerService extends IWindowManager.Stub
            wtoken.sendAppVisibilityToClients();
            wtoken.sendAppVisibilityToClients();
        }
        }


        wtoken.willBeHidden = false;
        // Allow for state changes and animation to be applied if:
        // Allow for state changes and animation to be applied if:
        // * token is transitioning visibility state
        // * token is transitioning visibility state
        // * or the token was marked as hidden and is exiting before we had a chance to play the
        // * or the token was marked as hidden and is exiting before we had a chance to play the
+0 −10
Original line number Original line Diff line number Diff line
@@ -174,16 +174,6 @@ public class WindowManagerPermissionTests extends TestCase {
            fail("Unexpected remote exception");
            fail("Unexpected remote exception");
        }
        }


        try {
            mWm.setAppWillBeHidden(null);
            fail("IWindowManager.setAppWillBeHidden did not throw SecurityException as"
                    + " expected");
        } catch (SecurityException e) {
            // expected
        } catch (RemoteException e) {
            fail("Unexpected remote exception");
        }

        try {
        try {
            mWm.setAppVisibility(null, false);
            mWm.setAppVisibility(null, false);
            fail("IWindowManager.setAppVisibility did not throw SecurityException as"
            fail("IWindowManager.setAppVisibility did not throw SecurityException as"
Loading