Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java +57 −0 Original line number Diff line number Diff line Loading @@ -21,8 +21,12 @@ import android.app.IWallpaperManager; import android.app.IWallpaperManagerCallback; import android.app.WallpaperManager; import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.DrawableWrapper; import android.os.Bundle; import android.os.Handler; import android.os.ParcelFileDescriptor; Loading Loading @@ -151,4 +155,57 @@ public class LockscreenWallpaper extends IWallpaperManagerCallback.Stub implemen getBitmap(); mBar.updateMediaMetaData(true /* metaDataChanged */, true /* allowEnterAnimation */); } /** * Drawable that aligns left horizontally and center vertically (like ImageWallpaper). */ public static class WallpaperDrawable extends DrawableWrapper { private Bitmap mBackground; private Rect mTmpRect = new Rect(); public WallpaperDrawable(Resources r, Bitmap b) { super(new BitmapDrawable(r, b)); mBackground = b; } @Override public int getIntrinsicWidth() { return -1; } @Override public int getIntrinsicHeight() { return -1; } @Override protected void onBoundsChange(Rect bounds) { int vwidth = getBounds().width(); int vheight = getBounds().height(); int dwidth = mBackground.getWidth(); int dheight = mBackground.getHeight(); float scale; float dx = 0, dy = 0; if (dwidth * vheight > vwidth * dheight) { scale = (float) vheight / (float) dheight; } else { scale = (float) vwidth / (float) dwidth; } if (scale <= 1f) { scale = 1f; } dy = (vheight - dheight * scale) * 0.5f; mTmpRect.set( bounds.left, bounds.top + Math.round(dy), bounds.left + Math.round(dwidth * scale), bounds.top + Math.round(dheight * scale + dy)); super.onBoundsChange(mTmpRect); } } } packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +14 −5 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.graphics.PointF; import android.graphics.PorterDuff; import android.graphics.PorterDuffXfermode; import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.inputmethodservice.InputMethodService; Loading Loading @@ -1928,19 +1929,27 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, + " state=" + mState); } Bitmap artworkBitmap = null; Drawable artworkDrawable = null; if (mMediaMetadata != null) { Bitmap artworkBitmap = null; artworkBitmap = mMediaMetadata.getBitmap(MediaMetadata.METADATA_KEY_ART); if (artworkBitmap == null) { artworkBitmap = mMediaMetadata.getBitmap(MediaMetadata.METADATA_KEY_ALBUM_ART); // might still be null } if (artworkBitmap != null) { artworkDrawable = new BitmapDrawable(mBackdropBack.getResources(), artworkBitmap); } } if (ENABLE_LOCKSCREEN_WALLPAPER && artworkDrawable == null) { Bitmap lockWallpaper = mLockscreenWallpaper.getBitmap(); if (lockWallpaper != null) { artworkDrawable = new LockscreenWallpaper.WallpaperDrawable( mBackdropBack.getResources(), lockWallpaper); } if (ENABLE_LOCKSCREEN_WALLPAPER && artworkBitmap == null) { artworkBitmap = mLockscreenWallpaper.getBitmap(); } final boolean hasArtwork = artworkBitmap != null; final boolean hasArtwork = artworkDrawable != null; if ((hasArtwork || DEBUG_MEDIA_FAKE_ARTWORK) && mState != StatusBarState.SHADE && mFingerprintUnlockController.getMode() Loading Loading @@ -1985,7 +1994,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mBackdropBack.setBackgroundColor(0xFFFFFFFF); mBackdropBack.setImageDrawable(new ColorDrawable(c)); } else { mBackdropBack.setImageBitmap(artworkBitmap); mBackdropBack.setImageDrawable(artworkDrawable); } if (mScrimSrcModeEnabled) { mBackdropBack.getDrawable().mutate().setXfermode(mSrcXferMode); Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenWallpaper.java +57 −0 Original line number Diff line number Diff line Loading @@ -21,8 +21,12 @@ import android.app.IWallpaperManager; import android.app.IWallpaperManagerCallback; import android.app.WallpaperManager; import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.DrawableWrapper; import android.os.Bundle; import android.os.Handler; import android.os.ParcelFileDescriptor; Loading Loading @@ -151,4 +155,57 @@ public class LockscreenWallpaper extends IWallpaperManagerCallback.Stub implemen getBitmap(); mBar.updateMediaMetaData(true /* metaDataChanged */, true /* allowEnterAnimation */); } /** * Drawable that aligns left horizontally and center vertically (like ImageWallpaper). */ public static class WallpaperDrawable extends DrawableWrapper { private Bitmap mBackground; private Rect mTmpRect = new Rect(); public WallpaperDrawable(Resources r, Bitmap b) { super(new BitmapDrawable(r, b)); mBackground = b; } @Override public int getIntrinsicWidth() { return -1; } @Override public int getIntrinsicHeight() { return -1; } @Override protected void onBoundsChange(Rect bounds) { int vwidth = getBounds().width(); int vheight = getBounds().height(); int dwidth = mBackground.getWidth(); int dheight = mBackground.getHeight(); float scale; float dx = 0, dy = 0; if (dwidth * vheight > vwidth * dheight) { scale = (float) vheight / (float) dheight; } else { scale = (float) vwidth / (float) dwidth; } if (scale <= 1f) { scale = 1f; } dy = (vheight - dheight * scale) * 0.5f; mTmpRect.set( bounds.left, bounds.top + Math.round(dy), bounds.left + Math.round(dwidth * scale), bounds.top + Math.round(dheight * scale + dy)); super.onBoundsChange(mTmpRect); } } }
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +14 −5 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.graphics.PointF; import android.graphics.PorterDuff; import android.graphics.PorterDuffXfermode; import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.inputmethodservice.InputMethodService; Loading Loading @@ -1928,19 +1929,27 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, + " state=" + mState); } Bitmap artworkBitmap = null; Drawable artworkDrawable = null; if (mMediaMetadata != null) { Bitmap artworkBitmap = null; artworkBitmap = mMediaMetadata.getBitmap(MediaMetadata.METADATA_KEY_ART); if (artworkBitmap == null) { artworkBitmap = mMediaMetadata.getBitmap(MediaMetadata.METADATA_KEY_ALBUM_ART); // might still be null } if (artworkBitmap != null) { artworkDrawable = new BitmapDrawable(mBackdropBack.getResources(), artworkBitmap); } } if (ENABLE_LOCKSCREEN_WALLPAPER && artworkDrawable == null) { Bitmap lockWallpaper = mLockscreenWallpaper.getBitmap(); if (lockWallpaper != null) { artworkDrawable = new LockscreenWallpaper.WallpaperDrawable( mBackdropBack.getResources(), lockWallpaper); } if (ENABLE_LOCKSCREEN_WALLPAPER && artworkBitmap == null) { artworkBitmap = mLockscreenWallpaper.getBitmap(); } final boolean hasArtwork = artworkBitmap != null; final boolean hasArtwork = artworkDrawable != null; if ((hasArtwork || DEBUG_MEDIA_FAKE_ARTWORK) && mState != StatusBarState.SHADE && mFingerprintUnlockController.getMode() Loading Loading @@ -1985,7 +1994,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, mBackdropBack.setBackgroundColor(0xFFFFFFFF); mBackdropBack.setImageDrawable(new ColorDrawable(c)); } else { mBackdropBack.setImageBitmap(artworkBitmap); mBackdropBack.setImageDrawable(artworkDrawable); } if (mScrimSrcModeEnabled) { mBackdropBack.getDrawable().mutate().setXfermode(mSrcXferMode); Loading