Loading core/java/android/service/wallpaper/WallpaperService.java +13 −2 Original line number Diff line number Diff line Loading @@ -98,6 +98,7 @@ public abstract class WallpaperService extends Service { private static final int MSG_WALLPAPER_OFFSETS = 10020; private static final int MSG_WALLPAPER_COMMAND = 10025; private static final int MSG_WINDOW_RESIZED = 10030; private static final int MSG_WINDOW_MOVED = 10035; private static final int MSG_TOUCH_EVENT = 10040; private Looper mCallbackLooper; Loading Loading @@ -260,6 +261,12 @@ public abstract class WallpaperService extends Service { mCaller.sendMessage(msg); } @Override public void moved(int newX, int newY) { Message msg = mCaller.obtainMessageII(MSG_WINDOW_MOVED, newX, newY); mCaller.sendMessage(msg); } @Override public void dispatchAppVisibility(boolean visible) { // We don't do this in preview mode; we'll let the preview Loading Loading @@ -291,6 +298,7 @@ public abstract class WallpaperService extends Service { } } @Override public void dispatchWallpaperCommand(String action, int x, int y, int z, Bundle extras, boolean sync) { synchronized (mLock) { Loading Loading @@ -1044,6 +1052,9 @@ public abstract class WallpaperService extends Service { mEngine.updateSurface(true, false, reportDraw); mEngine.doOffsetsChanged(true); } break; case MSG_WINDOW_MOVED: { // Do nothing. What does it mean for a Wallpaper to move? } break; case MSG_TOUCH_EVENT: { boolean skip = false; MotionEvent ev = (MotionEvent)message.obj; Loading core/java/android/view/IWindow.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ oneway interface IWindow { void resized(int w, int h, in Rect contentInsets, in Rect visibleInsets, boolean reportDraw, in Configuration newConfig); void moved(int newX, int newY); void dispatchAppVisibility(boolean visible); void dispatchGetNewSurface(); void dispatchScreenState(boolean on); Loading core/java/android/view/View.java +6 −6 Original line number Diff line number Diff line Loading @@ -4766,9 +4766,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @hide */ public int getActualAndReportedWindowLeftDelta() { if (mAttachInfo != null) { return mAttachInfo.mActualWindowLeft - mAttachInfo.mWindowLeft; } // if (mAttachInfo != null) { // return mAttachInfo.mActualWindowLeft - mAttachInfo.mWindowLeft; // } return 0; } Loading @@ -4778,9 +4778,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @hide */ public int getActualAndReportedWindowTopDelta() { if (mAttachInfo != null) { return mAttachInfo.mActualWindowTop - mAttachInfo.mWindowTop; } // if (mAttachInfo != null) { // return mAttachInfo.mActualWindowTop - mAttachInfo.mWindowTop; // } return 0; } Loading core/java/android/view/ViewRootImpl.java +41 −0 Original line number Diff line number Diff line Loading @@ -2717,6 +2717,7 @@ public final class ViewRootImpl implements ViewParent, private final static int MSG_CLEAR_ACCESSIBILITY_FOCUS_HOST = 22; private final static int MSG_DISPATCH_DONE_ANIMATING = 23; private final static int MSG_INVALIDATE_WORLD = 24; private final static int MSG_WINDOW_MOVED = 25; final class ViewRootHandler extends Handler { @Override Loading Loading @@ -2768,6 +2769,8 @@ public final class ViewRootImpl implements ViewParent, return "MSG_CLEAR_ACCESSIBILITY_FOCUS_HOST"; case MSG_DISPATCH_DONE_ANIMATING: return "MSG_DISPATCH_DONE_ANIMATING"; case MSG_WINDOW_MOVED: return "MSG_WINDOW_MOVED"; } return super.getMessageName(message); } Loading Loading @@ -2812,6 +2815,7 @@ public final class ViewRootImpl implements ViewParent, if (config != null) { updateConfiguration(config, false); } // TODO: Should left/top stay unchanged and only change the right/bottom? mWinFrame.left = 0; mWinFrame.right = msg.arg1; mWinFrame.top = 0; Loading @@ -2828,6 +2832,23 @@ public final class ViewRootImpl implements ViewParent, requestLayout(); } break; case MSG_WINDOW_MOVED: if (mAdded) { final int w = mWinFrame.width(); final int h = mWinFrame.height(); final int l = msg.arg1; final int t = msg.arg2; mWinFrame.left = l; mWinFrame.right = l + w; mWinFrame.top = t; mWinFrame.bottom = t + h; if (mView != null) { forceLayout(mView); } requestLayout(); } break; case MSG_WINDOW_FOCUS_CHANGED: { if (mAdded) { boolean hasWindowFocus = msg.arg1 != 0; Loading Loading @@ -4047,6 +4068,18 @@ public final class ViewRootImpl implements ViewParent, mHandler.sendMessage(msg); } public void dispatchMoved(int newX, int newY) { if (DEBUG_LAYOUT) Log.v(TAG, "Window moved " + this + ": newX=" + newX + " newY=" + newY); if (mTranslator != null) { PointF point = new PointF(newX, newY); mTranslator.translatePointInScreenToAppWindow(point); newX = (int) (point.x + 0.5); newY = (int) (point.y + 0.5); } Message msg = mHandler.obtainMessage(MSG_WINDOW_MOVED, newX, newY); mHandler.sendMessage(msg); } /** * Represents a pending input event that is waiting in a queue. * Loading Loading @@ -4686,6 +4719,14 @@ public final class ViewRootImpl implements ViewParent, } } @Override public void moved(int newX, int newY) { final ViewRootImpl viewAncestor = mViewAncestor.get(); if (viewAncestor != null) { viewAncestor.dispatchMoved(newX, newY); } } public void dispatchAppVisibility(boolean visible) { final ViewRootImpl viewAncestor = mViewAncestor.get(); if (viewAncestor != null) { Loading core/java/com/android/internal/view/BaseIWindow.java +20 −4 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ public class BaseIWindow extends IWindow.Stub { mSession = session; } @Override public void resized(int w, int h, Rect contentInsets, Rect visibleInsets, boolean reportDraw, Configuration newConfig) { if (reportDraw) { Loading @@ -43,24 +44,35 @@ public class BaseIWindow extends IWindow.Stub { } } @Override public void moved(int newX, int newY) { } @Override public void dispatchAppVisibility(boolean visible) { } @Override public void dispatchGetNewSurface() { } @Override public void dispatchScreenState(boolean on) { } @Override public void windowFocusChanged(boolean hasFocus, boolean touchEnabled) { } @Override public void executeCommand(String command, String parameters, ParcelFileDescriptor out) { } @Override public void closeSystemDialogs(String reason) { } @Override public void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, boolean sync) { if (sync) { try { Loading @@ -70,14 +82,17 @@ public class BaseIWindow extends IWindow.Stub { } } @Override public void dispatchDragEvent(DragEvent event) { } @Override public void dispatchSystemUiVisibilityChanged(int seq, int globalUi, int localValue, int localChanges) { mSeq = seq; } @Override public void dispatchWallpaperCommand(String action, int x, int y, int z, Bundle extras, boolean sync) { if (sync) { Loading @@ -88,6 +103,7 @@ public class BaseIWindow extends IWindow.Stub { } } @Override public void doneAnimating() { } } Loading
core/java/android/service/wallpaper/WallpaperService.java +13 −2 Original line number Diff line number Diff line Loading @@ -98,6 +98,7 @@ public abstract class WallpaperService extends Service { private static final int MSG_WALLPAPER_OFFSETS = 10020; private static final int MSG_WALLPAPER_COMMAND = 10025; private static final int MSG_WINDOW_RESIZED = 10030; private static final int MSG_WINDOW_MOVED = 10035; private static final int MSG_TOUCH_EVENT = 10040; private Looper mCallbackLooper; Loading Loading @@ -260,6 +261,12 @@ public abstract class WallpaperService extends Service { mCaller.sendMessage(msg); } @Override public void moved(int newX, int newY) { Message msg = mCaller.obtainMessageII(MSG_WINDOW_MOVED, newX, newY); mCaller.sendMessage(msg); } @Override public void dispatchAppVisibility(boolean visible) { // We don't do this in preview mode; we'll let the preview Loading Loading @@ -291,6 +298,7 @@ public abstract class WallpaperService extends Service { } } @Override public void dispatchWallpaperCommand(String action, int x, int y, int z, Bundle extras, boolean sync) { synchronized (mLock) { Loading Loading @@ -1044,6 +1052,9 @@ public abstract class WallpaperService extends Service { mEngine.updateSurface(true, false, reportDraw); mEngine.doOffsetsChanged(true); } break; case MSG_WINDOW_MOVED: { // Do nothing. What does it mean for a Wallpaper to move? } break; case MSG_TOUCH_EVENT: { boolean skip = false; MotionEvent ev = (MotionEvent)message.obj; Loading
core/java/android/view/IWindow.aidl +1 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,7 @@ oneway interface IWindow { void resized(int w, int h, in Rect contentInsets, in Rect visibleInsets, boolean reportDraw, in Configuration newConfig); void moved(int newX, int newY); void dispatchAppVisibility(boolean visible); void dispatchGetNewSurface(); void dispatchScreenState(boolean on); Loading
core/java/android/view/View.java +6 −6 Original line number Diff line number Diff line Loading @@ -4766,9 +4766,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @hide */ public int getActualAndReportedWindowLeftDelta() { if (mAttachInfo != null) { return mAttachInfo.mActualWindowLeft - mAttachInfo.mWindowLeft; } // if (mAttachInfo != null) { // return mAttachInfo.mActualWindowLeft - mAttachInfo.mWindowLeft; // } return 0; } Loading @@ -4778,9 +4778,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * @hide */ public int getActualAndReportedWindowTopDelta() { if (mAttachInfo != null) { return mAttachInfo.mActualWindowTop - mAttachInfo.mWindowTop; } // if (mAttachInfo != null) { // return mAttachInfo.mActualWindowTop - mAttachInfo.mWindowTop; // } return 0; } Loading
core/java/android/view/ViewRootImpl.java +41 −0 Original line number Diff line number Diff line Loading @@ -2717,6 +2717,7 @@ public final class ViewRootImpl implements ViewParent, private final static int MSG_CLEAR_ACCESSIBILITY_FOCUS_HOST = 22; private final static int MSG_DISPATCH_DONE_ANIMATING = 23; private final static int MSG_INVALIDATE_WORLD = 24; private final static int MSG_WINDOW_MOVED = 25; final class ViewRootHandler extends Handler { @Override Loading Loading @@ -2768,6 +2769,8 @@ public final class ViewRootImpl implements ViewParent, return "MSG_CLEAR_ACCESSIBILITY_FOCUS_HOST"; case MSG_DISPATCH_DONE_ANIMATING: return "MSG_DISPATCH_DONE_ANIMATING"; case MSG_WINDOW_MOVED: return "MSG_WINDOW_MOVED"; } return super.getMessageName(message); } Loading Loading @@ -2812,6 +2815,7 @@ public final class ViewRootImpl implements ViewParent, if (config != null) { updateConfiguration(config, false); } // TODO: Should left/top stay unchanged and only change the right/bottom? mWinFrame.left = 0; mWinFrame.right = msg.arg1; mWinFrame.top = 0; Loading @@ -2828,6 +2832,23 @@ public final class ViewRootImpl implements ViewParent, requestLayout(); } break; case MSG_WINDOW_MOVED: if (mAdded) { final int w = mWinFrame.width(); final int h = mWinFrame.height(); final int l = msg.arg1; final int t = msg.arg2; mWinFrame.left = l; mWinFrame.right = l + w; mWinFrame.top = t; mWinFrame.bottom = t + h; if (mView != null) { forceLayout(mView); } requestLayout(); } break; case MSG_WINDOW_FOCUS_CHANGED: { if (mAdded) { boolean hasWindowFocus = msg.arg1 != 0; Loading Loading @@ -4047,6 +4068,18 @@ public final class ViewRootImpl implements ViewParent, mHandler.sendMessage(msg); } public void dispatchMoved(int newX, int newY) { if (DEBUG_LAYOUT) Log.v(TAG, "Window moved " + this + ": newX=" + newX + " newY=" + newY); if (mTranslator != null) { PointF point = new PointF(newX, newY); mTranslator.translatePointInScreenToAppWindow(point); newX = (int) (point.x + 0.5); newY = (int) (point.y + 0.5); } Message msg = mHandler.obtainMessage(MSG_WINDOW_MOVED, newX, newY); mHandler.sendMessage(msg); } /** * Represents a pending input event that is waiting in a queue. * Loading Loading @@ -4686,6 +4719,14 @@ public final class ViewRootImpl implements ViewParent, } } @Override public void moved(int newX, int newY) { final ViewRootImpl viewAncestor = mViewAncestor.get(); if (viewAncestor != null) { viewAncestor.dispatchMoved(newX, newY); } } public void dispatchAppVisibility(boolean visible) { final ViewRootImpl viewAncestor = mViewAncestor.get(); if (viewAncestor != null) { Loading
core/java/com/android/internal/view/BaseIWindow.java +20 −4 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ public class BaseIWindow extends IWindow.Stub { mSession = session; } @Override public void resized(int w, int h, Rect contentInsets, Rect visibleInsets, boolean reportDraw, Configuration newConfig) { if (reportDraw) { Loading @@ -43,24 +44,35 @@ public class BaseIWindow extends IWindow.Stub { } } @Override public void moved(int newX, int newY) { } @Override public void dispatchAppVisibility(boolean visible) { } @Override public void dispatchGetNewSurface() { } @Override public void dispatchScreenState(boolean on) { } @Override public void windowFocusChanged(boolean hasFocus, boolean touchEnabled) { } @Override public void executeCommand(String command, String parameters, ParcelFileDescriptor out) { } @Override public void closeSystemDialogs(String reason) { } @Override public void dispatchWallpaperOffsets(float x, float y, float xStep, float yStep, boolean sync) { if (sync) { try { Loading @@ -70,14 +82,17 @@ public class BaseIWindow extends IWindow.Stub { } } @Override public void dispatchDragEvent(DragEvent event) { } @Override public void dispatchSystemUiVisibilityChanged(int seq, int globalUi, int localValue, int localChanges) { mSeq = seq; } @Override public void dispatchWallpaperCommand(String action, int x, int y, int z, Bundle extras, boolean sync) { if (sync) { Loading @@ -88,6 +103,7 @@ public class BaseIWindow extends IWindow.Stub { } } @Override public void doneAnimating() { } }