summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chris Poultney <poultney@google.com> 2024-09-06 17:09:57 -0400
committer Chris Poultney <poultney@google.com> 2024-09-06 17:09:57 -0400
commit87ca2ade920b568c04b38605bcc01e53ced5778b (patch)
tree3468bc13501141568bd3c618e43acadbdb9653c3
parenta27cfdebd2ea51607f3d466ca1f2d55d03398f45 (diff)
Clarify semantics of changingToSame function
WallpaperManagerService#changingToSame takes both the "new" wallpaper component and the "new" WallpaperData to decide if the new live wallpaper is the same as the old. But it only used two fields from WallpaperData, both of which still referred to the current wallpaper. This change makes the "new" versus "current" semantics clear. Bug: 347235611 Test: switching live wallpapers works as expected Flag: EXEMPT cleanup Change-Id: Ifb9198337a3dfade196d0e18423c2050433bebb4
-rw-r--r--services/core/java/com/android/server/wallpaper/WallpaperManagerService.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
index f53dda6ee35b..4dcc6e112ecc 100644
--- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
+++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
@@ -3169,7 +3169,8 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
final WallpaperDestinationChangeHandler
liveSync = new WallpaperDestinationChangeHandler(
newWallpaper);
- boolean same = changingToSame(name, newWallpaper);
+ boolean same = changingToSame(name, newWallpaper.connection,
+ newWallpaper.wallpaperComponent);
/*
* If we have a shared system+lock wallpaper, and we reapply the same wallpaper
@@ -3257,14 +3258,15 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
return name == null || name.equals(mDefaultWallpaperComponent);
}
- private boolean changingToSame(ComponentName componentName, WallpaperData wallpaper) {
- if (wallpaper.connection != null) {
- final ComponentName wallpaperName = wallpaper.wallpaperComponent;
- if (isDefaultComponent(componentName) && isDefaultComponent(wallpaperName)) {
+ private boolean changingToSame(ComponentName newComponentName,
+ WallpaperConnection currentConnection, ComponentName currentComponentName) {
+ if (currentConnection != null) {
+ if (isDefaultComponent(newComponentName) && isDefaultComponent(currentComponentName)) {
if (DEBUG) Slog.v(TAG, "changingToSame: still using default");
// Still using default wallpaper.
return true;
- } else if (wallpaperName != null && wallpaperName.equals(componentName)) {
+ } else if (currentComponentName != null && currentComponentName.equals(
+ newComponentName)) {
// Changing to same wallpaper.
if (DEBUG) Slog.v(TAG, "same wallpaper");
return true;
@@ -3279,7 +3281,8 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
Slog.v(TAG, "bindWallpaperComponentLocked: componentName=" + componentName);
}
// Has the component changed?
- if (!force && changingToSame(componentName, wallpaper)) {
+ if (!force && changingToSame(componentName, wallpaper.connection,
+ wallpaper.wallpaperComponent)) {
try {
if (DEBUG_LIVE) {
Slog.v(TAG, "Changing to the same component, ignoring");