Loading core/java/android/service/wallpaper/WallpaperService.java +31 −17 Original line number Diff line number Diff line Loading @@ -184,6 +184,7 @@ public abstract class WallpaperService extends Service { private static final long DIMMING_ANIMATION_DURATION_MS = 300L; @GuardedBy("itself") private final ArrayMap<IBinder, IWallpaperEngineWrapper> mActiveEngines = new ArrayMap<>(); private Handler mBackgroundHandler; Loading Loading @@ -2514,6 +2515,7 @@ public abstract class WallpaperService extends Service { // if they are visible, so we need to toggle the state to get their attention. if (!mEngine.mDestroyed) { mEngine.detach(); synchronized (mActiveEngines) { for (IWallpaperEngineWrapper engineWrapper : mActiveEngines.values()) { if (engineWrapper.mEngine != null && engineWrapper.mEngine.mVisible) { engineWrapper.mEngine.doVisibilityChanged(false); Loading @@ -2522,6 +2524,7 @@ public abstract class WallpaperService extends Service { } } } } public void updateScreenTurningOn(boolean isScreenTurningOn) { Message msg = mCaller.obtainMessageBO(MSG_UPDATE_SCREEN_TURNING_ON, isScreenTurningOn, Loading Loading @@ -2699,7 +2702,9 @@ public abstract class WallpaperService extends Service { IWallpaperEngineWrapper engineWrapper = new IWallpaperEngineWrapper(mTarget, conn, windowToken, windowType, isPreview, reqWidth, reqHeight, padding, displayId, which); synchronized (mActiveEngines) { mActiveEngines.put(windowToken, engineWrapper); } if (DEBUG) { Slog.v(TAG, "IWallpaperServiceWrapper Attaching window token " + windowToken); } Loading @@ -2708,7 +2713,10 @@ public abstract class WallpaperService extends Service { @Override public void detach(IBinder windowToken) { IWallpaperEngineWrapper engineWrapper = mActiveEngines.remove(windowToken); IWallpaperEngineWrapper engineWrapper; synchronized (mActiveEngines) { engineWrapper = mActiveEngines.remove(windowToken); } if (engineWrapper == null) { Log.w(TAG, "Engine for window token " + windowToken + " already detached"); return; Loading @@ -2734,10 +2742,12 @@ public abstract class WallpaperService extends Service { public void onDestroy() { Trace.beginSection("WPMS.onDestroy"); super.onDestroy(); synchronized (mActiveEngines) { for (IWallpaperEngineWrapper engineWrapper : mActiveEngines.values()) { engineWrapper.destroy(); } mActiveEngines.clear(); } if (mBackgroundThread != null) { // onDestroy might be called without a previous onCreate if WallpaperService was // instantiated manually. While this is a misuse of the API, some things break Loading Loading @@ -2768,14 +2778,18 @@ public abstract class WallpaperService extends Service { @Override protected void dump(FileDescriptor fd, PrintWriter out, String[] args) { out.print("State of wallpaper "); out.print(this); out.println(":"); synchronized (mActiveEngines) { for (IWallpaperEngineWrapper engineWrapper : mActiveEngines.values()) { Engine engine = engineWrapper.mEngine; if (engine == null) { Slog.w(TAG, "Engine for wrapper " + engineWrapper + " not attached"); continue; } out.print(" Engine "); out.print(engine); out.println(":"); out.print(" Engine "); out.print(engine); out.println(":"); engine.dump(" ", fd, out, args); } } } } Loading
core/java/android/service/wallpaper/WallpaperService.java +31 −17 Original line number Diff line number Diff line Loading @@ -184,6 +184,7 @@ public abstract class WallpaperService extends Service { private static final long DIMMING_ANIMATION_DURATION_MS = 300L; @GuardedBy("itself") private final ArrayMap<IBinder, IWallpaperEngineWrapper> mActiveEngines = new ArrayMap<>(); private Handler mBackgroundHandler; Loading Loading @@ -2514,6 +2515,7 @@ public abstract class WallpaperService extends Service { // if they are visible, so we need to toggle the state to get their attention. if (!mEngine.mDestroyed) { mEngine.detach(); synchronized (mActiveEngines) { for (IWallpaperEngineWrapper engineWrapper : mActiveEngines.values()) { if (engineWrapper.mEngine != null && engineWrapper.mEngine.mVisible) { engineWrapper.mEngine.doVisibilityChanged(false); Loading @@ -2522,6 +2524,7 @@ public abstract class WallpaperService extends Service { } } } } public void updateScreenTurningOn(boolean isScreenTurningOn) { Message msg = mCaller.obtainMessageBO(MSG_UPDATE_SCREEN_TURNING_ON, isScreenTurningOn, Loading Loading @@ -2699,7 +2702,9 @@ public abstract class WallpaperService extends Service { IWallpaperEngineWrapper engineWrapper = new IWallpaperEngineWrapper(mTarget, conn, windowToken, windowType, isPreview, reqWidth, reqHeight, padding, displayId, which); synchronized (mActiveEngines) { mActiveEngines.put(windowToken, engineWrapper); } if (DEBUG) { Slog.v(TAG, "IWallpaperServiceWrapper Attaching window token " + windowToken); } Loading @@ -2708,7 +2713,10 @@ public abstract class WallpaperService extends Service { @Override public void detach(IBinder windowToken) { IWallpaperEngineWrapper engineWrapper = mActiveEngines.remove(windowToken); IWallpaperEngineWrapper engineWrapper; synchronized (mActiveEngines) { engineWrapper = mActiveEngines.remove(windowToken); } if (engineWrapper == null) { Log.w(TAG, "Engine for window token " + windowToken + " already detached"); return; Loading @@ -2734,10 +2742,12 @@ public abstract class WallpaperService extends Service { public void onDestroy() { Trace.beginSection("WPMS.onDestroy"); super.onDestroy(); synchronized (mActiveEngines) { for (IWallpaperEngineWrapper engineWrapper : mActiveEngines.values()) { engineWrapper.destroy(); } mActiveEngines.clear(); } if (mBackgroundThread != null) { // onDestroy might be called without a previous onCreate if WallpaperService was // instantiated manually. While this is a misuse of the API, some things break Loading Loading @@ -2768,14 +2778,18 @@ public abstract class WallpaperService extends Service { @Override protected void dump(FileDescriptor fd, PrintWriter out, String[] args) { out.print("State of wallpaper "); out.print(this); out.println(":"); synchronized (mActiveEngines) { for (IWallpaperEngineWrapper engineWrapper : mActiveEngines.values()) { Engine engine = engineWrapper.mEngine; if (engine == null) { Slog.w(TAG, "Engine for wrapper " + engineWrapper + " not attached"); continue; } out.print(" Engine "); out.print(engine); out.println(":"); out.print(" Engine "); out.print(engine); out.println(":"); engine.dump(" ", fd, out, args); } } } }