Merge "Add extra null-checks to WallpaperManagerService." into sc-dev

This commit is contained in:
TreeHugger Robot
2021-04-24 00:47:51 +00:00
committed by Android (Google) Code Review

View File

@@ -2384,17 +2384,19 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
public void notifyWakingUp(int x, int y, @NonNull Bundle extras) {
synchronized (mLock) {
final WallpaperData data = mWallpaperMap.get(mCurrentUserId);
data.connection.forEachDisplayConnector(
displayConnector -> {
if (displayConnector.mEngine != null) {
try {
displayConnector.mEngine.dispatchWallpaperCommand(
WallpaperManager.COMMAND_WAKING_UP, x, y, -1, extras);
} catch (RemoteException e) {
e.printStackTrace();
if (data != null && data.connection != null) {
data.connection.forEachDisplayConnector(
displayConnector -> {
if (displayConnector.mEngine != null) {
try {
displayConnector.mEngine.dispatchWallpaperCommand(
WallpaperManager.COMMAND_WAKING_UP, x, y, -1, extras);
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
});
});
}
}
}
@@ -2404,17 +2406,20 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
public void notifyGoingToSleep(int x, int y, @NonNull Bundle extras) {
synchronized (mLock) {
final WallpaperData data = mWallpaperMap.get(mCurrentUserId);
data.connection.forEachDisplayConnector(
displayConnector -> {
if (displayConnector.mEngine != null) {
try {
displayConnector.mEngine.dispatchWallpaperCommand(
WallpaperManager.COMMAND_GOING_TO_SLEEP, x, y, -1, extras);
} catch (RemoteException e) {
e.printStackTrace();
if (data != null && data.connection != null) {
data.connection.forEachDisplayConnector(
displayConnector -> {
if (displayConnector.mEngine != null) {
try {
displayConnector.mEngine.dispatchWallpaperCommand(
WallpaperManager.COMMAND_GOING_TO_SLEEP, x, y, -1,
extras);
} catch (RemoteException e) {
e.printStackTrace();
}
}
}
});
});
}
}
}