Merge "window: Adds a Sustained Performance Mode window flag." into nyc-dev am: a645c97
am: 75da7b4
* commit '75da7b4ad041586d1a7a086467a6e6a76516e15f':
window: Adds a Sustained Performance Mode window flag.
Change-Id: Id029aa2f10e4d278c385487739978075607f29a1
This commit is contained in:
@@ -43630,6 +43630,7 @@ package android.view {
|
||||
method public void setSharedElementsUseOverlay(boolean);
|
||||
method public void setSoftInputMode(int);
|
||||
method public abstract void setStatusBarColor(int);
|
||||
method public void setSustainedPerformanceMode(boolean);
|
||||
method public abstract void setTitle(java.lang.CharSequence);
|
||||
method public abstract deprecated void setTitleColor(int);
|
||||
method public void setTransitionBackgroundFadeDuration(long);
|
||||
|
||||
@@ -46579,6 +46579,7 @@ package android.view {
|
||||
method public void setSharedElementsUseOverlay(boolean);
|
||||
method public void setSoftInputMode(int);
|
||||
method public abstract void setStatusBarColor(int);
|
||||
method public void setSustainedPerformanceMode(boolean);
|
||||
method public abstract void setTitle(java.lang.CharSequence);
|
||||
method public abstract deprecated void setTitleColor(int);
|
||||
method public void setTransitionBackgroundFadeDuration(long);
|
||||
|
||||
@@ -43707,6 +43707,7 @@ package android.view {
|
||||
method public void setSharedElementsUseOverlay(boolean);
|
||||
method public void setSoftInputMode(int);
|
||||
method public abstract void setStatusBarColor(int);
|
||||
method public void setSustainedPerformanceMode(boolean);
|
||||
method public abstract void setTitle(java.lang.CharSequence);
|
||||
method public abstract deprecated void setTitleColor(int);
|
||||
method public void setTransitionBackgroundFadeDuration(long);
|
||||
|
||||
@@ -55,12 +55,16 @@ public abstract class PowerManagerInternal {
|
||||
|
||||
|
||||
/**
|
||||
* Power hint: The user is interacting with the device. The corresponding data field must be
|
||||
* Power hint:
|
||||
* Interaction: The user is interacting with the device. The corresponding data field must be
|
||||
* the expected duration of the fling, or 0 if unknown.
|
||||
*
|
||||
* This must be kept in sync with the values in hardware/libhardware/include/hardware/power.h
|
||||
* Sustained Performance Mode: Enable/Disables Sustained Performance Mode.
|
||||
*
|
||||
* These must be kept in sync with the values in hardware/libhardware/include/hardware/power.h
|
||||
*/
|
||||
public static final int POWER_HINT_INTERACTION = 2;
|
||||
public static final int POWER_HINT_SUSTAINED_PERFORMANCE_MODE = 6;
|
||||
|
||||
public static String wakefulnessToString(int wakefulness) {
|
||||
switch (wakefulness) {
|
||||
|
||||
@@ -1177,6 +1177,15 @@ public abstract class Window {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Sets the Sustained Performance requirement for the calling window.
|
||||
* @param enable disables or enables the mode.
|
||||
*/
|
||||
public void setSustainedPerformanceMode(boolean enable) {
|
||||
setPrivateFlags(enable
|
||||
? WindowManager.LayoutParams.PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE : 0,
|
||||
WindowManager.LayoutParams.PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE);
|
||||
}
|
||||
|
||||
private boolean isOutOfBounds(Context context, MotionEvent event) {
|
||||
final int x = (int) event.getX();
|
||||
final int y = (int) event.getY();
|
||||
|
||||
@@ -1246,6 +1246,13 @@ public interface WindowManager extends ViewManager {
|
||||
*/
|
||||
public static final int PRIVATE_FLAG_FORCE_DRAW_STATUS_BAR_BACKGROUND = 0x00020000;
|
||||
|
||||
/**
|
||||
* Flag to indicate that this window needs Sustained Performance Mode if
|
||||
* the device supports it.
|
||||
* @hide
|
||||
*/
|
||||
public static final int PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE = 0x00020000;
|
||||
|
||||
/**
|
||||
* Control flags that are private to the platform.
|
||||
* @hide
|
||||
|
||||
@@ -8,6 +8,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
|
||||
import static android.view.WindowManager.LayoutParams.FLAG_SHOW_WALLPAPER;
|
||||
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_KEYGUARD;
|
||||
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;
|
||||
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER;
|
||||
import static android.view.WindowManager.LayoutParams.TYPE_DREAM;
|
||||
@@ -128,6 +129,9 @@ class WindowSurfacePlacer {
|
||||
private boolean mTraversalScheduled;
|
||||
private int mDeferDepth = 0;
|
||||
|
||||
private boolean mSustainedPerformanceModeEnabled = false;
|
||||
private boolean mSustainedPerformanceModeCurrent = false;
|
||||
|
||||
private static final class LayerAndToken {
|
||||
public int layer;
|
||||
public AppWindowToken token;
|
||||
@@ -288,7 +292,7 @@ class WindowSurfacePlacer {
|
||||
mButtonBrightness = -1;
|
||||
mUserActivityTimeout = -1;
|
||||
mObscureApplicationContentOnSecondaryDisplays = false;
|
||||
|
||||
mSustainedPerformanceModeCurrent = false;
|
||||
mService.mTransactionSequence++;
|
||||
|
||||
final DisplayContent defaultDisplay = mService.getDefaultDisplayContentLocked();
|
||||
@@ -487,6 +491,13 @@ class WindowSurfacePlacer {
|
||||
mUserActivityTimeout);
|
||||
}
|
||||
|
||||
if (mSustainedPerformanceModeCurrent != mSustainedPerformanceModeEnabled) {
|
||||
mSustainedPerformanceModeEnabled = mSustainedPerformanceModeCurrent;
|
||||
mService.mPowerManagerInternal.powerHint(
|
||||
mService.mPowerManagerInternal.POWER_HINT_SUSTAINED_PERFORMANCE_MODE,
|
||||
(mSustainedPerformanceModeEnabled ? 1 : 0));
|
||||
}
|
||||
|
||||
if (mService.mTurnOnScreen) {
|
||||
if (mService.mAllowTheaterModeWakeFromLayout
|
||||
|| Settings.Global.getInt(mService.mContext.getContentResolver(),
|
||||
@@ -1409,6 +1420,7 @@ class WindowSurfacePlacer {
|
||||
final LayoutParams attrs = w.mAttrs;
|
||||
final int attrFlags = attrs.flags;
|
||||
final boolean canBeSeen = w.isDisplayedLw();
|
||||
final int privateflags = attrs.privateFlags;
|
||||
|
||||
if (canBeSeen && w.isObscuringFullscreen(dispInfo)) {
|
||||
// This window completely covers everything behind it,
|
||||
@@ -1469,6 +1481,9 @@ class WindowSurfacePlacer {
|
||||
&& w.mAttrs.preferredDisplayModeId != 0) {
|
||||
mPreferredModeId = w.mAttrs.preferredDisplayModeId;
|
||||
}
|
||||
if ((privateflags & PRIVATE_FLAG_SUSTAINED_PERFORMANCE_MODE) != 0) {
|
||||
mSustainedPerformanceModeCurrent = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user