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

Commit 36e0e6f6 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove synchronous wallpaper callbacks" into main

parents 1d2161d3 ecabbd58
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3354,7 +3354,7 @@ public class WallpaperManager {
        try {
            //Log.v(TAG, "Sending new wallpaper offsets from app...");
            WindowManagerGlobal.getWindowSession().sendWallpaperCommand(
                    windowToken, action, x, y, z, extras, false);
                    windowToken, action, x, y, z, extras);
            //Log.v(TAG, "...app returning after sending offsets!");
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
+4 −29
Original line number Diff line number Diff line
@@ -244,7 +244,6 @@ public abstract class WallpaperService extends Service {
        int y;
        int z;
        Bundle extras;
        boolean sync;
    }

    /**
@@ -367,7 +366,6 @@ public abstract class WallpaperService extends Service {
        private Bitmap mLastScreenshot;
        private boolean mResetWindowPages;

        boolean mPendingSync;
        MotionEvent mPendingMove;
        boolean mIsInAmbientMode;

@@ -536,16 +534,13 @@ public abstract class WallpaperService extends Service {

            @Override
            public void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep,
                    float zoom, boolean sync) {
                    float zoom) {
                synchronized (mLock) {
                    if (DEBUG) Log.v(TAG, "Dispatch wallpaper offsets: " + x + ", " + y);
                    mPendingXOffset = x;
                    mPendingYOffset = y;
                    mPendingXOffsetStep = xStep;
                    mPendingYOffsetStep = yStep;
                    if (sync) {
                        mPendingSync = true;
                    }
                    if (!mOffsetMessageEnqueued) {
                        mOffsetMessageEnqueued = true;
                        Message msg = mCaller.obtainMessage(MSG_WALLPAPER_OFFSETS);
@@ -558,7 +553,7 @@ public abstract class WallpaperService extends Service {

            @Override
            public void dispatchWallpaperCommand(String action, int x, int y,
                    int z, Bundle extras, boolean sync) {
                    int z, Bundle extras) {
                synchronized (mLock) {
                    if (DEBUG) Log.v(TAG, "Dispatch wallpaper command: " + x + ", " + y);
                    WallpaperCommand cmd = new WallpaperCommand();
@@ -567,7 +562,6 @@ public abstract class WallpaperService extends Service {
                    cmd.y = y;
                    cmd.z = z;
                    cmd.extras = extras;
                    cmd.sync = sync;
                    Message msg = mCaller.obtainMessage(MSG_WALLPAPER_COMMAND);
                    msg.obj = cmd;
                    mCaller.sendMessage(msg);
@@ -1183,7 +1177,6 @@ public abstract class WallpaperService extends Service {
                        out.print(" mPendingXOffsetStep="); out.println(mPendingXOffsetStep);
                out.print(prefix); out.print("mOffsetMessageEnqueued=");
                        out.print(mOffsetMessageEnqueued);
                        out.print(" mPendingSync="); out.println(mPendingSync);
                if (mPendingMove != null) {
                    out.print(prefix); out.print("mPendingMove="); out.println(mPendingMove);
                }
@@ -1827,14 +1820,11 @@ public abstract class WallpaperService extends Service {
            float yOffset;
            float xOffsetStep;
            float yOffsetStep;
            boolean sync;
            synchronized (mLock) {
                xOffset = mPendingXOffset;
                yOffset = mPendingYOffset;
                xOffsetStep = mPendingXOffsetStep;
                yOffsetStep = mPendingYOffsetStep;
                sync = mPendingSync;
                mPendingSync = false;
                mOffsetMessageEnqueued = false;
            }

@@ -1852,14 +1842,6 @@ public abstract class WallpaperService extends Service {
                }
            }

            if (sync) {
                try {
                    if (DEBUG) Log.v(TAG, "Reporting offsets change complete");
                    mSession.wallpaperOffsetsComplete(mWindow.asBinder());
                } catch (RemoteException e) {
                }
            }

            // setup local color extraction data
            processLocalColors();
        }
@@ -2218,17 +2200,10 @@ public abstract class WallpaperService extends Service {
                    updateFrozenState(/* frozenRequested= */ !COMMAND_UNFREEZE.equals(cmd.action));
                }
                result = onCommand(cmd.action, cmd.x, cmd.y, cmd.z,
                        cmd.extras, cmd.sync);
                        cmd.extras, false);
            } else {
                result = null;
            }
            if (cmd.sync) {
                try {
                    if (DEBUG) Log.v(TAG, "Reporting command complete");
                    mSession.wallpaperCommandComplete(mWindow.asBinder(), result);
                } catch (RemoteException e) {
                }
            }
        }

        private void updateFrozenState(boolean frozenRequested) {
@@ -2634,7 +2609,7 @@ public abstract class WallpaperService extends Service {
        public void dispatchWallpaperCommand(String action, int x, int y,
                int z, Bundle extras) {
            if (mEngine != null) {
                mEngine.mWindow.dispatchWallpaperCommand(action, x, y, z, extras, false);
                mEngine.mWindow.dispatchWallpaperCommand(action, x, y, z, extras);
            }
        }

+13 −11
Original line number Diff line number Diff line
@@ -91,10 +91,12 @@ oneway interface IWindow {
    /**
     * Called for wallpaper windows when their offsets or zoom level change.
     */
    void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, float zoom, boolean sync);
    void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, float zoom);

    void dispatchWallpaperCommand(String action, int x, int y,
            int z, in Bundle extras, boolean sync);
    /**
     * Called for wallpaper windows when a visible app sends an arbitrary wallpaper command.
     */
    void dispatchWallpaperCommand(String action, int x, int y, int z, in Bundle extras);

    /**
     * Drag/drop events
+1 −7
Original line number Diff line number Diff line
@@ -208,19 +208,13 @@ interface IWindowSession {
     */
    oneway void setShouldZoomOutWallpaper(IBinder windowToken, boolean shouldZoom);

    @UnsupportedAppUsage
    oneway void wallpaperOffsetsComplete(IBinder window);

    /**
     * Apply a raw offset to the wallpaper service when shown behind this window.
     */
    oneway void setWallpaperDisplayOffset(IBinder windowToken, int x, int y);

    oneway void sendWallpaperCommand(IBinder window, String action, int x, int y,
            int z, in Bundle extras, boolean sync);

    @UnsupportedAppUsage
    oneway void wallpaperCommandComplete(IBinder window, in Bundle result);
            int z, in Bundle extras);

    /**
     * Notifies that a rectangle on the screen has been requested.
+2 −15
Original line number Diff line number Diff line
@@ -11964,24 +11964,11 @@ public final class ViewRootImpl implements ViewParent,
        @Override
        public void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep,
                float zoom, boolean sync) {
            if (sync) {
                try {
                    mWindowSession.wallpaperOffsetsComplete(asBinder());
                } catch (RemoteException e) {
                }
            }
                float zoom) {
        }
        @Override
        public void dispatchWallpaperCommand(String action, int x, int y,
                int z, Bundle extras, boolean sync) {
            if (sync) {
                try {
                    mWindowSession.wallpaperCommandComplete(asBinder(), null);
                } catch (RemoteException e) {
                }
            }
        public void dispatchWallpaperCommand(String action, int x, int y, int z, Bundle extras) {
        }
        /* Drag/drop */
Loading