Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 888edd6f authored by Lucas Dupin's avatar Lucas Dupin Committed by Android (Google) Code Review
Browse files

Merge "Implement wallpaper zoom hooking it to the shade" into rvc-dev

parents 84b4877d 13f4b8a1
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -175,11 +175,4 @@ 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);
}
+2 −3
Original line number Diff line number Diff line
@@ -1858,13 +1858,12 @@ public class WallpaperManager {
     *
     * @hide
     */
    public void setWallpaperZoomOut(float zoom) {
    public void setWallpaperZoomOut(IBinder windowToken, 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());
            WindowManagerGlobal.getWindowSession().setWallpaperZoomOut(windowToken, zoom);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
+16 −5
Original line number Diff line number Diff line
@@ -124,8 +124,6 @@ public abstract class WallpaperService extends Service {
    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;

    private final ArrayList<Engine> mActiveEngines
@@ -351,7 +349,7 @@ public abstract class WallpaperService extends Service {

            @Override
            public void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep,
                    boolean sync) {
                    float zoom, boolean sync) {
                synchronized (mLock) {
                    if (DEBUG) Log.v(TAG, "Dispatch wallpaper offsets: " + x + ", " + y);
                    mPendingXOffset = x;
@@ -366,6 +364,8 @@ public abstract class WallpaperService extends Service {
                        Message msg = mCaller.obtainMessage(MSG_WALLPAPER_OFFSETS);
                        mCaller.sendMessage(msg);
                    }
                    Message msg = mCaller.obtainMessageI(MSG_SCALE, Float.floatToIntBits(zoom));
                    mCaller.sendMessage(msg);
                }
            }

@@ -461,6 +461,18 @@ public abstract class WallpaperService extends Service {
            return mIsInAmbientMode;
        }

        /**
         * This will be called when the wallpaper is first started. If true is returned, the system
         * will zoom in the wallpaper by default and zoom it out as the user interacts,
         * to create depth. Otherwise, zoom will have to be handled manually
         * in {@link #onZoomChanged(float)}.
         *
         * @hide
         */
        public boolean shouldZoomOutWallpaper() {
            return false;
        }

        /**
         * Control whether this wallpaper will receive raw touch events
         * from the window manager as the user interacts with the window
@@ -870,6 +882,7 @@ public abstract class WallpaperService extends Service {
                            Log.w(TAG, "Failed to add window while updating wallpaper surface.");
                            return;
                        }
                        mSession.setShouldZoomOutWallpaper(mWindow, shouldZoomOutWallpaper());
                        mCreated = true;

                        mInputEventReceiver = new WallpaperInputEventReceiver(
@@ -964,7 +977,6 @@ public abstract class WallpaperService extends Service {
                                    c.surfaceCreated(mSurfaceHolder);
                                }
                            }
                            onZoomChanged(0f);
                        }

                        redrawNeeded |= creating || (relayoutResult
@@ -1125,7 +1137,6 @@ public abstract class WallpaperService extends Service {
                mIsInAmbientMode = inAmbientMode;
                if (mCreated) {
                    onAmbientModeChanged(inAmbientMode, animationDuration);
                    setZoom(0);
                }
            }
        }
+2 −2
Original line number Diff line number Diff line
@@ -102,9 +102,9 @@ oneway interface IWindow {
    void closeSystemDialogs(String reason);

    /**
     * Called for wallpaper windows when their offsets change.
     * Called for wallpaper windows when their offsets or zoom level change.
     */
    void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, boolean sync);
    void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, float zoom, boolean sync);

    void dispatchWallpaperCommand(String action, int x, int y,
            int z, in Bundle extras, boolean sync);
+13 −0
Original line number Diff line number Diff line
@@ -221,6 +221,19 @@ interface IWindowSession {
     */
    void setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep);

    /**
     * For wallpaper windows, sets the scale of the wallpaper based on
     * SystemUI behavior.
     */
    void setWallpaperZoomOut(IBinder windowToken, float scale);

    /**
     * For wallpaper windows, sets whether the wallpaper should actually be
     * scaled when setWallpaperZoomOut is called. If set to false, the WallpaperService will
     * receive the zoom out value but the surface won't be scaled.
     */
    void setShouldZoomOutWallpaper(IBinder windowToken, boolean shouldZoom);

    @UnsupportedAppUsage
    void wallpaperOffsetsComplete(IBinder window);

Loading