summaryrefslogtreecommitdiffstats
path: root/policy/src
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2011-01-11 20:30:20 -0800
committerJim Miller <jaggies@google.com>2011-01-11 20:30:20 -0800
commit39d4b067a777a96817c279429a8e3c452c13c5b4 (patch)
tree17092b3b76b9f4937d7413842e04567cfd05c0f4 /policy/src
parent50cf2106b77d4009e1cefe11c57c42fe4584345f (diff)
downloadframeworks_base-39d4b067a777a96817c279429a8e3c452c13c5b4.zip
frameworks_base-39d4b067a777a96817c279429a8e3c452c13c5b4.tar.gz
frameworks_base-39d4b067a777a96817c279429a8e3c452c13c5b4.tar.bz2
Fix 3201849: Use custom Drawable for bg in lockscreen
This uses a custom drawable to improve the performance of rendering a transparent background in LockScreen on devices without hardware acceleration. Change-Id: I7aae13070d475c3ac19d91ba5c6cb7d2a83a18ce
Diffstat (limited to 'policy/src')
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardViewBase.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java b/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java
index 82753b2..6b52454 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewBase.java
@@ -18,6 +18,11 @@ package com.android.internal.policy.impl;
import android.content.Context;
import android.content.Intent;
+import android.graphics.Canvas;
+import android.graphics.ColorFilter;
+import android.graphics.PixelFormat;
+import android.graphics.PorterDuff;
+import android.graphics.drawable.Drawable;
import android.media.AudioManager;
import android.telephony.TelephonyManager;
import android.view.KeyEvent;
@@ -37,12 +42,34 @@ import android.util.AttributeSet;
*/
public abstract class KeyguardViewBase extends FrameLayout {
+ private static final int BACKGROUND_COLOR = 0x70000000;
private KeyguardViewCallback mCallback;
private AudioManager mAudioManager;
private TelephonyManager mTelephonyManager = null;
public KeyguardViewBase(Context context) {
super(context);
+
+ // This is a faster way to draw the background on devices without hardware acceleration
+ setBackgroundDrawable(new Drawable() {
+ @Override
+ public void draw(Canvas canvas) {
+ canvas.drawColor(BACKGROUND_COLOR, PorterDuff.Mode.SRC);
+ }
+
+ @Override
+ public void setAlpha(int alpha) {
+ }
+
+ @Override
+ public void setColorFilter(ColorFilter cf) {
+ }
+
+ @Override
+ public int getOpacity() {
+ return PixelFormat.TRANSLUCENT;
+ }
+ });
}
// used to inject callback