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

Commit 8419e4bb authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Internal cleanup of window manager

- Remove unnecessary wrapper methods which were used
  for cross package access.
- WindowContainer is associated with display, it doesn't
  need to lookup again by WindowAnimator to update
  pendingLayoutChanges of DisplayContent.
- Remove unused methods and fields.
- Correct some locks in ActivityTaskManagerService.

Fix: 141248611
Test: go/wm-smoke

Change-Id: I5d5dbc9036f6edbfdf87fe5fb7883793def8836e
parent 062853fb
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -1106,14 +1106,10 @@ final class AccessibilityController {

        private final Point mTempPoint = new Point();

        private final Rect mTempRect = new Rect();

        private final Region mTempRegion = new Region();

        private final Region mTempRegion1 = new Region();

        private final Context mContext;

        private final WindowManagerService mService;

        private final Handler mHandler;
@@ -1127,7 +1123,6 @@ final class AccessibilityController {
        public WindowsForAccessibilityObserver(WindowManagerService windowManagerService,
                int displayId,
                WindowsForAccessibilityCallback callback) {
            mContext = windowManagerService.mContext;
            mService = windowManagerService;
            mCallback = callback;
            mDisplayId = displayId;
+11 −2
Original line number Diff line number Diff line
@@ -2202,7 +2202,9 @@ final class ActivityRecord extends ConfigurationContainer {
        stack.removeTimeoutsForActivity(this);
        // Clean-up activities are no longer relaunching (e.g. app process died). Notify window
        // manager so it can update its bookkeeping.
        mAtmService.mWindowManager.notifyAppRelaunchesCleared(appToken);
        if (mAppWindowToken != null) {
            mAppWindowToken.clearRelaunching();
        }
    }

    /**
@@ -2961,6 +2963,11 @@ final class ActivityRecord extends ConfigurationContainer {
        if (display != null) {
            display.handleActivitySizeCompatModeIfNeeded(r);
        }

        if (r.mAppWindowToken != null) {
            r.mAppWindowToken.getDisplayContent().mUnknownAppVisibilityController
                    .notifyAppResumedFinished(r.mAppWindowToken);
        }
    }

    /**
@@ -4311,7 +4318,9 @@ final class ActivityRecord extends ConfigurationContainer {
                    "Moving to " + (andResume ? "RESUMED" : "PAUSED") + " Relaunching " + this
                            + " callers=" + Debug.getCallers(6));
            forceNewConfig = false;
            mStackSupervisor.activityRelaunchingLocked(this);
            if (mAppWindowToken != null) {
                mAppWindowToken.startRelaunching();
            }
            final ClientTransactionItem callbackItem = ActivityRelaunchItem.obtain(pendingResults,
                    pendingNewIntents, configChangeFlags,
                    new MergedConfiguration(mAtmService.getGlobalConfiguration(),
+3 −5
Original line number Diff line number Diff line
@@ -2480,19 +2480,17 @@ public class ActivityStackSupervisor implements RecentTasks.Callbacks {
    }

    void activityRelaunchedLocked(IBinder token) {
        mWindowManager.notifyAppRelaunchingFinished(token);
        final ActivityRecord r = ActivityRecord.isInStackLocked(token);
        if (r != null) {
            if (r.mAppWindowToken != null) {
                r.mAppWindowToken.finishRelaunching();
            }
            if (r.getActivityStack().shouldSleepOrShutDownActivities()) {
                r.setSleeping(true, true);
            }
        }
    }

    void activityRelaunchingLocked(ActivityRecord r) {
        mWindowManager.notifyAppRelaunching(r.appToken);
    }

    void logStackState() {
        mActivityMetricsLogger.logWindowState();
    }
+2 −14
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ import static android.content.pm.PackageManager.FEATURE_ACTIVITIES_ON_SECONDARY_
import static android.content.pm.PackageManager.FEATURE_FREEFORM_WINDOW_MANAGEMENT;
import static android.content.pm.PackageManager.FEATURE_PICTURE_IN_PICTURE;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.content.res.Configuration.UI_MODE_TYPE_TELEVISION;
import static android.os.FactoryTest.FACTORY_TEST_HIGH_LEVEL;
import static android.os.FactoryTest.FACTORY_TEST_LOW_LEVEL;
import static android.os.FactoryTest.FACTORY_TEST_OFF;
@@ -550,7 +549,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
    /** The dimensions of the thumbnails in the Recents UI. */
    private int mThumbnailWidth;
    private int mThumbnailHeight;
    private float mFullscreenThumbnailScale;

    /**
     * Flag that indicates if multi-window is enabled.
@@ -790,15 +788,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
                    com.android.internal.R.dimen.thumbnail_width);
            mThumbnailHeight = res.getDimensionPixelSize(
                    com.android.internal.R.dimen.thumbnail_height);

            if ((globalConfig.uiMode & UI_MODE_TYPE_TELEVISION) == UI_MODE_TYPE_TELEVISION) {
                mFullscreenThumbnailScale = (float) res
                        .getInteger(com.android.internal.R.integer.thumbnail_width_tv) /
                        (float) globalConfig.screenWidthDp;
            } else {
                mFullscreenThumbnailScale = res.getFraction(
                        com.android.internal.R.fraction.thumbnail_fullscreen_scale, 1, 1);
            }
        }
    }

@@ -1697,7 +1686,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        final long origId = Binder.clearCallingIdentity();
        synchronized (mGlobalLock) {
            ActivityRecord.activityResumedLocked(token);
            mWindowManager.notifyAppResumedFinished(token);
        }
        Binder.restoreCallingIdentity(origId);
    }
@@ -2920,7 +2908,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
            mAmInternal.enforceCallingPermission(Manifest.permission.UPDATE_LOCK_TASK_PACKAGES,
                    "updateLockTaskPackages()");
        }
        synchronized (this) {
        synchronized (mGlobalLock) {
            if (DEBUG_LOCKTASK) Slog.w(TAG_LOCKTASK, "Whitelisting " + userId + ":"
                    + Arrays.toString(packages));
            getLockTaskController().updateLockTaskPackages(userId, packages);
@@ -5365,7 +5353,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub {
        final float scaleFactor = Settings.System.getFloatForUser(mContext.getContentResolver(),
                FONT_SCALE, 1.0f, userId);

        synchronized (this) {
        synchronized (mGlobalLock) {
            if (getGlobalConfiguration().fontScale == scaleFactor) {
                return;
            }
+1 −1
Original line number Diff line number Diff line
@@ -1999,8 +1999,8 @@ public class AppTransition implements Dump {
                            mNextAppTransitionFutureCallback, null /* finishedCallback */,
                            mNextAppTransitionScaleUp);
                    mNextAppTransitionFutureCallback = null;
                }
                    mService.requestTraversal();
                }
            });
        }
    }
Loading