Rename layoutLetterbox() following existing conventions
The layoutLetterbox() method can be a no-op on some conditions
so the right name should be layoutLetterboxIfNeeded()
Same for updateLetterboxSurface() renamed as
updateLetterboxSurfaceIfNeeded()
Bug: 324417794
Test: atest WmTests:LetterboxUiControllerTest
Change-Id: I1ad7f11e4b16a9b2b8b0e2d46c5ddcf1ead6de84
diff --git a/services/core/java/com/android/server/wm/ActivityRecord.java b/services/core/java/com/android/server/wm/ActivityRecord.java
index 7b59759..2b0cd26 100644
--- a/services/core/java/com/android/server/wm/ActivityRecord.java
+++ b/services/core/java/com/android/server/wm/ActivityRecord.java
@@ -1843,20 +1843,20 @@
mLetterboxUiController.onMovedToDisplay(mDisplayContent.getDisplayId());
}
- void layoutLetterbox(WindowState winHint) {
- mLetterboxUiController.layoutLetterbox(winHint);
+ void layoutLetterboxIfNeeded(WindowState winHint) {
+ mLetterboxUiController.layoutLetterboxIfNeeded(winHint);
}
boolean hasWallpaperBackgroundForLetterbox() {
return mLetterboxUiController.hasWallpaperBackgroundForLetterbox();
}
- void updateLetterboxSurface(WindowState winHint, Transaction t) {
- mLetterboxUiController.updateLetterboxSurface(winHint, t);
+ void updateLetterboxSurfaceIfNeeded(WindowState winHint, Transaction t) {
+ mLetterboxUiController.updateLetterboxSurfaceIfNeeded(winHint, t);
}
- void updateLetterboxSurface(WindowState winHint) {
- mLetterboxUiController.updateLetterboxSurface(winHint);
+ void updateLetterboxSurfaceIfNeeded(WindowState winHint) {
+ mLetterboxUiController.updateLetterboxSurfaceIfNeeded(winHint);
}
/** Gets the letterbox insets. The insets will be empty if there is no letterbox. */
@@ -4496,7 +4496,7 @@
}
super.removeChild(child);
checkKeyguardFlagsChanged();
- updateLetterboxSurface(child);
+ updateLetterboxSurfaceIfNeeded(child);
}
void setAppLayoutChanges(int changes, String reason) {
@@ -5966,7 +5966,7 @@
if (destroyedSomething) {
final DisplayContent dc = getDisplayContent();
dc.assignWindowLayers(true /*setLayoutNeeded*/);
- updateLetterboxSurface(null);
+ updateLetterboxSurfaceIfNeeded(null);
}
}
@@ -7618,7 +7618,7 @@
}
if (mNeedsLetterboxedAnimation) {
- updateLetterboxSurface(findMainWindow(), t);
+ updateLetterboxSurfaceIfNeeded(findMainWindow(), t);
mNeedsAnimationBoundsLayer = true;
}
@@ -7786,7 +7786,7 @@
mNeedsAnimationBoundsLayer = false;
if (mNeedsLetterboxedAnimation) {
mNeedsLetterboxedAnimation = false;
- updateLetterboxSurface(findMainWindow(), t);
+ updateLetterboxSurfaceIfNeeded(findMainWindow(), t);
}
if (mAnimatingActivityRegistry != null) {
diff --git a/services/core/java/com/android/server/wm/DisplayContent.java b/services/core/java/com/android/server/wm/DisplayContent.java
index e743172..d3acd71 100644
--- a/services/core/java/com/android/server/wm/DisplayContent.java
+++ b/services/core/java/com/android/server/wm/DisplayContent.java
@@ -1127,7 +1127,7 @@
final ActivityRecord activity = w.mActivityRecord;
if (activity != null && activity.isVisibleRequested()) {
- activity.updateLetterboxSurface(w);
+ activity.updateLetterboxSurfaceIfNeeded(w);
final boolean updateAllDrawn = activity.updateDrawnWindowStates(w);
if (updateAllDrawn && !mTmpUpdateAllDrawn.contains(activity)) {
mTmpUpdateAllDrawn.add(activity);
diff --git a/services/core/java/com/android/server/wm/LetterboxUiController.java b/services/core/java/com/android/server/wm/LetterboxUiController.java
index edf9da1..5243527 100644
--- a/services/core/java/com/android/server/wm/LetterboxUiController.java
+++ b/services/core/java/com/android/server/wm/LetterboxUiController.java
@@ -924,21 +924,21 @@
return mLetterbox == null || mLetterbox.notIntersectsOrFullyContains(rect);
}
- void updateLetterboxSurface(WindowState winHint) {
- updateLetterboxSurface(winHint, mActivityRecord.getSyncTransaction());
+ void updateLetterboxSurfaceIfNeeded(WindowState winHint) {
+ updateLetterboxSurfaceIfNeeded(winHint, mActivityRecord.getSyncTransaction());
}
- void updateLetterboxSurface(WindowState winHint, Transaction t) {
+ void updateLetterboxSurfaceIfNeeded(WindowState winHint, Transaction t) {
if (shouldNotLayoutLetterbox(winHint)) {
return;
}
- layoutLetterbox(winHint);
+ layoutLetterboxIfNeeded(winHint);
if (mLetterbox != null && mLetterbox.needsApplySurfaceChanges()) {
mLetterbox.applySurfaceChanges(t);
}
}
- void layoutLetterbox(WindowState w) {
+ void layoutLetterboxIfNeeded(WindowState w) {
if (shouldNotLayoutLetterbox(w)) {
return;
}
diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java
index 68dade0..f602dae 100644
--- a/services/core/java/com/android/server/wm/WindowState.java
+++ b/services/core/java/com/android/server/wm/WindowState.java
@@ -1332,7 +1332,7 @@
updateSourceFrame(windowFrames.mFrame);
if (mActivityRecord != null && !mIsChildWindow) {
- mActivityRecord.layoutLetterbox(this);
+ mActivityRecord.layoutLetterboxIfNeeded(this);
}
mSurfacePlacementNeeded = true;
mHaveFrame = true;