Ignore wallpaper relaunch timeout during shutdown
am: 762dfd1566
Change-Id: I824dd66b4a9d30c010112038156146750275cb89
This commit is contained in:
@@ -480,6 +480,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
|
|||||||
WallpaperData mLastWallpaper;
|
WallpaperData mLastWallpaper;
|
||||||
IWallpaperManagerCallback mKeyguardListener;
|
IWallpaperManagerCallback mKeyguardListener;
|
||||||
boolean mWaitingForUnlock;
|
boolean mWaitingForUnlock;
|
||||||
|
boolean mShuttingDown;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ID of the current wallpaper, changed every time anything sets a wallpaper.
|
* ID of the current wallpaper, changed every time anything sets a wallpaper.
|
||||||
@@ -607,6 +608,14 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
|
|||||||
|
|
||||||
private Runnable mResetRunnable = () -> {
|
private Runnable mResetRunnable = () -> {
|
||||||
synchronized (mLock) {
|
synchronized (mLock) {
|
||||||
|
if (mShuttingDown) {
|
||||||
|
// Don't expect wallpaper services to relaunch during shutdown
|
||||||
|
if (DEBUG) {
|
||||||
|
Slog.i(TAG, "Ignoring relaunch timeout during shutdown");
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!mWallpaper.wallpaperUpdating
|
if (!mWallpaper.wallpaperUpdating
|
||||||
&& mWallpaper.userId == mCurrentUserId) {
|
&& mWallpaper.userId == mCurrentUserId) {
|
||||||
Slog.w(TAG, "Wallpaper reconnect timed out, "
|
Slog.w(TAG, "Wallpaper reconnect timed out, "
|
||||||
@@ -867,6 +876,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
|
|||||||
public WallpaperManagerService(Context context) {
|
public WallpaperManagerService(Context context) {
|
||||||
if (DEBUG) Slog.v(TAG, "WallpaperService startup");
|
if (DEBUG) Slog.v(TAG, "WallpaperService startup");
|
||||||
mContext = context;
|
mContext = context;
|
||||||
|
mShuttingDown = false;
|
||||||
mImageWallpaper = ComponentName.unflattenFromString(
|
mImageWallpaper = ComponentName.unflattenFromString(
|
||||||
context.getResources().getString(R.string.image_wallpaper_component));
|
context.getResources().getString(R.string.image_wallpaper_component));
|
||||||
mIWindowManager = IWindowManager.Stub.asInterface(
|
mIWindowManager = IWindowManager.Stub.asInterface(
|
||||||
@@ -931,6 +941,21 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
|
|||||||
}
|
}
|
||||||
}, userFilter);
|
}, userFilter);
|
||||||
|
|
||||||
|
final IntentFilter shutdownFilter = new IntentFilter(Intent.ACTION_SHUTDOWN);
|
||||||
|
mContext.registerReceiver(new BroadcastReceiver() {
|
||||||
|
@Override
|
||||||
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
if (Intent.ACTION_SHUTDOWN.equals(intent.getAction())) {
|
||||||
|
if (DEBUG) {
|
||||||
|
Slog.i(TAG, "Shutting down");
|
||||||
|
}
|
||||||
|
synchronized (mLock) {
|
||||||
|
mShuttingDown = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, shutdownFilter);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ActivityManagerNative.getDefault().registerUserSwitchObserver(
|
ActivityManagerNative.getDefault().registerUserSwitchObserver(
|
||||||
new IUserSwitchObserver.Stub() {
|
new IUserSwitchObserver.Stub() {
|
||||||
|
|||||||
Reference in New Issue
Block a user