Loading core/java/android/service/wallpaper/WallpaperService.java +49 −14 Original line number Diff line number Diff line Loading @@ -139,6 +139,7 @@ public abstract class WallpaperService extends Service { boolean mSurfaceCreated; boolean mIsCreating; boolean mDrawingAllowed; boolean mOffsetsChanged; int mWidth; int mHeight; int mFormat; Loading Loading @@ -605,11 +606,14 @@ public abstract class WallpaperService extends Service { return; } boolean didSurface = false; try { mSurfaceHolder.ungetCallbacks(); if (surfaceCreating) { mIsCreating = true; didSurface = true; if (DEBUG) Log.v(TAG, "onSurfaceCreated(" + mSurfaceHolder + "): " + this); onSurfaceCreated(mSurfaceHolder); Loading Loading @@ -637,6 +641,7 @@ public abstract class WallpaperService extends Service { + mSurfaceHolder + ", " + mFormat + ", " + mCurWidth + ", " + mCurHeight + "): " + this); didSurface = true; onSurfaceChanged(mSurfaceHolder, mFormat, mCurWidth, mCurHeight); SurfaceHolder.Callback callbacks[] = mSurfaceHolder.getCallbacks(); Loading @@ -661,6 +666,26 @@ public abstract class WallpaperService extends Service { } } if (didSurface && !mReportedVisible) { // This wallpaper is currently invisible, but its // surface has changed. At this point let's tell it // again that it is invisible in case the report about // the surface caused it to start running. We really // don't want wallpapers running when not visible. if (mIsCreating) { // Some wallpapers will ignore this call if they // had previously been told they were invisble, // so if we are creating a new surface then toggle // the state to get them to notice. if (DEBUG) Log.v(TAG, "onVisibilityChanged(true) at surface: " + this); onVisibilityChanged(true); } if (DEBUG) Log.v(TAG, "onVisibilityChanged(false) at surface: " + this); onVisibilityChanged(false); } } finally { mIsCreating = false; mSurfaceCreated = true; Loading Loading @@ -701,6 +726,7 @@ public abstract class WallpaperService extends Service { onCreate(mSurfaceHolder); mInitializing = false; mReportedVisible = false; updateSurface(false, false, false); } Loading @@ -711,7 +737,7 @@ public abstract class WallpaperService extends Service { mIWallpaperEngine.mReqWidth = desiredWidth; mIWallpaperEngine.mReqHeight = desiredHeight; onDesiredSizeChanged(desiredWidth, desiredHeight); doOffsetsChanged(); doOffsetsChanged(true); } } Loading @@ -733,6 +759,7 @@ public abstract class WallpaperService extends Service { // If becoming visible, in preview mode the surface // may have been destroyed so now we need to make // sure it is re-created. doOffsetsChanged(false); updateSurface(false, false, false); } onVisibilityChanged(visible); Loading @@ -740,11 +767,15 @@ public abstract class WallpaperService extends Service { } } void doOffsetsChanged() { void doOffsetsChanged(boolean always) { if (mDestroyed) { return; } if (!always && !mOffsetsChanged) { return; } float xOffset; float yOffset; float xOffsetStep; Loading @@ -761,6 +792,7 @@ public abstract class WallpaperService extends Service { } if (mSurfaceCreated) { if (mReportedVisible) { if (DEBUG) Log.v(TAG, "Offsets change in " + this + ": " + xOffset + "," + yOffset); final int availw = mIWallpaperEngine.mReqWidth-mCurWidth; Loading @@ -768,6 +800,9 @@ public abstract class WallpaperService extends Service { final int availh = mIWallpaperEngine.mReqHeight-mCurHeight; final int yPixels = availh > 0 ? -(int)(availh*yOffset+.5f) : 0; onOffsetsChanged(xOffset, yOffset, xOffsetStep, yOffsetStep, xPixels, yPixels); } else { mOffsetsChanged = true; } } if (sync) { Loading Loading @@ -953,7 +988,7 @@ public abstract class WallpaperService extends Service { mEngine.doVisibilityChanged(message.arg1 != 0); break; case MSG_WALLPAPER_OFFSETS: { mEngine.doOffsetsChanged(); mEngine.doOffsetsChanged(true); } break; case MSG_WALLPAPER_COMMAND: { WallpaperCommand cmd = (WallpaperCommand)message.obj; Loading @@ -962,7 +997,7 @@ public abstract class WallpaperService extends Service { case MSG_WINDOW_RESIZED: { final boolean reportDraw = message.arg1 != 0; mEngine.updateSurface(true, false, reportDraw); mEngine.doOffsetsChanged(); mEngine.doOffsetsChanged(true); } break; case MSG_TOUCH_EVENT: { boolean skip = false; Loading services/java/com/android/server/wm/WindowManagerService.java +17 −1 Original line number Diff line number Diff line Loading @@ -2533,6 +2533,7 @@ public class WindowManagerService extends IWindowManager.Stub boolean wallpaperMayMove = win.mViewVisibility != viewVisibility && (win.mAttrs.flags & FLAG_SHOW_WALLPAPER) != 0; wallpaperMayMove |= (flagChanges & FLAG_SHOW_WALLPAPER) != 0; win.mRelayoutCalled = true; final int oldVisibility = win.mViewVisibility; Loading Loading @@ -7925,11 +7926,26 @@ public class WindowManagerService extends IWindowManager.Stub } if (windowAnimationBackgroundColor != 0) { // If this window that wants black is the current wallpaper // target, then the black goes *below* the wallpaper so we // don't cause the wallpaper to suddenly disappear. WindowState target = windowAnimationBackground; if (mWallpaperTarget == windowAnimationBackground || mLowerWallpaperTarget == windowAnimationBackground || mUpperWallpaperTarget == windowAnimationBackground) { for (i=0; i<mWindows.size(); i++) { WindowState w = mWindows.get(i); if (w.mIsWallpaper) { target = w; break; } } } if (mWindowAnimationBackgroundSurface == null) { mWindowAnimationBackgroundSurface = new DimSurface(mFxSession); } mWindowAnimationBackgroundSurface.show(dw, dh, windowAnimationBackground.mAnimLayer - LAYER_OFFSET_DIM, target.mAnimLayer - LAYER_OFFSET_DIM, windowAnimationBackgroundColor); } else if (mWindowAnimationBackgroundSurface != null) { mWindowAnimationBackgroundSurface.hide(); Loading Loading
core/java/android/service/wallpaper/WallpaperService.java +49 −14 Original line number Diff line number Diff line Loading @@ -139,6 +139,7 @@ public abstract class WallpaperService extends Service { boolean mSurfaceCreated; boolean mIsCreating; boolean mDrawingAllowed; boolean mOffsetsChanged; int mWidth; int mHeight; int mFormat; Loading Loading @@ -605,11 +606,14 @@ public abstract class WallpaperService extends Service { return; } boolean didSurface = false; try { mSurfaceHolder.ungetCallbacks(); if (surfaceCreating) { mIsCreating = true; didSurface = true; if (DEBUG) Log.v(TAG, "onSurfaceCreated(" + mSurfaceHolder + "): " + this); onSurfaceCreated(mSurfaceHolder); Loading Loading @@ -637,6 +641,7 @@ public abstract class WallpaperService extends Service { + mSurfaceHolder + ", " + mFormat + ", " + mCurWidth + ", " + mCurHeight + "): " + this); didSurface = true; onSurfaceChanged(mSurfaceHolder, mFormat, mCurWidth, mCurHeight); SurfaceHolder.Callback callbacks[] = mSurfaceHolder.getCallbacks(); Loading @@ -661,6 +666,26 @@ public abstract class WallpaperService extends Service { } } if (didSurface && !mReportedVisible) { // This wallpaper is currently invisible, but its // surface has changed. At this point let's tell it // again that it is invisible in case the report about // the surface caused it to start running. We really // don't want wallpapers running when not visible. if (mIsCreating) { // Some wallpapers will ignore this call if they // had previously been told they were invisble, // so if we are creating a new surface then toggle // the state to get them to notice. if (DEBUG) Log.v(TAG, "onVisibilityChanged(true) at surface: " + this); onVisibilityChanged(true); } if (DEBUG) Log.v(TAG, "onVisibilityChanged(false) at surface: " + this); onVisibilityChanged(false); } } finally { mIsCreating = false; mSurfaceCreated = true; Loading Loading @@ -701,6 +726,7 @@ public abstract class WallpaperService extends Service { onCreate(mSurfaceHolder); mInitializing = false; mReportedVisible = false; updateSurface(false, false, false); } Loading @@ -711,7 +737,7 @@ public abstract class WallpaperService extends Service { mIWallpaperEngine.mReqWidth = desiredWidth; mIWallpaperEngine.mReqHeight = desiredHeight; onDesiredSizeChanged(desiredWidth, desiredHeight); doOffsetsChanged(); doOffsetsChanged(true); } } Loading @@ -733,6 +759,7 @@ public abstract class WallpaperService extends Service { // If becoming visible, in preview mode the surface // may have been destroyed so now we need to make // sure it is re-created. doOffsetsChanged(false); updateSurface(false, false, false); } onVisibilityChanged(visible); Loading @@ -740,11 +767,15 @@ public abstract class WallpaperService extends Service { } } void doOffsetsChanged() { void doOffsetsChanged(boolean always) { if (mDestroyed) { return; } if (!always && !mOffsetsChanged) { return; } float xOffset; float yOffset; float xOffsetStep; Loading @@ -761,6 +792,7 @@ public abstract class WallpaperService extends Service { } if (mSurfaceCreated) { if (mReportedVisible) { if (DEBUG) Log.v(TAG, "Offsets change in " + this + ": " + xOffset + "," + yOffset); final int availw = mIWallpaperEngine.mReqWidth-mCurWidth; Loading @@ -768,6 +800,9 @@ public abstract class WallpaperService extends Service { final int availh = mIWallpaperEngine.mReqHeight-mCurHeight; final int yPixels = availh > 0 ? -(int)(availh*yOffset+.5f) : 0; onOffsetsChanged(xOffset, yOffset, xOffsetStep, yOffsetStep, xPixels, yPixels); } else { mOffsetsChanged = true; } } if (sync) { Loading Loading @@ -953,7 +988,7 @@ public abstract class WallpaperService extends Service { mEngine.doVisibilityChanged(message.arg1 != 0); break; case MSG_WALLPAPER_OFFSETS: { mEngine.doOffsetsChanged(); mEngine.doOffsetsChanged(true); } break; case MSG_WALLPAPER_COMMAND: { WallpaperCommand cmd = (WallpaperCommand)message.obj; Loading @@ -962,7 +997,7 @@ public abstract class WallpaperService extends Service { case MSG_WINDOW_RESIZED: { final boolean reportDraw = message.arg1 != 0; mEngine.updateSurface(true, false, reportDraw); mEngine.doOffsetsChanged(); mEngine.doOffsetsChanged(true); } break; case MSG_TOUCH_EVENT: { boolean skip = false; Loading
services/java/com/android/server/wm/WindowManagerService.java +17 −1 Original line number Diff line number Diff line Loading @@ -2533,6 +2533,7 @@ public class WindowManagerService extends IWindowManager.Stub boolean wallpaperMayMove = win.mViewVisibility != viewVisibility && (win.mAttrs.flags & FLAG_SHOW_WALLPAPER) != 0; wallpaperMayMove |= (flagChanges & FLAG_SHOW_WALLPAPER) != 0; win.mRelayoutCalled = true; final int oldVisibility = win.mViewVisibility; Loading Loading @@ -7925,11 +7926,26 @@ public class WindowManagerService extends IWindowManager.Stub } if (windowAnimationBackgroundColor != 0) { // If this window that wants black is the current wallpaper // target, then the black goes *below* the wallpaper so we // don't cause the wallpaper to suddenly disappear. WindowState target = windowAnimationBackground; if (mWallpaperTarget == windowAnimationBackground || mLowerWallpaperTarget == windowAnimationBackground || mUpperWallpaperTarget == windowAnimationBackground) { for (i=0; i<mWindows.size(); i++) { WindowState w = mWindows.get(i); if (w.mIsWallpaper) { target = w; break; } } } if (mWindowAnimationBackgroundSurface == null) { mWindowAnimationBackgroundSurface = new DimSurface(mFxSession); } mWindowAnimationBackgroundSurface.show(dw, dh, windowAnimationBackground.mAnimLayer - LAYER_OFFSET_DIM, target.mAnimLayer - LAYER_OFFSET_DIM, windowAnimationBackgroundColor); } else if (mWindowAnimationBackgroundSurface != null) { mWindowAnimationBackgroundSurface.hide(); Loading