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

Commit 725125d5 authored by Automerger Merge Worker's avatar Automerger Merge Worker Committed by Android (Google) Code Review
Browse files

Merge "Merge "Synchronise access to topRunningActivity" into tm-qpr-dev am:...

Merge "Merge "Synchronise access to topRunningActivity" into tm-qpr-dev am: 961c53cb am: 2605687a am: 6c31e645 am: 036cf5dd"
parents 1299ee9e 112072df
Loading
Loading
Loading
Loading
+34 −35
Original line number Diff line number Diff line
@@ -359,12 +359,6 @@ final class DisplayRotationCompatPolicy {
                CAMERA_OPENED_ROTATION_UPDATE_DELAY_MS);
    }

    private void updateOrientationWithWmLock() {
        synchronized (mWmService.mGlobalLock) {
            mDisplayContent.updateOrientation();
        }
    }

    private void delayedUpdateOrientationWithWmLock(
            @NonNull String cameraId, @NonNull String packageName) {
        synchronized (this) {
@@ -375,18 +369,20 @@ final class DisplayRotationCompatPolicy {
            }
            mCameraIdPackageBiMap.put(packageName, cameraId);
        }
        synchronized (mWmService.mGlobalLock) {
            ActivityRecord topActivity = mDisplayContent.topRunningActivity(
                        /* considerKeyguardState= */ true);
            if (topActivity == null || topActivity.getTask() == null) {
                return;
            }
        // Checking whether an activity in fullscreen rather than the task as this camera compat
        // treatment doesn't cover activity embedding.
            // Checking whether an activity in fullscreen rather than the task as this camera
            // compat treatment doesn't cover activity embedding.
            if (topActivity.getWindowingMode() == WINDOWING_MODE_FULLSCREEN) {
            if (topActivity.mLetterboxUiController.isOverrideOrientationOnlyForCameraEnabled()) {
                if (topActivity.mLetterboxUiController
                        .isOverrideOrientationOnlyForCameraEnabled()) {
                    topActivity.recomputeConfiguration();
                }
            updateOrientationWithWmLock();
                mDisplayContent.updateOrientation();
                return;
            }
            // Checking that the whole app is in multi-window mode as we shouldn't show toast
@@ -396,6 +392,7 @@ final class DisplayRotationCompatPolicy {
                showToast(R.string.display_rotation_camera_compat_toast_in_split_screen);
            }
        }
    }

    @VisibleForTesting
    void showToast(@StringRes int stringRes) {
@@ -441,18 +438,20 @@ final class DisplayRotationCompatPolicy {
        ProtoLog.v(WM_DEBUG_ORIENTATION,
                "Display id=%d is notified that Camera %s is closed, updating rotation.",
                mDisplayContent.mDisplayId, cameraId);
        synchronized (mWmService.mGlobalLock) {
            ActivityRecord topActivity = mDisplayContent.topRunningActivity(
                    /* considerKeyguardState= */ true);
            if (topActivity == null
                // Checking whether an activity in fullscreen rather than the task as this camera
                // compat treatment doesn't cover activity embedding.
                    // Checking whether an activity in fullscreen rather than the task as this
                    // camera compat treatment doesn't cover activity embedding.
                    || topActivity.getWindowingMode() != WINDOWING_MODE_FULLSCREEN) {
                return;
            }
            if (topActivity.mLetterboxUiController.isOverrideOrientationOnlyForCameraEnabled()) {
                topActivity.recomputeConfiguration();
            }
        updateOrientationWithWmLock();
            mDisplayContent.updateOrientation();
        }
    }

    private boolean isActivityForCameraIdRefreshing(String cameraId) {