Merge change Ie211adae into eclair
* changes: Add a way for wallpapers to know the delta between virtual screens.
This commit is contained in:
19
api/6.xml
19
api/6.xml
@ -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">
|
||||
|
@ -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">
|
||||
|
@ -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.
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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);
|
||||
|
@ -113,8 +113,10 @@ interface IWindowSession {
|
||||
/**
|
||||
* For windows with the wallpaper behind them, and the wallpaper is
|
||||
* larger than the screen, set the offset within the screen.
|
||||
* For multi screen launcher type applications, xstep and ystep indicate
|
||||
* how big the increment is from one screen to another.
|
||||
*/
|
||||
void setWallpaperPosition(IBinder windowToken, float x, float y);
|
||||
void setWallpaperPosition(IBinder windowToken, float x, float y, float xstep, float ystep);
|
||||
|
||||
void wallpaperOffsetsComplete(IBinder window);
|
||||
|
||||
|
@ -2895,7 +2895,8 @@ public final class ViewRoot extends Handler implements ViewParent,
|
||||
}
|
||||
}
|
||||
|
||||
public void dispatchWallpaperOffsets(float x, float y, boolean sync) {
|
||||
public void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep,
|
||||
boolean sync) {
|
||||
if (sync) {
|
||||
try {
|
||||
sWindowSession.wallpaperOffsetsComplete(asBinder());
|
||||
|
@ -102,6 +102,7 @@ public class ImageWallpaper extends WallpaperService {
|
||||
|
||||
@Override
|
||||
public void onOffsetsChanged(float xOffset, float yOffset,
|
||||
float xOffsetStep, float yOffsetStep,
|
||||
int xPixels, int yPixels) {
|
||||
mXOffset = xOffset;
|
||||
mYOffset = yOffset;
|
||||
|
@ -94,7 +94,7 @@ public class BaseIWindow extends IWindow.Stub {
|
||||
public void closeSystemDialogs(String reason) {
|
||||
}
|
||||
|
||||
public void dispatchWallpaperOffsets(float x, float y, boolean sync) {
|
||||
public void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, boolean sync) {
|
||||
if (sync) {
|
||||
try {
|
||||
mSession.wallpaperOffsetsComplete(asBinder());
|
||||
|
@ -433,6 +433,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
int mWallpaperAnimLayerAdjustment;
|
||||
float mLastWallpaperX = -1;
|
||||
float mLastWallpaperY = -1;
|
||||
float mLastWallpaperXStep = -1;
|
||||
float mLastWallpaperYStep = -1;
|
||||
// This is set when we are waiting for a wallpaper to tell us it is done
|
||||
// changing its scroll position.
|
||||
WindowState mWaitingOnWallpaper;
|
||||
@ -1465,9 +1467,11 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
if (visible) {
|
||||
if (mWallpaperTarget.mWallpaperX >= 0) {
|
||||
mLastWallpaperX = mWallpaperTarget.mWallpaperX;
|
||||
mLastWallpaperXStep = mWallpaperTarget.mWallpaperXStep;
|
||||
}
|
||||
if (mWallpaperTarget.mWallpaperY >= 0) {
|
||||
mLastWallpaperY = mWallpaperTarget.mWallpaperY;
|
||||
mLastWallpaperYStep = mWallpaperTarget.mWallpaperYStep;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1570,6 +1574,7 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
boolean changed = false;
|
||||
boolean rawChanged = false;
|
||||
float wpx = mLastWallpaperX >= 0 ? mLastWallpaperX : 0.5f;
|
||||
float wpxs = mLastWallpaperXStep >= 0 ? mLastWallpaperXStep : -1.0f;
|
||||
int availw = wallpaperWin.mFrame.right-wallpaperWin.mFrame.left-dw;
|
||||
int offset = availw > 0 ? -(int)(availw*wpx+.5f) : 0;
|
||||
changed = wallpaperWin.mXOffset != offset;
|
||||
@ -1578,12 +1583,14 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
+ wallpaperWin + " x: " + offset);
|
||||
wallpaperWin.mXOffset = offset;
|
||||
}
|
||||
if (wallpaperWin.mWallpaperX != wpx) {
|
||||
if (wallpaperWin.mWallpaperX != wpx || wallpaperWin.mWallpaperXStep != wpxs) {
|
||||
wallpaperWin.mWallpaperX = wpx;
|
||||
wallpaperWin.mWallpaperXStep = wpxs;
|
||||
rawChanged = true;
|
||||
}
|
||||
|
||||
float wpy = mLastWallpaperY >= 0 ? mLastWallpaperY : 0.5f;
|
||||
float wpys = mLastWallpaperYStep >= 0 ? mLastWallpaperYStep : -1.0f;
|
||||
int availh = wallpaperWin.mFrame.bottom-wallpaperWin.mFrame.top-dh;
|
||||
offset = availh > 0 ? -(int)(availh*wpy+.5f) : 0;
|
||||
if (wallpaperWin.mYOffset != offset) {
|
||||
@ -1592,8 +1599,9 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
changed = true;
|
||||
wallpaperWin.mYOffset = offset;
|
||||
}
|
||||
if (wallpaperWin.mWallpaperY != wpy) {
|
||||
if (wallpaperWin.mWallpaperY != wpy || wallpaperWin.mWallpaperYStep != wpys) {
|
||||
wallpaperWin.mWallpaperY = wpy;
|
||||
wallpaperWin.mWallpaperYStep = wpys;
|
||||
rawChanged = true;
|
||||
}
|
||||
|
||||
@ -1606,7 +1614,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
mWaitingOnWallpaper = wallpaperWin;
|
||||
}
|
||||
wallpaperWin.mClient.dispatchWallpaperOffsets(
|
||||
wallpaperWin.mWallpaperX, wallpaperWin.mWallpaperY, sync);
|
||||
wallpaperWin.mWallpaperX, wallpaperWin.mWallpaperY,
|
||||
wallpaperWin.mWallpaperXStep, wallpaperWin.mWallpaperYStep, sync);
|
||||
if (sync) {
|
||||
if (mWaitingOnWallpaper != null) {
|
||||
long start = SystemClock.uptimeMillis();
|
||||
@ -2181,10 +2190,13 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
public void setWindowWallpaperPositionLocked(WindowState window, float x, float y) {
|
||||
public void setWindowWallpaperPositionLocked(WindowState window, float x, float y,
|
||||
float xStep, float yStep) {
|
||||
if (window.mWallpaperX != x || window.mWallpaperY != y) {
|
||||
window.mWallpaperX = x;
|
||||
window.mWallpaperY = y;
|
||||
window.mWallpaperXStep = xStep;
|
||||
window.mWallpaperYStep = yStep;
|
||||
if (updateWallpaperOffsetLocked(window, true)) {
|
||||
performLayoutAndPlaceSurfacesLocked();
|
||||
}
|
||||
@ -6585,12 +6597,12 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
}
|
||||
}
|
||||
|
||||
public void setWallpaperPosition(IBinder window, float x, float y) {
|
||||
public void setWallpaperPosition(IBinder window, float x, float y, float xStep, float yStep) {
|
||||
synchronized(mWindowMap) {
|
||||
long ident = Binder.clearCallingIdentity();
|
||||
try {
|
||||
setWindowWallpaperPositionLocked(windowForClientLocked(this, window),
|
||||
x, y);
|
||||
x, y, xStep, yStep);
|
||||
} finally {
|
||||
Binder.restoreCallingIdentity(ident);
|
||||
}
|
||||
@ -6804,7 +6816,12 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
// wallpaper; if a wallpaper window: the currently applied offset.
|
||||
float mWallpaperX = -1;
|
||||
float mWallpaperY = -1;
|
||||
|
||||
|
||||
// If a window showing a wallpaper: what fraction of the offset
|
||||
// range corresponds to a full virtual screen.
|
||||
float mWallpaperXStep = -1;
|
||||
float mWallpaperYStep = -1;
|
||||
|
||||
// Wallpaper windows: pixels offset based on above variables.
|
||||
int mXOffset;
|
||||
int mYOffset;
|
||||
@ -8037,6 +8054,10 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
pw.print(prefix); pw.print("mWallpaperX="); pw.print(mWallpaperX);
|
||||
pw.print(" mWallpaperY="); pw.println(mWallpaperY);
|
||||
}
|
||||
if (mWallpaperXStep != -1 || mWallpaperYStep != -1) {
|
||||
pw.print(prefix); pw.print("mWallpaperXStep="); pw.print(mWallpaperXStep);
|
||||
pw.print(" mWallpaperYStep="); pw.println(mWallpaperYStep);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1060,7 +1060,8 @@ public final class Bridge implements ILayoutBridge {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void setWallpaperPosition(IBinder window, float x, float y) {
|
||||
public void setWallpaperPosition(IBinder window, float x, float y,
|
||||
float xStep, float yStep) {
|
||||
// pass for now.
|
||||
}
|
||||
|
||||
@ -1140,7 +1141,8 @@ public final class Bridge implements ILayoutBridge {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public void dispatchWallpaperOffsets(float x, float y, boolean sync) {
|
||||
public void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep,
|
||||
boolean sync) {
|
||||
// pass for now.
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user