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

Commit 949ffa3d authored by Marco Nelissen's avatar Marco Nelissen Committed by Android Git Automerger
Browse files

am 11cff8cd: Merge change Ie211adae into eclair

Merge commit '11cff8cd' into eclair-mr2

* commit '11cff8cd':
  Add a way for wallpapers to know the delta between virtual screens.
parents 29b1e0b1 11cff8cd
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -25097,6 +25097,21 @@
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
<method name="setWallpaperOffsetSteps"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="xStep" type="float">
</parameter>
<parameter name="yStep" type="float">
</parameter>
</method>
<method name="setWallpaperOffsets"
 return="void"
 abstract="false"
@@ -123675,6 +123690,10 @@
</parameter>
<parameter name="yOffset" type="float">
</parameter>
<parameter name="xOffsetStep" type="float">
</parameter>
<parameter name="yOffsetStep" type="float">
</parameter>
<parameter name="xPixelOffset" type="int">
</parameter>
<parameter name="yPixelOffset" type="int">
+19 −0
Original line number Diff line number Diff line
@@ -25108,6 +25108,21 @@
<exception name="IOException" type="java.io.IOException">
</exception>
</method>
<method name="setWallpaperOffsetSteps"
 return="void"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
<parameter name="xStep" type="float">
</parameter>
<parameter name="yStep" type="float">
</parameter>
</method>
<method name="setWallpaperOffsets"
 return="void"
 abstract="false"
@@ -123762,6 +123777,10 @@
</parameter>
<parameter name="yOffset" type="float">
</parameter>
<parameter name="xOffsetStep" type="float">
</parameter>
<parameter name="yOffsetStep" type="float">
</parameter>
<parameter name="xPixelOffset" type="int">
</parameter>
<parameter name="yPixelOffset" type="int">
+18 −3
Original line number Diff line number Diff line
@@ -53,6 +53,8 @@ import java.io.InputStream;
public class WallpaperManager {
    private static String TAG = "WallpaperManager";
    private static boolean DEBUG = false;
    private float mWallpaperXStep = -1;
    private float mWallpaperYStep = -1;

    /**
     * Launch an activity for the user to pick the current global live
@@ -575,20 +577,33 @@ public class WallpaperManager {
     * @param windowToken The window who these offsets should be associated
     * with, as returned by {@link android.view.View#getWindowToken()
     * View.getWindowToken()}.
     * @param xOffset The offset olong the X dimension, from 0 to 1.
     * @param xOffset The offset along the X dimension, from 0 to 1.
     * @param yOffset The offset along the Y dimension, from 0 to 1.
     */
    public void setWallpaperOffsets(IBinder windowToken, float xOffset, float yOffset) {
        try {
            //Log.v(TAG, "Sending new wallpaper offsets from app...");
            ViewRoot.getWindowSession(mContext.getMainLooper()).setWallpaperPosition(
                    windowToken, xOffset, yOffset);
                    windowToken, xOffset, yOffset, mWallpaperXStep, mWallpaperYStep);
            //Log.v(TAG, "...app returning after sending offsets!");
        } catch (RemoteException e) {
            // Ignore.
        }
    }
    
    /**
     * For applications that use multiple virtual screens showing a wallpaper,
     * specify the step size between virtual screens. For example, if the
     * launcher has 5 virtual screens, it would specify an xStep of 0.5,
     * since the X offset for those screens are 0.0, 0.5 and 1.0
     * @param xStep The X offset delta from one screen to the next one 
     * @param yStep The Y offset delta from one screen to the next one
     */
    public void setWallpaperOffsetSteps(float xStep, float yStep) {
        mWallpaperXStep = xStep;
        mWallpaperYStep = yStep;
    }
    
    /**
     * Send an arbitrary command to the current active wallpaper.
     * 
@@ -627,7 +642,7 @@ public class WallpaperManager {
    public void clearWallpaperOffsets(IBinder windowToken) {
        try {
            ViewRoot.getWindowSession(mContext.getMainLooper()).setWallpaperPosition(
                    windowToken, -1, -1);
                    windowToken, -1, -1, -1, -1);
        } catch (RemoteException e) {
            // Ignore.
        }
+12 −2
Original line number Diff line number Diff line
@@ -134,6 +134,8 @@ public abstract class WallpaperService extends Service {
        boolean mOffsetMessageEnqueued;
        float mPendingXOffset;
        float mPendingYOffset;
        float mPendingXOffsetStep;
        float mPendingYOffsetStep;
        boolean mPendingSync;
        MotionEvent mPendingMove;
        
@@ -227,11 +229,14 @@ public abstract class WallpaperService extends Service {
            }

            @Override
            public void dispatchWallpaperOffsets(float x, float y, boolean sync) {
            public void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep,
                    boolean sync) {
                synchronized (mLock) {
                    if (DEBUG) Log.v(TAG, "Dispatch wallpaper offsets: " + x + ", " + y);
                    mPendingXOffset = x;
                    mPendingYOffset = y;
                    mPendingXOffsetStep = xStep;
                    mPendingYOffsetStep = yStep;
                    if (sync) {
                        mPendingSync = true;
                    }
@@ -360,6 +365,7 @@ public abstract class WallpaperService extends Service {
         * WallpaperManager.setWallpaperOffsets()}.
         */
        public void onOffsetsChanged(float xOffset, float yOffset,
                float xOffsetStep, float yOffsetStep,
                int xPixelOffset, int yPixelOffset) {
        }
        
@@ -608,10 +614,14 @@ public abstract class WallpaperService extends Service {
            
            float xOffset;
            float yOffset;
            float xOffsetStep;
            float yOffsetStep;
            boolean sync;
            synchronized (mLock) {
                xOffset = mPendingXOffset;
                yOffset = mPendingYOffset;
                xOffsetStep = mPendingXOffsetStep;
                yOffsetStep = mPendingYOffsetStep;
                sync = mPendingSync;
                mPendingSync = false;
                mOffsetMessageEnqueued = false;
@@ -622,7 +632,7 @@ public abstract class WallpaperService extends Service {
            final int xPixels = availw > 0 ? -(int)(availw*xOffset+.5f) : 0;
            final int availh = mIWallpaperEngine.mReqHeight-mCurHeight;
            final int yPixels = availh > 0 ? -(int)(availh*yOffset+.5f) : 0;
            onOffsetsChanged(xOffset, yOffset, xPixels, yPixels);
            onOffsetsChanged(xOffset, yOffset, xOffsetStep, yOffsetStep, xPixels, yPixels);
            
            if (sync) {
                try {
+1 −1
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ oneway interface IWindow {
    /**
     * Called for wallpaper windows when their offsets change.
     */
    void dispatchWallpaperOffsets(float x, float y, boolean sync);
    void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, boolean sync);
    
    void dispatchWallpaperCommand(String action, int x, int y,
            int z, in Bundle extras, boolean sync);
Loading