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

Commit b142e378 authored by Les Prock's avatar Les Prock Committed by Steve Kondik
Browse files

add a getter for the x and y offsets of the wallpaper window

Change-Id: I35294bcac664e85cc5d344b50b5c4335a60d3f37
(cherry picked from commit 4849b8f4)
parent 581697fc
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
@@ -1147,6 +1147,28 @@ public class WallpaperManager {
        mWallpaperYStep = yStep;
    }

    /** @hide */
    public int getLastWallpaperX() {
        try {
            return WindowManagerGlobal.getWindowSession().getLastWallpaperX();
        } catch (RemoteException e) {
            // Ignore.
        }

        return -1;
    }

    /** @hide */
    public int getLastWallpaperY() {
        try {
            return WindowManagerGlobal.getWindowSession().getLastWallpaperY();
        } catch (RemoteException e) {
            // Ignore.
        }

        return -1;
    }

    /**
     * Send an arbitrary command to the current active wallpaper.
     * 
+10 −0
Original line number Diff line number Diff line
@@ -209,6 +209,16 @@ interface IWindowManager
    Bitmap screenshotApplications(IBinder appToken, int displayId, int maxWidth,
            int maxHeight, boolean force565);

    /**
     * Get the current x offset for the wallpaper
     */
    int getLastWallpaperX();

    /**
     * Get the current y offset for the wallpaper
     */
    int getLastWallpaperY();

    /**
     * Called by the status bar to notify Views of changes to System UI visiblity.
     */
+11 −1
Original line number Diff line number Diff line
@@ -187,6 +187,16 @@ interface IWindowSession {
    
    void wallpaperOffsetsComplete(IBinder window);

    /**
     * Get the current x offset for the wallpaper
     */
    int getLastWallpaperX();

    /**
     * Get the current y offset for the wallpaper
     */
    int getLastWallpaperY();

    Bundle sendWallpaperCommand(IBinder window, String action, int x, int y,
            int z, in Bundle extras, boolean sync);
    
+28 −0
Original line number Diff line number Diff line
@@ -419,6 +419,34 @@ final class Session extends IWindowSession.Stub
        }
    }

    /**
     * @hide
     */
    public int getLastWallpaperX() {
        synchronized(mService.mWindowMap) {
            long ident = Binder.clearCallingIdentity();
            try {
                return mService.getLastWallpaperX();
            } finally {
                Binder.restoreCallingIdentity(ident);
            }
        }
    }

    /**
     * @hide
     */
    public int getLastWallpaperY() {
        synchronized(mService.mWindowMap) {
            long ident = Binder.clearCallingIdentity();
            try {
                return mService.getLastWallpaperY();
            } finally {
                Binder.restoreCallingIdentity(ident);
            }
        }
    }

    public void wallpaperOffsetsComplete(IBinder window) {
        mService.wallpaperOffsetsComplete(window);
    }
+30 −0
Original line number Diff line number Diff line
@@ -1970,6 +1970,36 @@ public class WindowManagerService extends IWindowManager.Stub
        }
    }

    public int getLastWallpaperX() {
        int curTokenIndex = mWallpaperTokens.size();
        while (curTokenIndex > 0) {
            curTokenIndex--;
            WindowToken token = mWallpaperTokens.get(curTokenIndex);
            int curWallpaperIndex = token.windows.size();
            while (curWallpaperIndex > 0) {
                curWallpaperIndex--;
                WindowState wallpaperWin = token.windows.get(curWallpaperIndex);
                return wallpaperWin.mXOffset;
            }
        }
        return -1;
    }

    public int getLastWallpaperY() {
        int curTokenIndex = mWallpaperTokens.size();
        while (curTokenIndex > 0) {
            curTokenIndex--;
            WindowToken token = mWallpaperTokens.get(curTokenIndex);
            int curWallpaperIndex = token.windows.size();
            while (curWallpaperIndex > 0) {
                curWallpaperIndex--;
                WindowState wallpaperWin = token.windows.get(curWallpaperIndex);
                return wallpaperWin.mYOffset;
            }
        }
        return -1;
    }

    boolean updateWallpaperOffsetLocked(WindowState wallpaperWin, int dw, int dh,
            boolean sync) {
        boolean changed = false;