diff options
| author | Romain Guy <romainguy@google.com> | 2010-08-03 18:05:47 -0700 |
|---|---|---|
| committer | Romain Guy <romainguy@google.com> | 2010-08-04 10:55:46 -0700 |
| commit | 529b60a3b16ac3dff24f2403d760ab8ebc9670ff (patch) | |
| tree | 81415ba149de613a165d94210938755982951017 /core/java/android/view/Window.java | |
| parent | cf9a44cdf3647c8b31499ad6250f63259c0e34e2 (diff) | |
Add android:hardwareAccelerated to Activity.
Hardware acceleration can now be enabled/disabled locally on each activity
declared in the manifest. It can also be enabled/disabled directly on a
window through the WindowManager.LayoutParams.
Change-Id: I91dd0b26c4e7eb8cd7288e523ed6b7bda6d0990b
Diffstat (limited to 'core/java/android/view/Window.java')
| -rw-r--r-- | core/java/android/view/Window.java | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/core/java/android/view/Window.java b/core/java/android/view/Window.java index 0d4e84b0e329..f32ff77a8391 100644 --- a/core/java/android/view/Window.java +++ b/core/java/android/view/Window.java @@ -68,6 +68,10 @@ public abstract class Window { * If overlay is enabled, the action mode UI will be allowed to cover existing window content. */ public static final int FEATURE_ACTION_MODE_OVERLAY = 9; + /** + * Flag for requesting this window to be hardware accelerated, if possible. + */ + public static final int FEATURE_HARDWARE_ACCELERATED = 10; /** Flag for setting the progress bar's visibility to VISIBLE */ public static final int PROGRESS_VISIBILITY_ON = -1; /** Flag for setting the progress bar's visibility to GONE */ @@ -375,21 +379,35 @@ public abstract class Window { * * @param wm The ViewManager for adding new windows. */ - public void setWindowManager(WindowManager wm, - IBinder appToken, String appName) { + public void setWindowManager(WindowManager wm, IBinder appToken, String appName) { + setWindowManager(wm, appToken, appName, false); + } + + /** + * Set the window manager for use by this Window to, for example, + * display panels. This is <em>not</em> used for displaying the + * Window itself -- that must be done by the client. + * + * @param wm The ViewManager for adding new windows. + */ + public void setWindowManager(WindowManager wm, IBinder appToken, String appName, + boolean hardwareAccelerated) { mAppToken = appToken; mAppName = appName; if (wm == null) { wm = WindowManagerImpl.getDefault(); } - mWindowManager = new LocalWindowManager(wm); + mWindowManager = new LocalWindowManager(wm, hardwareAccelerated); } private class LocalWindowManager implements WindowManager { - LocalWindowManager(WindowManager wm) { + private boolean mHardwareAccelerated; + + LocalWindowManager(WindowManager wm, boolean hardwareAccelerated) { mWindowManager = wm; mDefaultDisplay = mContext.getResources().getDefaultDisplay( mWindowManager.getDefaultDisplay()); + mHardwareAccelerated = hardwareAccelerated; } public final void addView(View view, ViewGroup.LayoutParams params) { @@ -436,6 +454,9 @@ public abstract class Window { if (wp.packageName == null) { wp.packageName = mContext.getPackageName(); } + if (mHardwareAccelerated) { + wp.flags |= WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED; + } mWindowManager.addView(view, params); } |
