diff options
| author | 2023-03-02 15:37:07 +0000 | |
|---|---|---|
| committer | 2023-03-02 15:37:07 +0000 | |
| commit | 6c31e64588916ff19bec0d0bac247302f4543e7d (patch) | |
| tree | f3fbdff88d09152dde78d27eee8952f13284c424 | |
| parent | 1a8c7c147d6b2fd36eb8fa087ac5152ae66bdfac (diff) | |
| parent | 2605687ad7ac182c52a9267ab2bfa4fd6c7ba18b (diff) | |
Merge "Synchronise access to topRunningActivity" into tm-qpr-dev am: 961c53cb70 am: 2605687ad7
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21592560
Change-Id: I555a90cb58b2280a0371b01c26d752003fd0fdce
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
| -rw-r--r-- | services/core/java/com/android/server/wm/DisplayRotationCompatPolicy.java | 69 |
1 files changed, 34 insertions, 35 deletions
diff --git a/services/core/java/com/android/server/wm/DisplayRotationCompatPolicy.java b/services/core/java/com/android/server/wm/DisplayRotationCompatPolicy.java index 47bdba34ee24..41eb2c92923f 100644 --- a/services/core/java/com/android/server/wm/DisplayRotationCompatPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayRotationCompatPolicy.java @@ -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,25 +369,28 @@ final class DisplayRotationCompatPolicy { } mCameraIdPackageBiMap.put(packageName, cameraId); } - 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. - if (topActivity.getWindowingMode() == WINDOWING_MODE_FULLSCREEN) { - if (topActivity.mLetterboxUiController.isOverrideOrientationOnlyForCameraEnabled()) { - topActivity.recomputeConfiguration(); + 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. + if (topActivity.getWindowingMode() == WINDOWING_MODE_FULLSCREEN) { + if (topActivity.mLetterboxUiController + .isOverrideOrientationOnlyForCameraEnabled()) { + topActivity.recomputeConfiguration(); + } + mDisplayContent.updateOrientation(); + return; + } + // Checking that the whole app is in multi-window mode as we shouldn't show toast + // for the activity embedding case. + if (topActivity.getTask().getWindowingMode() == WINDOWING_MODE_MULTI_WINDOW + && isTreatmentEnabledForActivity(topActivity, /* mustBeFullscreen */ false)) { + showToast(R.string.display_rotation_camera_compat_toast_in_split_screen); } - updateOrientationWithWmLock(); - return; - } - // Checking that the whole app is in multi-window mode as we shouldn't show toast - // for the activity embedding case. - if (topActivity.getTask().getWindowingMode() == WINDOWING_MODE_MULTI_WINDOW - && isTreatmentEnabledForActivity(topActivity, /* mustBeFullscreen */ false)) { - showToast(R.string.display_rotation_camera_compat_toast_in_split_screen); } } @@ -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); - 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. - || topActivity.getWindowingMode() != WINDOWING_MODE_FULLSCREEN) { - return; - } - if (topActivity.mLetterboxUiController.isOverrideOrientationOnlyForCameraEnabled()) { - topActivity.recomputeConfiguration(); + 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. + || topActivity.getWindowingMode() != WINDOWING_MODE_FULLSCREEN) { + return; + } + if (topActivity.mLetterboxUiController.isOverrideOrientationOnlyForCameraEnabled()) { + topActivity.recomputeConfiguration(); + } + mDisplayContent.updateOrientation(); } - updateOrientationWithWmLock(); } private boolean isActivityForCameraIdRefreshing(String cameraId) { |