Loading core/java/android/service/wallpaper/WallpaperService.java +13 −2 Original line number Diff line number Diff line Loading @@ -2183,6 +2183,17 @@ public abstract class WallpaperService extends Service { } } /** * Returns a Looper which messages such as {@link WallpaperService#DO_ATTACH}, * {@link WallpaperService#DO_DETACH} etc. are sent to. * By default, returns the process's main looper. * @hide */ @NonNull public Looper onProvideEngineLooper() { return super.getMainLooper(); } private boolean isValid(RectF area) { if (area == null) return false; boolean valid = area.bottom > area.top && area.left < area.right Loading Loading @@ -2215,12 +2226,12 @@ public abstract class WallpaperService extends Service { Engine mEngine; @SetWallpaperFlags int mWhich; IWallpaperEngineWrapper(WallpaperService context, IWallpaperEngineWrapper(WallpaperService service, IWallpaperConnection conn, IBinder windowToken, int windowType, boolean isPreview, int reqWidth, int reqHeight, Rect padding, int displayId, @SetWallpaperFlags int which) { mWallpaperManager = getSystemService(WallpaperManager.class); mCaller = new HandlerCaller(context, context.getMainLooper(), this, true); mCaller = new HandlerCaller(service, service.onProvideEngineLooper(), this, true); mConnection = conn; mWindowToken = windowToken; mWindowType = windowType; Loading packages/SystemUI/src/com/android/systemui/wallpapers/ImageWallpaper.java +10 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.hardware.display.DisplayManager; import android.hardware.display.DisplayManager.DisplayListener; import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; import android.os.SystemClock; import android.os.Trace; import android.os.UserHandle; Loading Loading @@ -101,6 +102,15 @@ public class ImageWallpaper extends WallpaperService { mMainExecutor = mainExecutor; } @Override public Looper onProvideEngineLooper() { // Receive messages on mWorker thread instead of SystemUI's main handler. // All other wallpapers have their own process, and they can receive messages on their own // main handler without any delay. But since ImageWallpaper lives in SystemUI, performance // of the image wallpaper could be negatively affected when SystemUI's main handler is busy. return mWorker != null ? mWorker.getLooper() : super.onProvideEngineLooper(); } @Override public void onCreate() { super.onCreate(); Loading Loading
core/java/android/service/wallpaper/WallpaperService.java +13 −2 Original line number Diff line number Diff line Loading @@ -2183,6 +2183,17 @@ public abstract class WallpaperService extends Service { } } /** * Returns a Looper which messages such as {@link WallpaperService#DO_ATTACH}, * {@link WallpaperService#DO_DETACH} etc. are sent to. * By default, returns the process's main looper. * @hide */ @NonNull public Looper onProvideEngineLooper() { return super.getMainLooper(); } private boolean isValid(RectF area) { if (area == null) return false; boolean valid = area.bottom > area.top && area.left < area.right Loading Loading @@ -2215,12 +2226,12 @@ public abstract class WallpaperService extends Service { Engine mEngine; @SetWallpaperFlags int mWhich; IWallpaperEngineWrapper(WallpaperService context, IWallpaperEngineWrapper(WallpaperService service, IWallpaperConnection conn, IBinder windowToken, int windowType, boolean isPreview, int reqWidth, int reqHeight, Rect padding, int displayId, @SetWallpaperFlags int which) { mWallpaperManager = getSystemService(WallpaperManager.class); mCaller = new HandlerCaller(context, context.getMainLooper(), this, true); mCaller = new HandlerCaller(service, service.onProvideEngineLooper(), this, true); mConnection = conn; mWindowToken = windowToken; mWindowType = windowType; Loading
packages/SystemUI/src/com/android/systemui/wallpapers/ImageWallpaper.java +10 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.hardware.display.DisplayManager; import android.hardware.display.DisplayManager.DisplayListener; import android.os.Handler; import android.os.HandlerThread; import android.os.Looper; import android.os.SystemClock; import android.os.Trace; import android.os.UserHandle; Loading Loading @@ -101,6 +102,15 @@ public class ImageWallpaper extends WallpaperService { mMainExecutor = mainExecutor; } @Override public Looper onProvideEngineLooper() { // Receive messages on mWorker thread instead of SystemUI's main handler. // All other wallpapers have their own process, and they can receive messages on their own // main handler without any delay. But since ImageWallpaper lives in SystemUI, performance // of the image wallpaper could be negatively affected when SystemUI's main handler is busy. return mWorker != null ? mWorker.getLooper() : super.onProvideEngineLooper(); } @Override public void onCreate() { super.onCreate(); Loading