Fix wallpaper NPE caused by user switching before IWallpaperService connection

- car side is doing quick user switching during boot-up and that leads into
  wallpaper user switching before the service connection.
  user 0 start, user 0 unlock, user switch to user 10, boot complete, user 10 unlock

Bug: 129569939
Test: Try user switching flow in car env and confirm no crash
Change-Id: I764f68377ddf8b581f8386a236aa5c24a96368dd
This commit is contained in:
Keun young Park
2019-03-29 17:42:32 -07:00
parent de11a5ae75
commit e3d2feaa1f

View File

@@ -2671,7 +2671,10 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
wallpaper.connection.mReply = null;
}
try {
wallpaper.connection.mService.detach();
// It can be null if user switching happens before service connection.
if (wallpaper.connection.mService != null) {
wallpaper.connection.mService.detach();
}
} catch (RemoteException e) {
Slog.w(TAG, "Failed detaching wallpaper service ", e);
}