summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2013-10-15 00:17:25 -0400
committerDaniel Sandler <dsandler@android.com>2013-10-15 00:34:10 -0400
commitf9f63355e3f05186a3652c0ef3f0039ed97db918 (patch)
tree744c29bdac3398ef9c77ccccc0a2b812781afb8f /packages
parentdd73ee4d0a33aa9a423b80471aec6d1ec81a6c82 (diff)
downloadframeworks_base-f9f63355e3f05186a3652c0ef3f0039ed97db918.zip
frameworks_base-f9f63355e3f05186a3652c0ef3f0039ed97db918.tar.gz
frameworks_base-f9f63355e3f05186a3652c0ef3f0039ed97db918.tar.bz2
Put DessertCase on a diet.
- store desserts as ALPHA_8, saving 75% of bitmap memory - run DessertCase in its own process, avoiding bloating systemui every time the daydream or platlogo activity run - lock orientation in DessertCase to stop thrashing around when the device is rotated Bug: 10918599 Change-Id: Ia2fb0696b903ae355c75b53d3a0c45b70784d00c
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/AndroidManifest.xml4
-rw-r--r--packages/SystemUI/src/com/android/systemui/DessertCaseView.java27
2 files changed, 24 insertions, 7 deletions
diff --git a/packages/SystemUI/AndroidManifest.xml b/packages/SystemUI/AndroidManifest.xml
index 260a3be..09ac2da 100644
--- a/packages/SystemUI/AndroidManifest.xml
+++ b/packages/SystemUI/AndroidManifest.xml
@@ -200,7 +200,8 @@
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
android:hardwareAccelerated="true"
android:launchMode="singleInstance"
- android:configChanges="orientation|screenSize"
+ android:screenOrientation="locked"
+ android:process=":sweetsweetdesserts"
android:excludeFromRecents="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -215,6 +216,7 @@
android:exported="true"
android:label="@string/dessert_case"
android:enabled="false"
+ android:process=":sweetsweetdesserts"
>
<intent-filter>
<action android:name="android.service.dreams.DreamService" />
diff --git a/packages/SystemUI/src/com/android/systemui/DessertCaseView.java b/packages/SystemUI/src/com/android/systemui/DessertCaseView.java
index 99c59d5..90de65e 100644
--- a/packages/SystemUI/src/com/android/systemui/DessertCaseView.java
+++ b/packages/SystemUI/src/com/android/systemui/DessertCaseView.java
@@ -96,6 +96,13 @@ public class DessertCaseView extends FrameLayout {
1f, 0f, 0f, 0f, 0f
};
+ private static final float[] ALPHA_MASK = {
+ 0f, 0f, 0f, 0f, 255f,
+ 0f, 0f, 0f, 0f, 255f,
+ 0f, 0f, 0f, 0f, 255f,
+ 0f, 0f, 0f, 1f, 0f
+ };
+
private static final float[] WHITE_MASK = {
0f, 0f, 0f, 0f, 255f,
0f, 0f, 0f, 0f, 255f,
@@ -162,8 +169,8 @@ public class DessertCaseView extends FrameLayout {
for (int[] list : new int[][] { PASTRIES, RARE_PASTRIES, XRARE_PASTRIES, XXRARE_PASTRIES }) {
for (int resid : list) {
final BitmapDrawable d = new BitmapDrawable(res,
- BitmapFactory.decodeResource(res, resid, opts));
- d.setColorFilter(new ColorMatrixColorFilter(MASK));
+ convertToAlphaMask(BitmapFactory.decodeResource(res, resid, opts)));
+ d.setColorFilter(new ColorMatrixColorFilter(ALPHA_MASK));
d.setBounds(0, 0, mCellSize, mCellSize);
mDrawables.append(resid, d);
}
@@ -171,6 +178,15 @@ public class DessertCaseView extends FrameLayout {
if (DEBUG) setWillNotDraw(false);
}
+ private static Bitmap convertToAlphaMask(Bitmap b) {
+ Bitmap a = Bitmap.createBitmap(b.getWidth(), b.getHeight(), Bitmap.Config.ALPHA_8);
+ Canvas c = new Canvas(a);
+ Paint pt = new Paint();
+ pt.setColorFilter(new ColorMatrixColorFilter(MASK));
+ c.drawBitmap(b, 0.0f, 0.0f, pt);
+ return a;
+ }
+
public void start() {
if (!mStarted) {
mStarted = true;
@@ -273,9 +289,9 @@ public class DessertCaseView extends FrameLayout {
final float which = frand();
final Drawable d;
- if (which < 0.001f) {
+ if (which < 0.0005f) {
d = mDrawables.get(pick(XXRARE_PASTRIES));
- } else if (which < 0.01f) {
+ } else if (which < 0.005f) {
d = mDrawables.get(pick(XRARE_PASTRIES));
} else if (which < 0.5f) {
d = mDrawables.get(pick(RARE_PASTRIES));
@@ -288,8 +304,7 @@ public class DessertCaseView extends FrameLayout {
v.getOverlay().add(d);
}
- final Paint paint = new Paint();
- v.setLayerType(View.LAYER_TYPE_HARDWARE, paint);
+ v.setLayerType(View.LAYER_TYPE_HARDWARE, null);
lp.width = lp.height = mCellSize;
addView(v, lp);