Optimize handling of scrolled wallpapers
Swiping the home screen causes the WindowManagerService to do
a bunch of work to keep the wallpapers in sync. First, it lays out
and places all windows. Also, it notifies the SystemUI process that
the wallpaper position has changed.
The layout/place operation is too much work - we only need to set
the position values for the wallpaper, not relayout the whole system.
The notification mechanism must exist, but should be optional. Most
wallpapers don't care (especially static ImageWallpapers). So we'll
give them a new API (WallpaperService.Engine.setWantsOffsets()) to
allow wallpapers to opt out of this process and avoid the performance
overhead.
Change-Id: I66c38375438937f14f6f5550565b28eb204b1e06
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index e8ab227..e74fec6 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -813,6 +813,17 @@
public static final int PRIVATE_FLAG_FORCE_HARDWARE_ACCELERATED = 0x00000002;
/**
+ * By default, wallpapers are sent new offsets when the wallpaper is scrolled. Wallpapers
+ * may elect to skp these notifications if they are no doing anything productive with
+ * them (they do not affect the wallpaper scrolling operation) by calling
+ * {@link
+ * android.service.wallpaper.WallpaperService.Engine#setOffsetNotificationsEnabled(boolean)}.
+ *
+ * @hide
+ */
+ public static final int PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS = 0x00000004;
+
+ /**
* Control flags that are private to the platform.
* @hide
*/