From 1b365921e88b14857d8e0826e221c371d25f6cb2 Mon Sep 17 00:00:00 2001 From: Jim Miller Date: Wed, 9 Mar 2011 19:38:07 -0800 Subject: Fix 3201849: Enable hardware acceleration in LockScreen WaveView [DO NOT MERGE] Change-Id: I07bbed7843857158cd2c1ffd9b184bde7fd5860d --- core/java/android/view/ViewRoot.java | 16 +++++++++++----- core/java/android/view/WindowManager.java | 11 +++++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) (limited to 'core/java/android') diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java index 11908bb..a53c6d0 100644 --- a/core/java/android/view/ViewRoot.java +++ b/core/java/android/view/ViewRoot.java @@ -498,15 +498,21 @@ public final class ViewRoot extends Handler implements ViewParent, mAttachInfo.mHardwareAccelerationRequested = false; // Try to enable hardware acceleration if requested - if (attrs != null && - (attrs.flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) != 0) { + final boolean hardwareAccelerated = + (attrs.flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) != 0; + + if (attrs != null && hardwareAccelerated) { // Only enable hardware acceleration if we are not in the system process // The window manager creates ViewRoots to display animated preview windows // of launching apps and we don't want those to be hardware accelerated - if (!HardwareRenderer.sRendererDisabled) { + + final boolean systemHwAccelerated = + (attrs.flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED_SYSTEM) != 0; + + if (!HardwareRenderer.sRendererDisabled || systemHwAccelerated) { // Don't enable hardware acceleration when we're not on the main thread - if (Looper.getMainLooper() != Looper.myLooper()) { - Log.w(HardwareRenderer.LOG_TAG, "Attempting to initialize hardware " + if (!systemHwAccelerated && Looper.getMainLooper() != Looper.myLooper()) { + Log.w(HardwareRenderer.LOG_TAG, "Attempting to initialize hardware " + "acceleration outside of the main thread, aborting"); return; } diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index ca932e9..8a18aaf 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -665,6 +665,17 @@ public interface WindowManager extends ViewManager { * XML attribute is set to true on an activity or on the application.

*/ public static final int FLAG_HARDWARE_ACCELERATED = 0x01000000; + + /** + * Like {@link #FLAG_HARDWARE_ACCELERATED} except for trusted system windows + * that need hardware acceleration (e.g. LockScreen), where hardware acceleration + * is generally disabled. This flag must be specified in addition to + * {@link #FLAG_HARDWARE_ACCELERATED} to enable hardware acceleration for system + * windows. + * + * @hide + */ + public static final int FLAG_HARDWARE_ACCELERATED_SYSTEM = 0x02000000; // ----- HIDDEN FLAGS. // These start at the high bit and go down. -- cgit v1.1