Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -43735,6 +43735,7 @@ package android.service.wallpaper { method public void onSurfaceRedrawNeeded(android.view.SurfaceHolder); method public void onTouchEvent(android.view.MotionEvent); method public void onVisibilityChanged(boolean); method public void onZoomChanged(@FloatRange(from=0.0f, to=1.0f) float); method public void setOffsetNotificationsEnabled(boolean); method public void setTouchEventsEnabled(boolean); } core/java/android/app/IWallpaperManager.aidl +7 −0 Original line number Diff line number Diff line Loading @@ -175,4 +175,11 @@ interface IWallpaperManager { * Called from SystemUI when it shows the AoD UI. */ oneway void setInAmbientMode(boolean inAmbientMode, long animationDuration); /** * Called when the wallpaper needs to zoom out. * The zoom value goes from 0 to 1 (inclusive) where 1 means fully zoomed out, * 0 means fully zoomed in */ oneway void setWallpaperZoomOut(float zoom, String callingPackage, int displayId); } core/java/android/app/WallpaperManager.java +18 −0 Original line number Diff line number Diff line Loading @@ -1847,6 +1847,24 @@ public class WallpaperManager { } } /** * Set the current zoom out level of the wallpaper * @param zoom from 0 to 1 (inclusive) where 1 means fully zoomed out, 0 means fully zoomed in * * @hide */ public void setWallpaperZoomOut(float zoom) { if (zoom < 0 || zoom > 1f) { throw new IllegalArgumentException("zoom must be between 0 and one: " + zoom); } try { sGlobals.mService.setWallpaperZoomOut(zoom, mContext.getOpPackageName(), mContext.getDisplayId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Returns whether wallpapers are supported for the calling user. If this function returns * {@code false}, any attempts to changing the wallpaper will have no effect, Loading core/java/android/service/wallpaper/IWallpaperEngine.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -37,4 +37,5 @@ oneway interface IWallpaperEngine { void requestWallpaperColors(); @UnsupportedAppUsage void destroy(); void setZoomOut(float scale); } core/java/android/service/wallpaper/WallpaperService.java +66 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.service.wallpaper; import android.annotation.FloatRange; import android.annotation.Nullable; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; Loading Loading @@ -122,6 +123,9 @@ public abstract class WallpaperService extends Service { private static final int MSG_WINDOW_MOVED = 10035; private static final int MSG_TOUCH_EVENT = 10040; private static final int MSG_REQUEST_WALLPAPER_COLORS = 10050; private static final int MSG_SCALE = 10100; private static final float MAX_SCALE = 1.15f; private static final int NOTIFY_COLORS_RATE_LIMIT_MS = 1000; Loading Loading @@ -170,6 +174,7 @@ public abstract class WallpaperService extends Service { int mType; int mCurWidth; int mCurHeight; float mZoom = 0f; int mWindowFlags = WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE; int mWindowPrivateFlags = WindowManager.LayoutParams.PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS; Loading Loading @@ -495,6 +500,15 @@ public abstract class WallpaperService extends Service { mFixedSizeAllowed = allowed; } /** * Returns the current scale of the surface * @hide */ @VisibleForTesting public float getZoom() { return mZoom; } /** * Called once to initialize the engine. After returning, the * engine's surface will be created by the framework. Loading Loading @@ -622,6 +636,16 @@ public abstract class WallpaperService extends Service { public void onSurfaceDestroyed(SurfaceHolder holder) { } /** * Called when the zoom level of the wallpaper changed. * This method will be called with the initial zoom level when the surface is created. * * @param zoom the zoom level, between 0 indicating fully zoomed in and 1 indicating fully * zoomed out. */ public void onZoomChanged(@FloatRange(from = 0f, to = 1f) float zoom) { } /** * Notifies the engine that wallpaper colors changed significantly. * This will trigger a {@link #onComputeColors()} call. Loading Loading @@ -706,6 +730,7 @@ public abstract class WallpaperService extends Service { out.print(prefix); out.print("mConfiguration="); out.println(mMergedConfiguration.getMergedConfiguration()); out.print(prefix); out.print("mLayout="); out.println(mLayout); out.print(prefix); out.print("mZoom="); out.println(mZoom); synchronized (mLock) { out.print(prefix); out.print("mPendingXOffset="); out.print(mPendingXOffset); out.print(" mPendingXOffset="); out.println(mPendingXOffset); Loading @@ -721,6 +746,37 @@ public abstract class WallpaperService extends Service { } } /** * Set the wallpaper zoom to the given value. This value will be ignored when in ambient * mode (and zoom will be reset to 0). * @hide * @param zoom between 0 and 1 (inclusive) indicating fully zoomed in to fully zoomed out * respectively. */ @VisibleForTesting public void setZoom(float zoom) { if (DEBUG) { Log.v(TAG, "set zoom received: " + zoom); } boolean updated = false; synchronized (mLock) { if (DEBUG) { Log.v(TAG, "mZoom: " + mZoom + " updated: " + zoom); } if (mIsInAmbientMode) { mZoom = 0; } if (Float.compare(zoom, mZoom) != 0) { mZoom = zoom; updated = true; } } if (DEBUG) Log.v(TAG, "setZoom updated? " + updated); if (updated && !mDestroyed) { onZoomChanged(mZoom); } } private void dispatchPointer(MotionEvent event) { if (event.isTouchEvent()) { synchronized (mLock) { Loading Loading @@ -920,6 +976,7 @@ public abstract class WallpaperService extends Service { c.surfaceCreated(mSurfaceHolder); } } onZoomChanged(0f); } redrawNeeded |= creating || (relayoutResult Loading Loading @@ -1080,6 +1137,7 @@ public abstract class WallpaperService extends Service { mIsInAmbientMode = inAmbientMode; if (mCreated) { onAmbientModeChanged(inAmbientMode, animationDuration); setZoom(0); } } } Loading Loading @@ -1354,6 +1412,11 @@ public abstract class WallpaperService extends Service { } } public void setZoomOut(float scale) { Message msg = mCaller.obtainMessageI(MSG_SCALE, Float.floatToIntBits(scale)); mCaller.sendMessage(msg); } public void reportShown() { if (!mShownReported) { mShownReported = true; Loading Loading @@ -1426,6 +1489,9 @@ public abstract class WallpaperService extends Service { case MSG_UPDATE_SURFACE: mEngine.updateSurface(true, false, false); break; case MSG_SCALE: mEngine.setZoom(Float.intBitsToFloat(message.arg1)); break; case MSG_VISIBILITY_CHANGED: if (DEBUG) Log.v(TAG, "Visibility change in " + mEngine + ": " + message.arg1); Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -43735,6 +43735,7 @@ package android.service.wallpaper { method public void onSurfaceRedrawNeeded(android.view.SurfaceHolder); method public void onTouchEvent(android.view.MotionEvent); method public void onVisibilityChanged(boolean); method public void onZoomChanged(@FloatRange(from=0.0f, to=1.0f) float); method public void setOffsetNotificationsEnabled(boolean); method public void setTouchEventsEnabled(boolean); }
core/java/android/app/IWallpaperManager.aidl +7 −0 Original line number Diff line number Diff line Loading @@ -175,4 +175,11 @@ interface IWallpaperManager { * Called from SystemUI when it shows the AoD UI. */ oneway void setInAmbientMode(boolean inAmbientMode, long animationDuration); /** * Called when the wallpaper needs to zoom out. * The zoom value goes from 0 to 1 (inclusive) where 1 means fully zoomed out, * 0 means fully zoomed in */ oneway void setWallpaperZoomOut(float zoom, String callingPackage, int displayId); }
core/java/android/app/WallpaperManager.java +18 −0 Original line number Diff line number Diff line Loading @@ -1847,6 +1847,24 @@ public class WallpaperManager { } } /** * Set the current zoom out level of the wallpaper * @param zoom from 0 to 1 (inclusive) where 1 means fully zoomed out, 0 means fully zoomed in * * @hide */ public void setWallpaperZoomOut(float zoom) { if (zoom < 0 || zoom > 1f) { throw new IllegalArgumentException("zoom must be between 0 and one: " + zoom); } try { sGlobals.mService.setWallpaperZoomOut(zoom, mContext.getOpPackageName(), mContext.getDisplayId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Returns whether wallpapers are supported for the calling user. If this function returns * {@code false}, any attempts to changing the wallpaper will have no effect, Loading
core/java/android/service/wallpaper/IWallpaperEngine.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -37,4 +37,5 @@ oneway interface IWallpaperEngine { void requestWallpaperColors(); @UnsupportedAppUsage void destroy(); void setZoomOut(float scale); }
core/java/android/service/wallpaper/WallpaperService.java +66 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package android.service.wallpaper; import android.annotation.FloatRange; import android.annotation.Nullable; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; Loading Loading @@ -122,6 +123,9 @@ public abstract class WallpaperService extends Service { private static final int MSG_WINDOW_MOVED = 10035; private static final int MSG_TOUCH_EVENT = 10040; private static final int MSG_REQUEST_WALLPAPER_COLORS = 10050; private static final int MSG_SCALE = 10100; private static final float MAX_SCALE = 1.15f; private static final int NOTIFY_COLORS_RATE_LIMIT_MS = 1000; Loading Loading @@ -170,6 +174,7 @@ public abstract class WallpaperService extends Service { int mType; int mCurWidth; int mCurHeight; float mZoom = 0f; int mWindowFlags = WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE; int mWindowPrivateFlags = WindowManager.LayoutParams.PRIVATE_FLAG_WANTS_OFFSET_NOTIFICATIONS; Loading Loading @@ -495,6 +500,15 @@ public abstract class WallpaperService extends Service { mFixedSizeAllowed = allowed; } /** * Returns the current scale of the surface * @hide */ @VisibleForTesting public float getZoom() { return mZoom; } /** * Called once to initialize the engine. After returning, the * engine's surface will be created by the framework. Loading Loading @@ -622,6 +636,16 @@ public abstract class WallpaperService extends Service { public void onSurfaceDestroyed(SurfaceHolder holder) { } /** * Called when the zoom level of the wallpaper changed. * This method will be called with the initial zoom level when the surface is created. * * @param zoom the zoom level, between 0 indicating fully zoomed in and 1 indicating fully * zoomed out. */ public void onZoomChanged(@FloatRange(from = 0f, to = 1f) float zoom) { } /** * Notifies the engine that wallpaper colors changed significantly. * This will trigger a {@link #onComputeColors()} call. Loading Loading @@ -706,6 +730,7 @@ public abstract class WallpaperService extends Service { out.print(prefix); out.print("mConfiguration="); out.println(mMergedConfiguration.getMergedConfiguration()); out.print(prefix); out.print("mLayout="); out.println(mLayout); out.print(prefix); out.print("mZoom="); out.println(mZoom); synchronized (mLock) { out.print(prefix); out.print("mPendingXOffset="); out.print(mPendingXOffset); out.print(" mPendingXOffset="); out.println(mPendingXOffset); Loading @@ -721,6 +746,37 @@ public abstract class WallpaperService extends Service { } } /** * Set the wallpaper zoom to the given value. This value will be ignored when in ambient * mode (and zoom will be reset to 0). * @hide * @param zoom between 0 and 1 (inclusive) indicating fully zoomed in to fully zoomed out * respectively. */ @VisibleForTesting public void setZoom(float zoom) { if (DEBUG) { Log.v(TAG, "set zoom received: " + zoom); } boolean updated = false; synchronized (mLock) { if (DEBUG) { Log.v(TAG, "mZoom: " + mZoom + " updated: " + zoom); } if (mIsInAmbientMode) { mZoom = 0; } if (Float.compare(zoom, mZoom) != 0) { mZoom = zoom; updated = true; } } if (DEBUG) Log.v(TAG, "setZoom updated? " + updated); if (updated && !mDestroyed) { onZoomChanged(mZoom); } } private void dispatchPointer(MotionEvent event) { if (event.isTouchEvent()) { synchronized (mLock) { Loading Loading @@ -920,6 +976,7 @@ public abstract class WallpaperService extends Service { c.surfaceCreated(mSurfaceHolder); } } onZoomChanged(0f); } redrawNeeded |= creating || (relayoutResult Loading Loading @@ -1080,6 +1137,7 @@ public abstract class WallpaperService extends Service { mIsInAmbientMode = inAmbientMode; if (mCreated) { onAmbientModeChanged(inAmbientMode, animationDuration); setZoom(0); } } } Loading Loading @@ -1354,6 +1412,11 @@ public abstract class WallpaperService extends Service { } } public void setZoomOut(float scale) { Message msg = mCaller.obtainMessageI(MSG_SCALE, Float.floatToIntBits(scale)); mCaller.sendMessage(msg); } public void reportShown() { if (!mShownReported) { mShownReported = true; Loading Loading @@ -1426,6 +1489,9 @@ public abstract class WallpaperService extends Service { case MSG_UPDATE_SURFACE: mEngine.updateSurface(true, false, false); break; case MSG_SCALE: mEngine.setZoom(Float.intBitsToFloat(message.arg1)); break; case MSG_VISIBILITY_CHANGED: if (DEBUG) Log.v(TAG, "Visibility change in " + mEngine + ": " + message.arg1); Loading