diff options
author | Dianne Hackborn <hackbod@google.com> | 2009-08-17 11:52:06 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-08-17 11:52:06 -0700 |
commit | 160e4facf63e5bf075683d658ead32c27767de1b (patch) | |
tree | ebd08477148b7855b5bf27af14d794757f152490 /core/java/android | |
parent | 75229368c2721d580d6c8fb11ef25f1aaabba624 (diff) | |
parent | 1a797546d75d2c85d6fefeefdc55de051aa66018 (diff) | |
download | frameworks_base-160e4facf63e5bf075683d658ead32c27767de1b.zip frameworks_base-160e4facf63e5bf075683d658ead32c27767de1b.tar.gz frameworks_base-160e4facf63e5bf075683d658ead32c27767de1b.tar.bz2 |
am 1a797546: Merge change 21380 into eclair
Merge commit '1a797546d75d2c85d6fefeefdc55de051aa66018'
* commit '1a797546d75d2c85d6fefeefdc55de051aa66018':
More work on wallpapers.
Diffstat (limited to 'core/java/android')
-rw-r--r-- | core/java/android/app/WallpaperManager.java | 4 | ||||
-rw-r--r-- | core/java/android/content/res/Resources.java | 4 | ||||
-rw-r--r-- | core/java/android/service/wallpaper/WallpaperService.java | 34 |
3 files changed, 36 insertions, 6 deletions
diff --git a/core/java/android/app/WallpaperManager.java b/core/java/android/app/WallpaperManager.java index fd8776f..c5ca0a3 100644 --- a/core/java/android/app/WallpaperManager.java +++ b/core/java/android/app/WallpaperManager.java @@ -28,6 +28,7 @@ import android.os.IBinder; import android.os.ParcelFileDescriptor; import android.os.RemoteException; import android.os.ServiceManager; +import android.util.Log; import android.view.ViewRoot; import java.io.FileOutputStream; @@ -82,7 +83,8 @@ public class WallpaperManager { try { ParcelFileDescriptor fd = mService.getWallpaper(this); if (fd != null) { - Bitmap bm = BitmapFactory.decodeFileDescriptor(fd.getFileDescriptor()); + Bitmap bm = BitmapFactory.decodeFileDescriptor( + fd.getFileDescriptor(), null, null); if (bm != null) { // For now clear the density until we figure out how // to deal with it for wallpapers. diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java index 2354519..7d412a7 100644 --- a/core/java/android/content/res/Resources.java +++ b/core/java/android/content/res/Resources.java @@ -23,6 +23,7 @@ import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import android.content.pm.ApplicationInfo; +import android.graphics.BitmapFactory; import android.graphics.Movie; import android.graphics.drawable.Drawable; import android.graphics.drawable.ColorDrawable; @@ -1707,7 +1708,8 @@ public class Resources { InputStream is = mAssets.openNonAsset( value.assetCookie, file, AssetManager.ACCESS_BUFFER); // System.out.println("Opened file " + file + ": " + is); - dr = Drawable.createFromResourceStream(this, value, is, file); + dr = Drawable.createFromResourceStream(this, value, is, + file, null); is.close(); // System.out.println("Created stream: " + dr); } catch (Exception e) { 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); } |