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

Commit 618a9114 authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Remove RWC#getActivityRecord

Since ATM/WM hierarchy are merged, the ActivityRecord can be
retrieved by token directly without searching from all displays.

Bug: 163976519
Test: ActivityRecordTests
Change-Id: Ie64431f5735f08f2c1888d28baf448508af0ddbe
parent a9d2c1f1
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -1429,14 +1429,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        return mTokenMap.get(binder);
    }

    ActivityRecord getActivityRecord(IBinder binder) {
        final WindowToken token = getWindowToken(binder);
        if (token == null) {
            return null;
        }
        return token.asActivityRecord();
    }

    void addWindowToken(IBinder binder, WindowToken token) {
        final DisplayContent dc = mWmService.mRoot.getWindowTokenDisplay(token);
        if (dc != null) {
@@ -6985,7 +6977,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp

        @Override
        public void onAppTransitionFinishedLocked(IBinder token) {
            final ActivityRecord r = getActivityRecord(token);
            final ActivityRecord r = ActivityRecord.forTokenLocked(token);
            // Ignore the animating recents so the fixed rotation transform won't be switched twice
            // by finishing the recents animation and moving it to top. That also avoids flickering
            // due to wait for previous activity to be paused if it supports PiP that ignores the
+0 −16
Original line number Diff line number Diff line
@@ -569,22 +569,6 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
        }, true /* traverseTopToBottom */);
    }

    /**
     * Returns the app window token for the input binder if it exist in the system.
     * NOTE: Only one AppWindowToken is allowed to exist in the system for a binder token, since
     * AppWindowToken represents an activity which can only exist on one display.
     */
    ActivityRecord getActivityRecord(IBinder binder) {
        for (int i = mChildren.size() - 1; i >= 0; --i) {
            final DisplayContent dc = mChildren.get(i);
            final ActivityRecord activity = dc.getActivityRecord(binder);
            if (activity != null) {
                return activity;
            }
        }
        return null;
    }

    /** Returns the window token for the input binder if it exist in the system. */
    WindowToken getWindowToken(IBinder binder) {
        for (int i = mChildren.size() - 1; i >= 0; --i) {
+1 −1
Original line number Diff line number Diff line
@@ -5070,7 +5070,7 @@ class Task extends TaskFragment {
            mHandler.removeMessages(TRANSLUCENT_TIMEOUT_MSG);

            if (waitingActivity != null) {
                mWmService.setWindowOpaqueLocked(waitingActivity.token, false);
                waitingActivity.setMainWindowOpaque(false);
                if (waitingActivity.attachedToProcess()) {
                    try {
                        waitingActivity.app.getThread().scheduleTranslucentConversionComplete(
+1 −8
Original line number Diff line number Diff line
@@ -1073,7 +1073,7 @@ public class WindowManagerService extends IWindowManager.Stub

        @Override
        public void onAppTransitionFinishedLocked(IBinder token) {
            final ActivityRecord atoken = mRoot.getActivityRecord(token);
            final ActivityRecord atoken = ActivityRecord.forTokenLocked(token);
            if (atoken == null) {
                return;
            }
@@ -3105,13 +3105,6 @@ public class WindowManagerService extends IWindowManager.Stub
        return mRecentsAnimationController != null && mRecentsAnimationController.isTargetApp(r);
    }

    void setWindowOpaqueLocked(IBinder token, boolean isOpaque) {
        final ActivityRecord wtoken = mRoot.getActivityRecord(token);
        if (wtoken != null) {
            wtoken.setMainWindowOpaque(isOpaque);
        }
    }

    boolean isValidPictureInPictureAspectRatio(DisplayContent displayContent, float aspectRatio) {
        return displayContent.getPinnedTaskController().isValidPictureInPictureAspectRatio(
                aspectRatio);
+2 −4
Original line number Diff line number Diff line
@@ -1802,8 +1802,7 @@ class WindowTestsBase extends SystemServiceTestsBase {
        @Override
        public void addStartingWindow(StartingWindowInfo info) {
            synchronized (mWMService.mGlobalLock) {
                final ActivityRecord activity = mWMService.mRoot.getActivityRecord(
                        info.appToken);
                final ActivityRecord activity = ActivityRecord.forTokenLocked(info.appToken);
                IWindow iWindow = mock(IWindow.class);
                doReturn(mock(IBinder.class)).when(iWindow).asBinder();
                final WindowState window = WindowTestsBase.createWindow(null,
@@ -1825,8 +1824,7 @@ class WindowTestsBase extends SystemServiceTestsBase {
                final IBinder appToken = mTaskAppMap.get(removalInfo.taskId);
                if (appToken != null) {
                    mTaskAppMap.remove(removalInfo.taskId);
                    final ActivityRecord activity = mWMService.mRoot.getActivityRecord(
                            appToken);
                    final ActivityRecord activity = ActivityRecord.forTokenLocked(appToken);
                    WindowState win = mAppWindowMap.remove(appToken);
                    activity.removeChild(win);
                    activity.mStartingWindow = null;