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

Commit 8f492b88 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Simplify legacy screen compat mode a bit" into main

parents 91a37ee6 a10d9b94
Loading
Loading
Loading
Loading
+1 −28
Original line number Diff line number Diff line
@@ -528,8 +528,6 @@ public final class ViewRootImpl implements ViewParent,
    // Set to true to stop input during an Activity Transition.
    boolean mPausedForTransition = false;

    boolean mLastInCompatMode = false;

    SurfaceHolder.Callback2 mSurfaceHolderCallback;
    BaseSurfaceHolder mSurfaceHolder;
    boolean mIsCreating;
@@ -1375,11 +1373,6 @@ public final class ViewRootImpl implements ViewParent,
                }
                if (DEBUG_LAYOUT) Log.d(mTag, "WindowLayout in setView:" + attrs);

                if (!compatibilityInfo.supportsScreen()) {
                    attrs.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
                    mLastInCompatMode = true;
                }

                mSoftInputMode = attrs.softInputMode;
                mWindowAttributesChanged = true;
                mAttachInfo.mRootView = view;
@@ -1913,10 +1906,6 @@ public final class ViewRootImpl implements ViewParent,
            // Keep track of the actual window flags supplied by the client.
            mClientWindowLayoutFlags = attrs.flags;

            // Preserve compatible window flag if exists.
            final int compatibleWindowFlag = mWindowAttributes.privateFlags
                    & WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;

            // Preserve system UI visibility.
            final int systemUiVisibility = mWindowAttributes.systemUiVisibility;
            final int subtreeSystemUiVisibility = mWindowAttributes.subtreeSystemUiVisibility;
