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

Commit 034a8ecb authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Introducing ConfigurationContainerListener

Class provides a structured way for window containers on the window
manager side to listener for configuration changes happening in the
window controllers on the activity manager side so things stay in
sync and they don't miss anything.

Test: bit FrameworksServicesTests:com.android.server.wm.WindowContainerControllerTests
Test: bit FrameworksServicesTests:com.android.server.wm.ConfigurationContainerTests
Test: go/wm-smoke
Change-Id: I6a6bc98a35bda89b3aaa7a29a9814905f0c3a9ee
parent 7e18c933
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -191,10 +191,8 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
    private static final String TAG = TAG_WITH_CLASS_NAME ? "ActivityRecord" : TAG_AM;
    private static final String TAG_CONFIGURATION = TAG + POSTFIX_CONFIGURATION;
    private static final String TAG_SAVED_STATE = TAG + POSTFIX_SAVED_STATE;
    private static final String TAG_SCREENSHOTS = TAG + POSTFIX_SCREENSHOTS;
    private static final String TAG_STATES = TAG + POSTFIX_STATES;
    private static final String TAG_SWITCH = TAG + POSTFIX_SWITCH;
    private static final String TAG_THUMBNAILS = TAG + POSTFIX_THUMBNAILS;
    private static final String TAG_VISIBILITY = TAG + POSTFIX_VISIBILITY;

    private static final boolean SHOW_ACTIVITY_START_TIME = true;
@@ -937,8 +935,7 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
                (info.flags & FLAG_SHOW_FOR_ALL_USERS) != 0, info.configChanges,
                task.voiceSession != null, mLaunchTaskBehind, isAlwaysFocusable(),
                appInfo.targetSdkVersion, mRotationAnimationHint,
                ActivityManagerService.getInputDispatchingTimeoutLocked(this) * 1000000L,
                new Configuration(getOverrideConfiguration()), mBounds);
                ActivityManagerService.getInputDispatchingTimeoutLocked(this) * 1000000L, mBounds);

        task.addActivityToTop(this);

@@ -1122,7 +1119,7 @@ final class ActivityRecord extends ConfigurationContainer implements AppWindowCo
     * @return whether this activity supports PiP multi-window and can be put in the pinned stack.
     */
    boolean supportsPictureInPicture() {
        return service.mSupportsPictureInPicture && isActivityTypeStandard()
        return service.mSupportsPictureInPicture && isActivityTypeStandardOrUndefined()
                && info.supportsPictureInPicture();
    }

