am 7ef38ea9: Merge "Fix issue #7275122: Wall paper jank when switching users" into jb-mr1-dev

* commit '7ef38ea9e5ee1d2fd58e818f37191a589793e236':
  Fix issue #7275122: Wall paper jank when switching users
This commit is contained in:
Dianne Hackborn
2012-10-05 12:57:43 -07:00
committed by Android Git Automerger
2 changed files with 30 additions and 21 deletions

View File

@@ -574,7 +574,8 @@ public abstract class WallpaperService extends Service {
final boolean flagsChanged = mCurWindowFlags != mWindowFlags || final boolean flagsChanged = mCurWindowFlags != mWindowFlags ||
mCurWindowPrivateFlags != mWindowPrivateFlags; mCurWindowPrivateFlags != mWindowPrivateFlags;
if (forceRelayout || creating || surfaceCreating || formatChanged || sizeChanged if (forceRelayout || creating || surfaceCreating || formatChanged || sizeChanged
|| typeChanged || flagsChanged || redrawNeeded) { || typeChanged || flagsChanged || redrawNeeded
|| !mIWallpaperEngine.mShownReported) {
if (DEBUG) Log.v(TAG, "Changes: creating=" + creating if (DEBUG) Log.v(TAG, "Changes: creating=" + creating
+ " format=" + formatChanged + " size=" + sizeChanged); + " format=" + formatChanged + " size=" + sizeChanged);
@@ -739,6 +740,7 @@ public abstract class WallpaperService extends Service {
if (redrawNeeded) { if (redrawNeeded) {
mSession.finishDrawing(mWindow); mSession.finishDrawing(mWindow);
} }
mIWallpaperEngine.reportShown();
} }
} catch (RemoteException ex) { } catch (RemoteException ex) {
} }
@@ -950,6 +952,7 @@ public abstract class WallpaperService extends Service {
final IBinder mWindowToken; final IBinder mWindowToken;
final int mWindowType; final int mWindowType;
final boolean mIsPreview; final boolean mIsPreview;
boolean mShownReported;
int mReqWidth; int mReqWidth;
int mReqHeight; int mReqHeight;
@@ -1002,6 +1005,18 @@ public abstract class WallpaperService extends Service {
} }
} }
public void reportShown() {
if (!mShownReported) {
mShownReported = true;
try {
mConnection.engineShown(this);
} catch (RemoteException e) {
Log.w(TAG, "Wallpaper host disappeared", e);
return;
}
}
}
public void destroy() { public void destroy() {
Message msg = mCaller.obtainMessage(DO_DETACH); Message msg = mCaller.obtainMessage(DO_DETACH);
mCaller.sendMessage(msg); mCaller.sendMessage(msg);
@@ -1020,12 +1035,6 @@ public abstract class WallpaperService extends Service {
mEngine = engine; mEngine = engine;
mActiveEngines.add(engine); mActiveEngines.add(engine);
engine.attach(this); engine.attach(this);
try {
mConnection.engineShown(this);
} catch (RemoteException e) {
Log.w(TAG, "Wallpaper host disappeared", e);
return;
}
return; return;
} }
case DO_DETACH: { case DO_DETACH: {

View File

@@ -98,6 +98,13 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
static final String WALLPAPER = "wallpaper"; static final String WALLPAPER = "wallpaper";
static final String WALLPAPER_INFO = "wallpaper_info.xml"; static final String WALLPAPER_INFO = "wallpaper_info.xml";
/**
* Name of the component used to display bitmap wallpapers from either the gallery or
* built-in wallpapers.
*/
static final ComponentName IMAGE_WALLPAPER = new ComponentName("com.android.systemui",
"com.android.systemui.ImageWallpaper");
/** /**
* Observes the wallpaper for changes and notifies all IWallpaperServiceCallbacks * Observes the wallpaper for changes and notifies all IWallpaperServiceCallbacks
* that the wallpaper has changed. The CREATE is triggered when there is no * that the wallpaper has changed. The CREATE is triggered when there is no
@@ -138,7 +145,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
if (event == CLOSE_WRITE) { if (event == CLOSE_WRITE) {
mWallpaper.imageWallpaperPending = false; mWallpaper.imageWallpaperPending = false;
} }
bindWallpaperComponentLocked(mWallpaper.imageWallpaperComponent, true, bindWallpaperComponentLocked(IMAGE_WALLPAPER, true,
false, mWallpaper, null); false, mWallpaper, null);
saveSettingsLocked(mWallpaper); saveSettingsLocked(mWallpaper);
} }
@@ -183,13 +190,6 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
*/ */
ComponentName nextWallpaperComponent; ComponentName nextWallpaperComponent;
/**
* Name of the component used to display bitmap wallpapers from either the gallery or
* built-in wallpapers.
*/
ComponentName imageWallpaperComponent = new ComponentName("com.android.systemui",
"com.android.systemui.ImageWallpaper");
WallpaperConnection connection; WallpaperConnection connection;
long lastDiedTime; long lastDiedTime;
boolean wallpaperUpdating; boolean wallpaperUpdating;
@@ -559,7 +559,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
wallpaper.imageWallpaperPending = false; wallpaper.imageWallpaperPending = false;
if (userId != mCurrentUserId) return; if (userId != mCurrentUserId) return;
if (bindWallpaperComponentLocked(defaultFailed if (bindWallpaperComponentLocked(defaultFailed
? wallpaper.imageWallpaperComponent ? IMAGE_WALLPAPER
: null, true, false, wallpaper, reply)) { : null, true, false, wallpaper, reply)) {
return; return;
} }
@@ -792,7 +792,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
} }
if (componentName == null) { if (componentName == null) {
// Fall back to static image wallpaper // Fall back to static image wallpaper
componentName = wallpaper.imageWallpaperComponent; componentName = IMAGE_WALLPAPER;
//clearWallpaperComponentLocked(); //clearWallpaperComponentLocked();
//return; //return;
if (DEBUG) Slog.v(TAG, "Using image wallpaper"); if (DEBUG) Slog.v(TAG, "Using image wallpaper");
@@ -815,7 +815,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
WallpaperInfo wi = null; WallpaperInfo wi = null;
Intent intent = new Intent(WallpaperService.SERVICE_INTERFACE); Intent intent = new Intent(WallpaperService.SERVICE_INTERFACE);
if (componentName != null && !componentName.equals(wallpaper.imageWallpaperComponent)) { if (componentName != null && !componentName.equals(IMAGE_WALLPAPER)) {
// Make sure the selected service is actually a wallpaper service. // Make sure the selected service is actually a wallpaper service.
List<ResolveInfo> ris = List<ResolveInfo> ris =
mIPackageManager.queryIntentServices(intent, mIPackageManager.queryIntentServices(intent,
@@ -990,7 +990,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
out.attribute(null, "height", Integer.toString(wallpaper.height)); out.attribute(null, "height", Integer.toString(wallpaper.height));
out.attribute(null, "name", wallpaper.name); out.attribute(null, "name", wallpaper.name);
if (wallpaper.wallpaperComponent != null if (wallpaper.wallpaperComponent != null
&& !wallpaper.wallpaperComponent.equals(wallpaper.imageWallpaperComponent)) { && !wallpaper.wallpaperComponent.equals(IMAGE_WALLPAPER)) {
out.attribute(null, "component", out.attribute(null, "component",
wallpaper.wallpaperComponent.flattenToShortString()); wallpaper.wallpaperComponent.flattenToShortString());
} }
@@ -1062,7 +1062,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
if (wallpaper.nextWallpaperComponent == null if (wallpaper.nextWallpaperComponent == null
|| "android".equals(wallpaper.nextWallpaperComponent || "android".equals(wallpaper.nextWallpaperComponent
.getPackageName())) { .getPackageName())) {
wallpaper.nextWallpaperComponent = wallpaper.imageWallpaperComponent; wallpaper.nextWallpaperComponent = IMAGE_WALLPAPER;
} }
if (DEBUG) { if (DEBUG) {
@@ -1124,7 +1124,7 @@ class WallpaperManagerService extends IWallpaperManager.Stub {
loadSettingsLocked(0); loadSettingsLocked(0);
wallpaper = mWallpaperMap.get(0); wallpaper = mWallpaperMap.get(0);
if (wallpaper.nextWallpaperComponent != null if (wallpaper.nextWallpaperComponent != null
&& !wallpaper.nextWallpaperComponent.equals(wallpaper.imageWallpaperComponent)) { && !wallpaper.nextWallpaperComponent.equals(IMAGE_WALLPAPER)) {
if (!bindWallpaperComponentLocked(wallpaper.nextWallpaperComponent, false, false, if (!bindWallpaperComponentLocked(wallpaper.nextWallpaperComponent, false, false,
wallpaper, null)) { wallpaper, null)) {
// No such live wallpaper or other failure; fall back to the default // No such live wallpaper or other failure; fall back to the default