summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Massimo Carli <mcarli@google.com> 2025-01-10 07:23:13 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2025-01-10 07:23:13 -0800
commit7d5db209ccd22761047bf52933fd366954cbac9b (patch)
tree2a473d92abffd7bdf993983347409bcaa89193e4
parent445da41d5434180d532a87a5d3b2e7bc51885f23 (diff)
parentada9afc4d5d48e731e1851a993cca864aeb864e1 (diff)
Merge "Prevent NPE on AppCompatDisplayInsets" into main
-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));