summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Massimo Carli <mcarli@google.com> 2025-01-09 14:49:16 +0000
committer Massimo Carli <mcarli@google.com> 2025-01-09 17:19:56 +0000
commitada9afc4d5d48e731e1851a993cca864aeb864e1 (patch)
treebde4f2de666b701e8344aa886961bf1e61aa8597
parent1a2292b92b063e1419f152d30df88681a340e5f0 (diff)
Prevent NPE on AppCompatDisplayInsets
Flag: EXEMPT Small fix Fix: 383548418 Test: atest WmTests:ActivityRecordTests Test: atest WmTests:CameraCompatFreeformPolicyTests Test: atest WmTests:SizeCompatTests Change-Id: Iad34c2d4ec35c371435c0f37e1de950eaf07c9af
-rw-r--r--services/core/java/com/android/server/wm/ActivityRecord.java13
1 files changed, 6 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index 1fe61590a531..d31aed2aee37 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -8995,13 +8995,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
|| orientationRespectedWithInsets)) {
return;
}
- final AppCompatDisplayInsets mAppCompatDisplayInsets = getAppCompatDisplayInsets();
+ final AppCompatDisplayInsets appCompatDisplayInsets = getAppCompatDisplayInsets();
final AppCompatSizeCompatModePolicy scmPolicy =
mAppCompatController.getAppCompatSizeCompatModePolicy();
- if (scmPolicy.hasAppCompatDisplayInsetsWithoutInheritance()
- && mAppCompatDisplayInsets != null
- && !mAppCompatDisplayInsets.mIsInFixedOrientationOrAspectRatioLetterbox) {
+ if (appCompatDisplayInsets != null
+ && !appCompatDisplayInsets.mIsInFixedOrientationOrAspectRatioLetterbox) {
// App prefers to keep its original size.
// If the size compat is from previous fixed orientation letterboxing, we may want to
// have fixed orientation letterbox again, otherwise it will show the size compat
@@ -9053,8 +9052,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
.applyDesiredAspectRatio(newParentConfig, parentBounds, resolvedBounds,
containingBoundsWithInsets, containingBounds);
- if (scmPolicy.hasAppCompatDisplayInsetsWithoutInheritance()) {
- mAppCompatDisplayInsets.getBoundsByRotation(mTmpBounds,
+ if (appCompatDisplayInsets != null) {
+ appCompatDisplayInsets.getBoundsByRotation(mTmpBounds,
newParentConfig.windowConfiguration.getRotation());
if (resolvedBounds.width() != mTmpBounds.width()
|| resolvedBounds.height() != mTmpBounds.height()) {
@@ -9077,7 +9076,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
// Calculate app bounds using fixed orientation bounds because they will be needed later
// for comparison with size compat app bounds in {@link resolveSizeCompatModeConfiguration}.
- mResolveConfigHint.mTmpCompatInsets = mAppCompatDisplayInsets;
+ mResolveConfigHint.mTmpCompatInsets = appCompatDisplayInsets;
computeConfigByResolveHint(getResolvedOverrideConfiguration(), newParentConfig);
mAppCompatController.getAppCompatAspectRatioPolicy()
.setLetterboxBoundsForFixedOrientationAndAspectRatio(new Rect(resolvedBounds));