+3 −5
Original line number Diff line number Diff line
@@ -466,15 +466,13 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
        mTmpRect2.setEmpty();
        updateOverrideConfiguration();
        mWindowContainerController = createStackWindowController(display.mDisplayId, onTop,
                mTmpRect2, getOverrideConfiguration());
                mTmpRect2);
        mStackSupervisor.mStacks.put(mStackId, this);
        postAddToDisplay(display, mTmpRect2.isEmpty() ? null : mTmpRect2, onTop);
    }

    T createStackWindowController(int displayId, boolean onTop, Rect outBounds,
            Configuration overrideConfig) {
        return (T) new StackWindowController(mStackId, this, displayId, onTop, outBounds,
                overrideConfig);
    T createStackWindowController(int displayId, boolean onTop, Rect outBounds) {
        return (T) new StackWindowController(mStackId, this, displayId, onTop, outBounds);
    }

    T getWindowContainerController() {
+2 −3
Original line number Diff line number Diff line
@@ -39,9 +39,8 @@ class PinnedActivityStack extends ActivityStack<PinnedStackWindowController>

    @Override
    PinnedStackWindowController createStackWindowController(int displayId, boolean onTop,
            Rect outBounds, Configuration overrideConfig) {
        return new PinnedStackWindowController(mStackId, this, displayId, onTop, outBounds,
                overrideConfig);
            Rect outBounds) {
        return new PinnedStackWindowController(mStackId, this, displayId, onTop, outBounds);
    }

    Rect getDefaultPictureInPictureBounds(float aspectRatio) {
+1 −5
Original line number Diff line number Diff line
@@ -430,9 +430,8 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi
        }

        final Rect bounds = updateOverrideConfigurationFromLaunchBounds();
        final Configuration overrideConfig = getOverrideConfiguration();
        setWindowContainerController(new TaskWindowContainerController(taskId, this,
                getStack().getWindowContainerController(), userId, bounds, overrideConfig,
                getStack().getWindowContainerController(), userId, bounds,
                mResizeMode, mSupportsPictureInPicture, onTop,
                showForAllUsers, lastTaskDescription));
    }
@@ -1175,9 +1174,6 @@ class TaskRecord extends ConfigurationContainer implements TaskWindowContainerLi
        }
        // Only set this based on the first activity
        if (mActivities.isEmpty()) {
            // TODO: propagating this change to the WM side...Should probably be done by having
            // ConfigurationContainer change listener that the WindowContainerController registers
            // for.
            if (r.getActivityType() == ACTIVITY_TYPE_UNDEFINED) {
                // Normally non-standard activity type for the activity record will be set when the
                // object is created, however we delay setting the standard application type until
+6 −7
Original line number Diff line number Diff line
@@ -181,12 +181,12 @@ public class AppWindowContainerController
            int requestedOrientation, boolean fullscreen, boolean showForAllUsers, int configChanges,
            boolean voiceInteraction, boolean launchTaskBehind, boolean alwaysFocusable,
            int targetSdkVersion, int rotationAnimationHint, long inputDispatchingTimeoutNanos,
            Configuration overrideConfig, Rect bounds) {
            Rect bounds) {
        this(taskController, token, listener, index, requestedOrientation, fullscreen,
                showForAllUsers,
                configChanges, voiceInteraction, launchTaskBehind, alwaysFocusable,
                targetSdkVersion, rotationAnimationHint, inputDispatchingTimeoutNanos,
                WindowManagerService.getInstance(), overrideConfig, bounds);
                WindowManagerService.getInstance(), bounds);
    }

    public AppWindowContainerController(TaskWindowContainerController taskController,
@@ -194,7 +194,7 @@ public class AppWindowContainerController
            int requestedOrientation, boolean fullscreen, boolean showForAllUsers, int configChanges,
            boolean voiceInteraction, boolean launchTaskBehind, boolean alwaysFocusable,
            int targetSdkVersion, int rotationAnimationHint, long inputDispatchingTimeoutNanos,
            WindowManagerService service, Configuration overrideConfig, Rect bounds) {
            WindowManagerService service, Rect bounds) {
        super(listener, service);
        mHandler = new H(service.mH.getLooper());
        mToken = token;
@@ -215,7 +215,7 @@ public class AppWindowContainerController
            atoken = createAppWindow(mService, token, voiceInteraction, task.getDisplayContent(),
                    inputDispatchingTimeoutNanos, fullscreen, showForAllUsers, targetSdkVersion,
                    requestedOrientation, rotationAnimationHint, configChanges, launchTaskBehind,
                    alwaysFocusable, this, overrideConfig, bounds);
                    alwaysFocusable, this, bounds);
            if (DEBUG_TOKEN_MOVEMENT || DEBUG_ADD_REMOVE) Slog.v(TAG_WM, "addAppToken: " + atoken
                    + " controller=" + taskController + " at " + index);
            task.addChild(atoken, index);
@@ -227,12 +227,11 @@ public class AppWindowContainerController
            boolean voiceInteraction, DisplayContent dc, long inputDispatchingTimeoutNanos,
            boolean fullscreen, boolean showForAllUsers, int targetSdk, int orientation,
            int rotationAnimationHint, int configChanges, boolean launchTaskBehind,
            boolean alwaysFocusable, AppWindowContainerController controller,
            Configuration overrideConfig, Rect bounds) {
            boolean alwaysFocusable, AppWindowContainerController controller, Rect bounds) {
        return new AppWindowToken(service, token, voiceInteraction, dc,
                inputDispatchingTimeoutNanos, fullscreen, showForAllUsers, targetSdk, orientation,
                rotationAnimationHint, configChanges, launchTaskBehind, alwaysFocusable,
                controller, overrideConfig, bounds);
                controller, bounds);
    }

    public void removeContainer(int displayId) {
Loading