Loading core/java/com/android/internal/service/wallpaper/ImageWallpaper.java +9 −8 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ public class ImageWallpaper extends WallpaperService { class WallpaperObserver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { mEngine.updateWallpaper(); mEngine.drawFrame(); } } Loading @@ -72,14 +73,7 @@ public class ImageWallpaper extends WallpaperService { @Override public void onCreate(SurfaceHolder surfaceHolder) { super.onCreate(surfaceHolder); mBackground = mWallpaperManager.getDrawable(); mBounds.left = mBounds.top = 0; mBounds.right = mBackground.getIntrinsicWidth(); mBounds.bottom = mBackground.getIntrinsicHeight(); int offx = (getDesiredMinimumWidth() - mBounds.right) / 2; int offy = (getDesiredMinimumHeight() - mBounds.bottom) / 2; mBounds.offset(offx, offy); mBackground.setBounds(mBounds); updateWallpaper(); surfaceHolder.setSizeFromLayout(); } Loading Loading @@ -131,6 +125,13 @@ public class ImageWallpaper extends WallpaperService { void updateWallpaper() { synchronized (mLock) { mBackground = mWallpaperManager.getDrawable(); mBounds.left = mBounds.top = 0; mBounds.right = mBackground.getIntrinsicWidth(); mBounds.bottom = mBackground.getIntrinsicHeight(); int offx = (getDesiredMinimumWidth() - mBounds.right) / 2; int offy = (getDesiredMinimumHeight() - mBounds.bottom) / 2; mBounds.offset(offx, offy); mBackground.setBounds(mBounds); } } } Loading services/java/com/android/server/WallpaperManagerService.java +36 −9 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import android.os.FileObserver; import android.os.ParcelFileDescriptor; import android.os.RemoteCallbackList; import android.os.ServiceManager; import android.os.SystemClock; import android.service.wallpaper.IWallpaperConnection; import android.service.wallpaper.IWallpaperEngine; import android.service.wallpaper.IWallpaperService; Loading Loading @@ -68,10 +69,16 @@ class WallpaperManagerService extends IWallpaperManager.Stub { Object mLock = new Object(); private static final File WALLPAPER_DIR = new File( /** * Minimum time between crashes of a wallpaper service for us to consider * restarting it vs. just reverting to the static wallpaper. */ static final long MIN_WALLPAPER_CRASH_TIME = 10000; static final File WALLPAPER_DIR = new File( "/data/data/com.android.settings/files"); private static final String WALLPAPER = "wallpaper"; private static final File WALLPAPER_FILE = new File(WALLPAPER_DIR, WALLPAPER); static final String WALLPAPER = "wallpaper"; static final File WALLPAPER_FILE = new File(WALLPAPER_DIR, WALLPAPER); /** * List of callbacks registered they should each be notified Loading Loading @@ -116,6 +123,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub { String mName = ""; ComponentName mWallpaperComponent; WallpaperConnection mWallpaperConnection; long mLastDiedTime; class WallpaperConnection extends IWallpaperConnection.Stub implements ServiceConnection { Loading @@ -136,6 +144,14 @@ class WallpaperManagerService extends IWallpaperManager.Stub { synchronized (mLock) { mService = null; mEngine = null; if (mWallpaperConnection == this) { Log.w(TAG, "Wallpaper service gone: " + mWallpaperComponent); if ((mLastDiedTime+MIN_WALLPAPER_CRASH_TIME) < SystemClock.uptimeMillis()) { Log.w(TAG, "Reverting to built-in wallpaper!"); bindWallpaperComponentLocked(null); } } } } Loading Loading @@ -195,7 +211,12 @@ class WallpaperManagerService extends IWallpaperManager.Stub { if (f.exists()) { f.delete(); } final long ident = Binder.clearCallingIdentity(); try { bindWallpaperComponentLocked(null); } finally { Binder.restoreCallingIdentity(ident); } } } Loading Loading @@ -247,12 +268,17 @@ class WallpaperManagerService extends IWallpaperManager.Stub { public ParcelFileDescriptor setWallpaper(String name) { checkPermission(android.Manifest.permission.SET_WALLPAPER); synchronized (mLock) { final long ident = Binder.clearCallingIdentity(); try { ParcelFileDescriptor pfd = updateWallpaperBitmapLocked(name); if (pfd != null) { bindWallpaperComponentLocked(null); saveSettingsLocked(); } return pfd; } finally { Binder.restoreCallingIdentity(ident); } } } Loading Loading @@ -341,6 +367,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub { clearWallpaperComponentLocked(); mWallpaperComponent = name; mWallpaperConnection = newConn; mLastDiedTime = SystemClock.uptimeMillis(); try { if (DEBUG) Log.v(TAG, "Adding window token: " + newConn.mToken); mIWindowManager.addWindowToken(newConn.mToken, Loading services/java/com/android/server/WindowManagerService.java +8 −4 Original line number Diff line number Diff line Loading @@ -1194,6 +1194,9 @@ public class WindowManagerService extends IWindowManager.Stub } if (!visible) w = null; //if (mWallpaperTarget != w) { // Log.v(TAG, "New wallpaper target: " + w); //} mWallpaperTarget = w; if (visible) { Loading Loading @@ -6900,10 +6903,10 @@ public class WindowManagerService extends IWindowManager.Stub if (atoken != null) { return mSurface != null && mPolicyVisibility && !mDestroying && ((!mAttachedHidden && !atoken.hiddenRequested) || mAnimating || atoken.animating); || mAnimation != null || atoken.animation != null); } else { return mSurface != null && mPolicyVisibility && !mDestroying && (!mAttachedHidden || mAnimating); && (!mAttachedHidden || mAnimation != null); } } Loading @@ -6913,10 +6916,11 @@ public class WindowManagerService extends IWindowManager.Stub */ boolean isReadyForDisplay() { final AppWindowToken atoken = mAppToken; final boolean animating = atoken != null ? atoken.animating : false; final boolean animating = atoken != null ? (atoken.animation != null) : false; return mSurface != null && mPolicyVisibility && !mDestroying && ((!mAttachedHidden && !mRootToken.hidden) || mAnimating || animating); || mAnimation != null || animating); } /** Is the window or its container currently animating? */ Loading Loading
core/java/com/android/internal/service/wallpaper/ImageWallpaper.java +9 −8 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ public class ImageWallpaper extends WallpaperService { class WallpaperObserver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { mEngine.updateWallpaper(); mEngine.drawFrame(); } } Loading @@ -72,14 +73,7 @@ public class ImageWallpaper extends WallpaperService { @Override public void onCreate(SurfaceHolder surfaceHolder) { super.onCreate(surfaceHolder); mBackground = mWallpaperManager.getDrawable(); mBounds.left = mBounds.top = 0; mBounds.right = mBackground.getIntrinsicWidth(); mBounds.bottom = mBackground.getIntrinsicHeight(); int offx = (getDesiredMinimumWidth() - mBounds.right) / 2; int offy = (getDesiredMinimumHeight() - mBounds.bottom) / 2; mBounds.offset(offx, offy); mBackground.setBounds(mBounds); updateWallpaper(); surfaceHolder.setSizeFromLayout(); } Loading Loading @@ -131,6 +125,13 @@ public class ImageWallpaper extends WallpaperService { void updateWallpaper() { synchronized (mLock) { mBackground = mWallpaperManager.getDrawable(); mBounds.left = mBounds.top = 0; mBounds.right = mBackground.getIntrinsicWidth(); mBounds.bottom = mBackground.getIntrinsicHeight(); int offx = (getDesiredMinimumWidth() - mBounds.right) / 2; int offy = (getDesiredMinimumHeight() - mBounds.bottom) / 2; mBounds.offset(offx, offy); mBackground.setBounds(mBounds); } } } Loading
services/java/com/android/server/WallpaperManagerService.java +36 −9 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import android.os.FileObserver; import android.os.ParcelFileDescriptor; import android.os.RemoteCallbackList; import android.os.ServiceManager; import android.os.SystemClock; import android.service.wallpaper.IWallpaperConnection; import android.service.wallpaper.IWallpaperEngine; import android.service.wallpaper.IWallpaperService; Loading Loading @@ -68,10 +69,16 @@ class WallpaperManagerService extends IWallpaperManager.Stub { Object mLock = new Object(); private static final File WALLPAPER_DIR = new File( /** * Minimum time between crashes of a wallpaper service for us to consider * restarting it vs. just reverting to the static wallpaper. */ static final long MIN_WALLPAPER_CRASH_TIME = 10000; static final File WALLPAPER_DIR = new File( "/data/data/com.android.settings/files"); private static final String WALLPAPER = "wallpaper"; private static final File WALLPAPER_FILE = new File(WALLPAPER_DIR, WALLPAPER); static final String WALLPAPER = "wallpaper"; static final File WALLPAPER_FILE = new File(WALLPAPER_DIR, WALLPAPER); /** * List of callbacks registered they should each be notified Loading Loading @@ -116,6 +123,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub { String mName = ""; ComponentName mWallpaperComponent; WallpaperConnection mWallpaperConnection; long mLastDiedTime; class WallpaperConnection extends IWallpaperConnection.Stub implements ServiceConnection { Loading @@ -136,6 +144,14 @@ class WallpaperManagerService extends IWallpaperManager.Stub { synchronized (mLock) { mService = null; mEngine = null; if (mWallpaperConnection == this) { Log.w(TAG, "Wallpaper service gone: " + mWallpaperComponent); if ((mLastDiedTime+MIN_WALLPAPER_CRASH_TIME) < SystemClock.uptimeMillis()) { Log.w(TAG, "Reverting to built-in wallpaper!"); bindWallpaperComponentLocked(null); } } } } Loading Loading @@ -195,7 +211,12 @@ class WallpaperManagerService extends IWallpaperManager.Stub { if (f.exists()) { f.delete(); } final long ident = Binder.clearCallingIdentity(); try { bindWallpaperComponentLocked(null); } finally { Binder.restoreCallingIdentity(ident); } } } Loading Loading @@ -247,12 +268,17 @@ class WallpaperManagerService extends IWallpaperManager.Stub { public ParcelFileDescriptor setWallpaper(String name) { checkPermission(android.Manifest.permission.SET_WALLPAPER); synchronized (mLock) { final long ident = Binder.clearCallingIdentity(); try { ParcelFileDescriptor pfd = updateWallpaperBitmapLocked(name); if (pfd != null) { bindWallpaperComponentLocked(null); saveSettingsLocked(); } return pfd; } finally { Binder.restoreCallingIdentity(ident); } } } Loading Loading @@ -341,6 +367,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub { clearWallpaperComponentLocked(); mWallpaperComponent = name; mWallpaperConnection = newConn; mLastDiedTime = SystemClock.uptimeMillis(); try { if (DEBUG) Log.v(TAG, "Adding window token: " + newConn.mToken); mIWindowManager.addWindowToken(newConn.mToken, Loading
services/java/com/android/server/WindowManagerService.java +8 −4 Original line number Diff line number Diff line Loading @@ -1194,6 +1194,9 @@ public class WindowManagerService extends IWindowManager.Stub } if (!visible) w = null; //if (mWallpaperTarget != w) { // Log.v(TAG, "New wallpaper target: " + w); //} mWallpaperTarget = w; if (visible) { Loading Loading @@ -6900,10 +6903,10 @@ public class WindowManagerService extends IWindowManager.Stub if (atoken != null) { return mSurface != null && mPolicyVisibility && !mDestroying && ((!mAttachedHidden && !atoken.hiddenRequested) || mAnimating || atoken.animating); || mAnimation != null || atoken.animation != null); } else { return mSurface != null && mPolicyVisibility && !mDestroying && (!mAttachedHidden || mAnimating); && (!mAttachedHidden || mAnimation != null); } } Loading @@ -6913,10 +6916,11 @@ public class WindowManagerService extends IWindowManager.Stub */ boolean isReadyForDisplay() { final AppWindowToken atoken = mAppToken; final boolean animating = atoken != null ? atoken.animating : false; final boolean animating = atoken != null ? (atoken.animation != null) : false; return mSurface != null && mPolicyVisibility && !mDestroying && ((!mAttachedHidden && !mRootToken.hidden) || mAnimating || animating); || mAnimation != null || animating); } /** Is the window or its container currently animating? */ Loading