@@ -1948,8 +1937,7 @@ public final class ViewRootImpl implements ViewParent,
            mWindowAttributes.subtreeSystemUiVisibility = subtreeSystemUiVisibility;
            mWindowAttributes.insetsFlags.appearance = appearance;
            mWindowAttributes.insetsFlags.behavior = behavior;
            mWindowAttributes.privateFlags |= compatibleWindowFlag
                    | appearanceAndBehaviorPrivateFlags;
            mWindowAttributes.privateFlags |= appearanceAndBehaviorPrivateFlags;

            if (mWindowAttributes.preservePreviousSurfaceInsets) {
                // Restore old surface insets.
@@ -3150,21 +3138,6 @@ public final class ViewRootImpl implements ViewParent,
        final boolean shouldOptimizeMeasure = shouldOptimizeMeasure(lp);

        WindowManager.LayoutParams params = null;
        CompatibilityInfo compatibilityInfo =
                mDisplay.getDisplayAdjustments().getCompatibilityInfo();
        if (compatibilityInfo.supportsScreen() == mLastInCompatMode) {
            params = lp;
            mFullRedrawNeeded = true;
            mLayoutRequested = true;
            if (mLastInCompatMode) {
                params.privateFlags &= ~WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
                mLastInCompatMode = false;
            } else {
                params.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
                mLastInCompatMode = true;
            }
        }

        Rect frame = mWinFrame;
        if (mFirst) {
            mFullRedrawNeeded = true;
+0 −12
Original line number Diff line number Diff line
@@ -3143,13 +3143,6 @@ public interface WindowManager extends ViewManager {
        @UnsupportedAppUsage
        public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 1 << 6;

        /** Window flag: special flag to limit the size of the window to be
         * original size ([320x480] x density). Used to create window for applications
         * running under compatibility mode.
         *
         * {@hide} */
        public static final int PRIVATE_FLAG_COMPATIBLE_WINDOW = 1 << 7;

        /** Window flag: a special option intended for system dialogs.  When
         * this flag is set, the window will demand focus unconditionally when
         * it is created.
@@ -3345,7 +3338,6 @@ public interface WindowManager extends ViewManager {
                SYSTEM_FLAG_SHOW_FOR_ALL_USERS,
                PRIVATE_FLAG_UNRESTRICTED_GESTURE_EXCLUSION,
                PRIVATE_FLAG_NO_MOVE_ANIMATION,
                PRIVATE_FLAG_COMPATIBLE_WINDOW,
                PRIVATE_FLAG_SYSTEM_ERROR,
                PRIVATE_FLAG_OPTIMIZE_MEASURE,
                PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS,
@@ -3398,10 +3390,6 @@ public interface WindowManager extends ViewManager {
                        mask = PRIVATE_FLAG_NO_MOVE_ANIMATION,
                        equals = PRIVATE_FLAG_NO_MOVE_ANIMATION,
                        name = "NO_MOVE_ANIMATION"),
                @ViewDebug.FlagToString(
                        mask = PRIVATE_FLAG_COMPATIBLE_WINDOW,
                        equals = PRIVATE_FLAG_COMPATIBLE_WINDOW,
                        name = "COMPATIBLE_WINDOW"),
                @ViewDebug.FlagToString(
                        mask = PRIVATE_FLAG_SYSTEM_ERROR,
                        equals = PRIVATE_FLAG_SYSTEM_ERROR,
+0 −5
Original line number Diff line number Diff line
@@ -277,11 +277,6 @@ public class SplashscreenContentDrawer {
        params.token = appToken;
        params.packageName = activityInfo.packageName;
        params.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS;

        if (!context.getResources().getCompatibilityInfo().supportsScreen()) {
            params.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_COMPATIBLE_WINDOW;
        }

        params.setTitle("Splash Screen " + title);
        return params;
    }
+3 −7
Original line number Diff line number Diff line
@@ -565,7 +565,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
    boolean idle;           // has the activity gone idle?
    boolean hasBeenLaunched;// has this activity ever been launched?
    boolean immersive;      // immersive mode (don't interrupt if possible)
    boolean forceNewConfig; // force re-create with new config next time
    boolean supportsEnterPipOnTaskSwitch;  // This flag is set by the system to indicate that the
        // activity can enter picture in picture while pausing (only when switching to another task)
    // The PiP params used when deferring the entering of picture-in-picture.
@@ -9600,7 +9599,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        // configurations because there are cases (like moving a task to the root pinned task) where
        // the combine configurations are equal, but would otherwise differ in the override config
        mTmpConfig.setTo(mLastReportedConfiguration.getMergedConfiguration());
        if (getConfiguration().equals(mTmpConfig) && !forceNewConfig && !displayChanged) {
        if (getConfiguration().equals(mTmpConfig) && !displayChanged) {
            ProtoLog.v(WM_DEBUG_CONFIGURATION, "Configuration & display "
                    + "unchanged in %s", this);
            return true;
@@ -9627,7 +9626,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            return true;
        }

        if (changes == 0 && !forceNewConfig) {
        if (changes == 0) {
            ProtoLog.v(WM_DEBUG_CONFIGURATION, "Configuration no differences in %s",
                    this);
            // There are no significant differences, so we won't relaunch but should still deliver
@@ -9649,7 +9648,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        // pick that up next time it starts.
        if (!attachedToProcess()) {
            ProtoLog.v(WM_DEBUG_CONFIGURATION, "Configuration doesn't matter not running %s", this);
            forceNewConfig = false;
            return true;
        }

@@ -9659,11 +9657,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
                Integer.toHexString(changes), Integer.toHexString(info.getRealConfigChanged()),
                mLastReportedConfiguration);

        if (shouldRelaunchLocked(changes, mTmpConfig) || forceNewConfig) {
        if (shouldRelaunchLocked(changes, mTmpConfig)) {
            // Aha, the activity isn't handling the change, so DIE DIE DIE.
            configChangeFlags |= changes;
            startFreezingScreenLocked(globalChanges);
            forceNewConfig = false;
            // Do not preserve window if it is freezing screen because the original window won't be
            // able to update drawn state that causes freeze timeout.
            preserveWindow &= isResizeOnlyChange(changes) && !mFreezingScreen;
@@ -9883,7 +9880,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        try {
            ProtoLog.i(WM_DEBUG_STATES, "Moving to %s Relaunching %s callers=%s" ,
                    (andResume ? "RESUMED" : "PAUSED"), this, Debug.getCallers(6));
            forceNewConfig = false;
            final ClientTransactionItem callbackItem = ActivityRelaunchItem.obtain(token,
                    pendingResults, pendingNewIntents, configChangeFlags,
                    new MergedConfiguration(getProcessGlobalConfiguration(),
+0 −1
Original line number Diff line number Diff line
@@ -906,7 +906,6 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
                }
                mService.getPackageManagerInternalLocked().notifyPackageUse(
                        r.intent.getComponent().getPackageName(), NOTIFY_PACKAGE_USE_ACTIVITY);
                r.forceNewConfig = false;
                mService.getAppWarningsLocked().onStartActivity(r);

                // Because we could be starting an Activity in the system process this may not go
Loading