Loading api/current.xml +15 −2 Original line number Diff line number Diff line Loading @@ -26818,6 +26818,19 @@ <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="clearWallpaperOffsets" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="windowToken" type="android.os.IBinder"> </parameter> </method> <method name="getDesiredMinimumHeight" return="int" abstract="false" Loading Loading @@ -277743,6 +277756,8 @@ deprecated="not deprecated" visibility="public" > <parameter name="name" type="java.lang.String"> </parameter> </constructor> <constructor name="Timer" type="java.util.Timer" Loading @@ -277763,8 +277778,6 @@ deprecated="not deprecated" visibility="public" > <parameter name="name" type="java.lang.String"> </parameter> </constructor> <method name="cancel" return="void" core/java/android/app/WallpaperManager.java +19 −0 Original line number Diff line number Diff line Loading @@ -334,6 +334,25 @@ public class WallpaperManager { } } /** * Clear the offsets previously associated with this window through * {@link #setWallpaperOffsets(IBinder, float, float)}. This reverts * the window to its default state, where it does not cause the wallpaper * to scroll from whatever its last offsets were. * * @param windowToken The window who these offsets should be associated * with, as returned by {@link android.view.View#getWindowVisibility() * View.getWindowToken()}. */ public void clearWallpaperOffsets(IBinder windowToken) { try { ViewRoot.getWindowSession(mContext.getMainLooper()).setWallpaperPosition( windowToken, -1, -1); } catch (RemoteException e) { // Ignore. } } /** * Remove any currently set wallpaper, reverting to the system's default * wallpaper. On success, the intent {@link Intent#ACTION_WALLPAPER_CHANGED} Loading core/java/android/service/wallpaper/WallpaperService.java +63 −7 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.app.Service; import android.app.WallpaperManager; import android.content.Intent; import android.graphics.Rect; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.RemoteException; Loading @@ -33,6 +32,7 @@ import android.view.Gravity; import android.view.IWindowSession; import android.view.SurfaceHolder; import android.view.View; import android.view.ViewGroup; import android.view.ViewRoot; import android.view.WindowManager; import android.view.WindowManagerImpl; Loading @@ -50,13 +50,14 @@ public abstract class WallpaperService extends Service { "android.service.wallpaper.WallpaperService"; static final String TAG = "WallpaperService"; static final boolean DEBUG = true; static final boolean DEBUG = false; private static final int DO_ATTACH = 10; private static final int DO_DETACH = 20; private static final int MSG_UPDATE_SURFACE = 10000; private static final int MSG_VISIBILITY_CHANGED = 10010; private static final int MSG_WALLPAPER_OFFSETS = 10020; /** * The actual implementation of a wallpaper. A wallpaper service may Loading @@ -83,6 +84,8 @@ public abstract class WallpaperService extends Service { int mHeight; int mFormat; int mType; int mCurWidth; int mCurHeight; boolean mDestroyReportNeeded; final Rect mVisibleInsets = new Rect(); final Rect mWinFrame = new Rect(); Loading @@ -92,6 +95,11 @@ public abstract class WallpaperService extends Service { = new WindowManager.LayoutParams(); IWindowSession mSession; final Object mLock = new Object(); boolean mOffsetMessageEnqueued; float mPendingXOffset; float mPendingYOffset; final BaseSurfaceHolder mSurfaceHolder = new BaseSurfaceHolder() { @Override Loading Loading @@ -127,6 +135,20 @@ public abstract class WallpaperService extends Service { visible ? 1 : 0); mCaller.sendMessage(msg); } @Override public void dispatchWallpaperOffsets(float x, float y) { synchronized (mLock) { mPendingXOffset = x; mPendingYOffset = y; if (!mOffsetMessageEnqueued) { mOffsetMessageEnqueued = true; Message msg = mCaller.obtainMessage(MSG_WALLPAPER_OFFSETS); mCaller.sendMessage(msg); } } } }; /** Loading Loading @@ -177,6 +199,16 @@ public abstract class WallpaperService extends Service { public void onVisibilityChanged(boolean visible) { } /** * Called to inform you of the wallpaper's offsets changing * within its contain, corresponding to the container's * call to {@link WallpaperManager#setWallpaperOffsets(IBinder, float, float) * WallpaperManager.setWallpaperOffsets()}. */ public void onOffsetsChanged(float xOffset, float yOffset, int xPixelOffset, int yPixelOffset) { } /** * Convenience for {@link SurfaceHolder.Callback#surfaceChanged * SurfaceHolder.Callback.surfaceChanged()}. Loading @@ -200,9 +232,9 @@ public abstract class WallpaperService extends Service { void updateSurface(boolean force) { int myWidth = mSurfaceHolder.getRequestedWidth(); if (myWidth <= 0) myWidth = mIWallpaperEngine.mReqWidth; if (myWidth <= 0) myWidth = ViewGroup.LayoutParams.FILL_PARENT; int myHeight = mSurfaceHolder.getRequestedHeight(); if (myHeight <= 0) myHeight = mIWallpaperEngine.mReqHeight; if (myHeight <= 0) myHeight = ViewGroup.LayoutParams.FILL_PARENT; final boolean creating = !mCreated; final boolean formatChanged = mFormat != mSurfaceHolder.getRequestedFormat(); Loading Loading @@ -254,6 +286,9 @@ public abstract class WallpaperService extends Service { if (DEBUG) Log.i(TAG, "New surface: " + mSurfaceHolder.mSurface + ", frame=" + mWinFrame); mCurWidth = mWinFrame.width(); mCurHeight = mWinFrame.height(); mSurfaceHolder.mSurfaceLock.unlock(); try { Loading @@ -278,10 +313,12 @@ public abstract class WallpaperService extends Service { } } if (creating || formatChanged || sizeChanged) { onSurfaceChanged(mSurfaceHolder, mFormat, mWidth, mHeight); onSurfaceChanged(mSurfaceHolder, mFormat, mCurWidth, mCurHeight); if (callbacks != null) { for (SurfaceHolder.Callback c : callbacks) { c.surfaceChanged(mSurfaceHolder, mFormat, mWidth, mHeight); c.surfaceChanged(mSurfaceHolder, mFormat, mCurWidth, mCurHeight); } } } Loading @@ -305,7 +342,10 @@ public abstract class WallpaperService extends Service { mCaller = wrapper.mCaller; mConnection = wrapper.mConnection; mWindowToken = wrapper.mWindowToken; mSurfaceHolder.setSizeFromLayout(); // XXX temp -- should run in size from layout (screen) mode. mSurfaceHolder.setFixedSize(mIWallpaperEngine.mReqWidth, mIWallpaperEngine.mReqHeight); //mSurfaceHolder.setSizeFromLayout(); mInitializing = true; mSession = ViewRoot.getWindowSession(getMainLooper()); mWindow.setSession(mSession); Loading Loading @@ -396,6 +436,22 @@ public abstract class WallpaperService extends Service { + ": " + message.arg1); mEngine.onVisibilityChanged(message.arg1 != 0); break; case MSG_WALLPAPER_OFFSETS: { float xOffset; float yOffset; synchronized (mEngine.mLock) { xOffset = mEngine.mPendingXOffset; yOffset = mEngine.mPendingYOffset; mEngine.mOffsetMessageEnqueued = false; } if (DEBUG) Log.v(TAG, "Offsets change in " + mEngine + ": " + xOffset + "," + yOffset); final int availw = mReqWidth-mEngine.mCurWidth; final int xPixels = availw > 0 ? -(int)(availw*xOffset+.5f) : 0; final int availh = mReqHeight-mEngine.mCurHeight; final int yPixels = availh > 0 ? -(int)(availh*yOffset+.5f) : 0; mEngine.onOffsetsChanged(xOffset, yOffset, xPixels, yPixels); } break; default : Log.w(TAG, "Unknown message type " + message.what); } Loading core/java/android/view/IWindow.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -56,4 +56,9 @@ oneway interface IWindow { * to date on the current state showing navigational focus (touch mode) too. */ void windowFocusChanged(boolean hasFocus, boolean inTouchMode); /** * Called for wallpaper windows when their offsets change. */ void dispatchWallpaperOffsets(float x, float y); } core/java/android/view/SurfaceView.java +3 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.view; import com.android.internal.view.BaseIWindow; import android.content.Context; import android.content.res.Resources; import android.content.res.CompatibilityInfo.Translator; Loading Loading @@ -435,7 +437,7 @@ public class SurfaceView extends View { updateWindow(false); } private static class MyWindow extends IWindow.Stub { private static class MyWindow extends BaseIWindow { private final WeakReference<SurfaceView> mSurfaceView; public MyWindow(SurfaceView surfaceView) { Loading Loading
api/current.xml +15 −2 Original line number Diff line number Diff line Loading @@ -26818,6 +26818,19 @@ <exception name="IOException" type="java.io.IOException"> </exception> </method> <method name="clearWallpaperOffsets" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="windowToken" type="android.os.IBinder"> </parameter> </method> <method name="getDesiredMinimumHeight" return="int" abstract="false" Loading Loading @@ -277743,6 +277756,8 @@ deprecated="not deprecated" visibility="public" > <parameter name="name" type="java.lang.String"> </parameter> </constructor> <constructor name="Timer" type="java.util.Timer" Loading @@ -277763,8 +277778,6 @@ deprecated="not deprecated" visibility="public" > <parameter name="name" type="java.lang.String"> </parameter> </constructor> <method name="cancel" return="void"
core/java/android/app/WallpaperManager.java +19 −0 Original line number Diff line number Diff line Loading @@ -334,6 +334,25 @@ public class WallpaperManager { } } /** * Clear the offsets previously associated with this window through * {@link #setWallpaperOffsets(IBinder, float, float)}. This reverts * the window to its default state, where it does not cause the wallpaper * to scroll from whatever its last offsets were. * * @param windowToken The window who these offsets should be associated * with, as returned by {@link android.view.View#getWindowVisibility() * View.getWindowToken()}. */ public void clearWallpaperOffsets(IBinder windowToken) { try { ViewRoot.getWindowSession(mContext.getMainLooper()).setWallpaperPosition( windowToken, -1, -1); } catch (RemoteException e) { // Ignore. } } /** * Remove any currently set wallpaper, reverting to the system's default * wallpaper. On success, the intent {@link Intent#ACTION_WALLPAPER_CHANGED} Loading
core/java/android/service/wallpaper/WallpaperService.java +63 −7 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.app.Service; import android.app.WallpaperManager; import android.content.Intent; import android.graphics.Rect; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.os.RemoteException; Loading @@ -33,6 +32,7 @@ import android.view.Gravity; import android.view.IWindowSession; import android.view.SurfaceHolder; import android.view.View; import android.view.ViewGroup; import android.view.ViewRoot; import android.view.WindowManager; import android.view.WindowManagerImpl; Loading @@ -50,13 +50,14 @@ public abstract class WallpaperService extends Service { "android.service.wallpaper.WallpaperService"; static final String TAG = "WallpaperService"; static final boolean DEBUG = true; static final boolean DEBUG = false; private static final int DO_ATTACH = 10; private static final int DO_DETACH = 20; private static final int MSG_UPDATE_SURFACE = 10000; private static final int MSG_VISIBILITY_CHANGED = 10010; private static final int MSG_WALLPAPER_OFFSETS = 10020; /** * The actual implementation of a wallpaper. A wallpaper service may Loading @@ -83,6 +84,8 @@ public abstract class WallpaperService extends Service { int mHeight; int mFormat; int mType; int mCurWidth; int mCurHeight; boolean mDestroyReportNeeded; final Rect mVisibleInsets = new Rect(); final Rect mWinFrame = new Rect(); Loading @@ -92,6 +95,11 @@ public abstract class WallpaperService extends Service { = new WindowManager.LayoutParams(); IWindowSession mSession; final Object mLock = new Object(); boolean mOffsetMessageEnqueued; float mPendingXOffset; float mPendingYOffset; final BaseSurfaceHolder mSurfaceHolder = new BaseSurfaceHolder() { @Override Loading Loading @@ -127,6 +135,20 @@ public abstract class WallpaperService extends Service { visible ? 1 : 0); mCaller.sendMessage(msg); } @Override public void dispatchWallpaperOffsets(float x, float y) { synchronized (mLock) { mPendingXOffset = x; mPendingYOffset = y; if (!mOffsetMessageEnqueued) { mOffsetMessageEnqueued = true; Message msg = mCaller.obtainMessage(MSG_WALLPAPER_OFFSETS); mCaller.sendMessage(msg); } } } }; /** Loading Loading @@ -177,6 +199,16 @@ public abstract class WallpaperService extends Service { public void onVisibilityChanged(boolean visible) { } /** * Called to inform you of the wallpaper's offsets changing * within its contain, corresponding to the container's * call to {@link WallpaperManager#setWallpaperOffsets(IBinder, float, float) * WallpaperManager.setWallpaperOffsets()}. */ public void onOffsetsChanged(float xOffset, float yOffset, int xPixelOffset, int yPixelOffset) { } /** * Convenience for {@link SurfaceHolder.Callback#surfaceChanged * SurfaceHolder.Callback.surfaceChanged()}. Loading @@ -200,9 +232,9 @@ public abstract class WallpaperService extends Service { void updateSurface(boolean force) { int myWidth = mSurfaceHolder.getRequestedWidth(); if (myWidth <= 0) myWidth = mIWallpaperEngine.mReqWidth; if (myWidth <= 0) myWidth = ViewGroup.LayoutParams.FILL_PARENT; int myHeight = mSurfaceHolder.getRequestedHeight(); if (myHeight <= 0) myHeight = mIWallpaperEngine.mReqHeight; if (myHeight <= 0) myHeight = ViewGroup.LayoutParams.FILL_PARENT; final boolean creating = !mCreated; final boolean formatChanged = mFormat != mSurfaceHolder.getRequestedFormat(); Loading Loading @@ -254,6 +286,9 @@ public abstract class WallpaperService extends Service { if (DEBUG) Log.i(TAG, "New surface: " + mSurfaceHolder.mSurface + ", frame=" + mWinFrame); mCurWidth = mWinFrame.width(); mCurHeight = mWinFrame.height(); mSurfaceHolder.mSurfaceLock.unlock(); try { Loading @@ -278,10 +313,12 @@ public abstract class WallpaperService extends Service { } } if (creating || formatChanged || sizeChanged) { onSurfaceChanged(mSurfaceHolder, mFormat, mWidth, mHeight); onSurfaceChanged(mSurfaceHolder, mFormat, mCurWidth, mCurHeight); if (callbacks != null) { for (SurfaceHolder.Callback c : callbacks) { c.surfaceChanged(mSurfaceHolder, mFormat, mWidth, mHeight); c.surfaceChanged(mSurfaceHolder, mFormat, mCurWidth, mCurHeight); } } } Loading @@ -305,7 +342,10 @@ public abstract class WallpaperService extends Service { mCaller = wrapper.mCaller; mConnection = wrapper.mConnection; mWindowToken = wrapper.mWindowToken; mSurfaceHolder.setSizeFromLayout(); // XXX temp -- should run in size from layout (screen) mode. mSurfaceHolder.setFixedSize(mIWallpaperEngine.mReqWidth, mIWallpaperEngine.mReqHeight); //mSurfaceHolder.setSizeFromLayout(); mInitializing = true; mSession = ViewRoot.getWindowSession(getMainLooper()); mWindow.setSession(mSession); Loading Loading @@ -396,6 +436,22 @@ public abstract class WallpaperService extends Service { + ": " + message.arg1); mEngine.onVisibilityChanged(message.arg1 != 0); break; case MSG_WALLPAPER_OFFSETS: { float xOffset; float yOffset; synchronized (mEngine.mLock) { xOffset = mEngine.mPendingXOffset; yOffset = mEngine.mPendingYOffset; mEngine.mOffsetMessageEnqueued = false; } if (DEBUG) Log.v(TAG, "Offsets change in " + mEngine + ": " + xOffset + "," + yOffset); final int availw = mReqWidth-mEngine.mCurWidth; final int xPixels = availw > 0 ? -(int)(availw*xOffset+.5f) : 0; final int availh = mReqHeight-mEngine.mCurHeight; final int yPixels = availh > 0 ? -(int)(availh*yOffset+.5f) : 0; mEngine.onOffsetsChanged(xOffset, yOffset, xPixels, yPixels); } break; default : Log.w(TAG, "Unknown message type " + message.what); } Loading
core/java/android/view/IWindow.aidl +5 −0 Original line number Diff line number Diff line Loading @@ -56,4 +56,9 @@ oneway interface IWindow { * to date on the current state showing navigational focus (touch mode) too. */ void windowFocusChanged(boolean hasFocus, boolean inTouchMode); /** * Called for wallpaper windows when their offsets change. */ void dispatchWallpaperOffsets(float x, float y); }
core/java/android/view/SurfaceView.java +3 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.view; import com.android.internal.view.BaseIWindow; import android.content.Context; import android.content.res.Resources; import android.content.res.CompatibilityInfo.Translator; Loading Loading @@ -435,7 +437,7 @@ public class SurfaceView extends View { updateWindow(false); } private static class MyWindow extends IWindow.Stub { private static class MyWindow extends BaseIWindow { private final WeakReference<SurfaceView> mSurfaceView; public MyWindow(SurfaceView surfaceView) { Loading