Merge "Fix 3201849: Enable hardware acceleration in LockScreen WaveView [DO NOT MERGE]" into honeycomb-mr1

This commit is contained in:
Jim Miller
2011-03-10 22:59:57 -08:00
committed by Android (Google) Code Review
5 changed files with 28 additions and 7 deletions

View File

@@ -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;
}

View File

@@ -665,6 +665,17 @@ public interface WindowManager extends ViewManager {
* XML attribute is set to true on an activity or on the application.</p>
*/
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.

View File

@@ -40,7 +40,7 @@ import com.android.internal.R;
public class WaveView extends View implements ValueAnimator.AnimatorUpdateListener {
private static final String TAG = "WaveView";
private static final boolean DBG = false;
private static final int WAVE_COUNT = 5; // default wave count
private static final int WAVE_COUNT = 20; // default wave count
private static final long VIBRATE_SHORT = 20; // msec
private static final long VIBRATE_LONG = 20; // msec

View File

@@ -103,6 +103,8 @@ public class KeyguardViewManager implements KeyguardWindowController {
int flags = WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN
| WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER
| WindowManager.LayoutParams.FLAG_KEEP_SURFACE_WHILE_ANIMATING
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
| WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED_SYSTEM
/*| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR*/ ;
if (!mNeedsInput) {
@@ -142,7 +144,7 @@ public class KeyguardViewManager implements KeyguardWindowController {
mKeyguardView.onScreenTurnedOn();
}
}
mViewManager.updateViewLayout(mKeyguardHost, mWindowLayoutParams);
mKeyguardHost.setVisibility(View.VISIBLE);
mKeyguardView.requestFocus();
}

View File

@@ -232,6 +232,8 @@ class LockScreen extends LinearLayout implements KeyguardScreen,
/** {@inheritDoc} */
public void onGrabbedStateChange(View v, int grabbedState) {
if (DBG) Log.v(TAG, "*** LockScreen accel is "
+ (mEnergyWave.isHardwareAccelerated() ? "on":"off"));
// Don't poke the wake lock when returning to a state where the handle is
// not grabbed since that can happen when the system (instead of the user)
// cancels the grab.