summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Aurélien Pomini <pomini@google.com> 2023-08-23 15:47:19 +0000
committer Aurélien Pomini <pomini@google.com> 2023-08-23 16:55:34 +0000
commit6cc96efa2d2fbca4106d6dca600c1f5fe49d20cd (patch)
tree9d2b1bed5e9c750cd376c5de1f95634b5875092c
parent394d069401ec76f999a335c3a878f6926607a652 (diff)
Properly send the reply in clearWallpaperComponentLocked
This fixes an error in ag/24482229, causing the callback not to be sent in the case a clear is triggered because the wallpaper package does not exist on the device anymore. Bug: 273443374 Test: atest WallpaperManagerTest Change-Id: Iafba8ac7dfbc2d85f45118a6ac4ff75b64bb5b85
-rw-r--r--services/core/java/com/android/server/wallpaper/WallpaperManagerService.java17
1 files changed, 9 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
index aaf48fbc01f1..598c1aea6d00 100644
--- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
+++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
@@ -2092,8 +2092,8 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
finalWhich = which;
}
- boolean success = withCleanCallingIdentity(() -> setWallpaperComponent(
- component, callingPackage, finalWhich, userId));
+ boolean success = withCleanCallingIdentity(() -> setWallpaperComponentInternal(
+ component, callingPackage, finalWhich, userId, reply));
if (success) return;
} catch (IllegalArgumentException e1) {
e = e1;
@@ -2105,6 +2105,13 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
// wallpaper.
Slog.e(TAG, "Default wallpaper component not found!", e);
withCleanCallingIdentity(() -> clearWallpaperComponentLocked(wallpaper));
+ if (reply != null) {
+ try {
+ reply.sendResult(null);
+ } catch (RemoteException e1) {
+ Slog.w(TAG, "Failed to notify callback after wallpaper clear", e1);
+ }
+ }
}
private void clearWallpaperLocked(int which, int userId, IRemoteCallback reply) {
@@ -3293,12 +3300,6 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
}
}
- private boolean setWallpaperComponent(ComponentName name, @SetWallpaperFlags int which,
- int userId) {
- String callingPackage = mPackageManagerInternal.getNameForUid(getCallingUid());
- return setWallpaperComponentInternal(name, callingPackage, which, userId, null);
- }
-
private boolean setWallpaperComponentInternal(ComponentName name, String callingPackage,
@SetWallpaperFlags int which, int userIdIn, IRemoteCallback reply) {
if (DEBUG) {