summaryrefslogtreecommitdiffstats
path: root/core/java/android/service
diff options
context:
space:
mode:
authorDianne Hackborn <hackbod@google.com>2009-08-14 11:37:52 -0700
committerDianne Hackborn <hackbod@google.com>2009-08-17 10:42:59 -0700
commit7341d7a104b47996445d069a695e155a07184606 (patch)
tree1be8efee3847179fbb0ed4d556be029ad23f5832 /core/java/android/service
parent56e7ba2928bce62283a62ad1c9d9f1ec7b54c24c (diff)
downloadframeworks_base-7341d7a104b47996445d069a695e155a07184606.zip
frameworks_base-7341d7a104b47996445d069a695e155a07184606.tar.gz
frameworks_base-7341d7a104b47996445d069a695e155a07184606.tar.bz2
More work on wallpapers.
- Do better about figuring out when to stop them and other related window management. - Fix problem where we were not redrawing the surface when the orientation changed. This was the cause of the device hang.
Diffstat (limited to 'core/java/android/service')
-rw-r--r--core/java/android/service/wallpaper/WallpaperService.java34
1 files changed, 30 insertions, 4 deletions
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index 595b10c..0a3ffff 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -58,6 +58,7 @@ public abstract class WallpaperService extends Service {
private static final int MSG_UPDATE_SURFACE = 10000;
private static final int MSG_VISIBILITY_CHANGED = 10010;
private static final int MSG_WALLPAPER_OFFSETS = 10020;
+ private static final int MSG_WINDOW_RESIZED = 10030;
/**
* The actual implementation of a wallpaper. A wallpaper service may
@@ -130,6 +131,13 @@ public abstract class WallpaperService extends Service {
};
final BaseIWindow mWindow = new BaseIWindow() {
+ public void resized(int w, int h, Rect coveredInsets,
+ Rect visibleInsets, boolean reportDraw) {
+ Message msg = mCaller.obtainMessageI(MSG_WINDOW_RESIZED,
+ reportDraw ? 1 : 0);
+ mCaller.sendMessage(msg);
+ }
+
public void dispatchAppVisibility(boolean visible) {
Message msg = mCaller.obtainMessageI(MSG_VISIBILITY_CHANGED,
visible ? 1 : 0);
@@ -238,7 +246,7 @@ public abstract class WallpaperService extends Service {
final boolean creating = !mCreated;
final boolean formatChanged = mFormat != mSurfaceHolder.getRequestedFormat();
- final boolean sizeChanged = mWidth != myWidth || mHeight != myHeight;
+ boolean sizeChanged = mWidth != myWidth || mHeight != myHeight;
final boolean typeChanged = mType != mSurfaceHolder.getRequestedType();
if (force || creating || formatChanged || sizeChanged || typeChanged) {
@@ -286,8 +294,16 @@ public abstract class WallpaperService extends Service {
if (DEBUG) Log.i(TAG, "New surface: " + mSurfaceHolder.mSurface
+ ", frame=" + mWinFrame);
- mCurWidth = mWinFrame.width();
- mCurHeight = mWinFrame.height();
+ int w = mWinFrame.width();
+ if (mCurWidth != w) {
+ sizeChanged = true;
+ mCurWidth = w;
+ }
+ int h = mWinFrame.height();
+ if (mCurHeight != h) {
+ sizeChanged = true;
+ mCurHeight = h;
+ }
mSurfaceHolder.mSurfaceLock.unlock();
@@ -312,7 +328,7 @@ public abstract class WallpaperService extends Service {
}
}
}
- if (creating || formatChanged || sizeChanged) {
+ if (force || creating || formatChanged || sizeChanged) {
onSurfaceChanged(mSurfaceHolder, mFormat,
mCurWidth, mCurHeight);
if (callbacks != null) {
@@ -452,6 +468,16 @@ public abstract class WallpaperService extends Service {
final int yPixels = availh > 0 ? -(int)(availh*yOffset+.5f) : 0;
mEngine.onOffsetsChanged(xOffset, yOffset, xPixels, yPixels);
} break;
+ case MSG_WINDOW_RESIZED: {
+ final boolean reportDraw = message.arg1 != 0;
+ mEngine.updateSurface(true);
+ if (reportDraw) {
+ try {
+ mEngine.mSession.finishDrawing(mEngine.mWindow);
+ } catch (RemoteException e) {
+ }
+ }
+ } break;
default :
Log.w(TAG, "Unknown message type " + message.what);
}