summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorAna Krulec <akrulec@google.com>2019-11-02 23:11:02 +0100
committerAna Krulec <akrulec@google.com>2020-01-15 12:43:14 -0800
commitfea971787ac5a453e381a08aed37c0b4d82f20bb (patch)
treea703075c812e5a7443c41a7f745a785f79cbd45a /core/java
parent18901e2ff96f7ac4b1086dffe38e0af23a12533d (diff)
WindowManager: Send layer priority hint to SurfaceFlinger
Basic algorithm: if (!isFocused && preferredModeId > 0) -> priority is 2 if (isFocused && preferredModeId == 0) -> priority is 1 if (isFocused && preferredModeId > 0) -> priority is 0 else priority is INT_MAX See go/sf-generalizing-refresh-rate for master doc, and https://docs.google.com/document/d/1ozR7UT3AZclsJ6f4NJ4WXYO2eb-GRdv-Q55AYTltZSo for WM specific document. Test: Device starts. Observe logs for errors. Test: Observe printouts on SF side to make sure the correct number gets passed along. Test: Unit tests for setting priority on Transaction. Test: Swappy and Messaging app running in split screen. If swappy in focus, it gets priority 0, otherwise 2. If Messsging app in focus it gets priority 1, otherwise INT_MAX. Test: Chrome playing video. Chrome Activity gets priority 0. Test: Expand status bar. Status bar has priority 1. Test: Application running. Status bar gets an update. Nothing is passed along. Bug: 142507166 Change-Id: Iea75f63882b173fad089cd4a32a4831b92206797
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/view/SurfaceControl.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index ff8455ab0915..cc4278bdd2b6 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -122,6 +122,8 @@ public final class SurfaceControl implements Parcelable {
private static native void nativeSetColor(long transactionObj, long nativeObject, float[] color);
private static native void nativeSetFlags(long transactionObj, long nativeObject,
int flags, int mask);
+ private static native void nativeSetFrameRateSelectionPriority(long transactionObj,
+ long nativeObject, int priority);
private static native void nativeSetWindowCrop(long transactionObj, long nativeObject,
int l, int t, int r, int b);
private static native void nativeSetCornerRadius(long transactionObj, long nativeObject,
@@ -2245,6 +2247,19 @@ public final class SurfaceControl implements Parcelable {
}
/**
+ * This information is passed to SurfaceFlinger to decide which window should have a
+ * priority when deciding about the refresh rate of the display. All windows have the
+ * lowest priority by default.
+ * @hide
+ */
+ @NonNull
+ public Transaction setFrameRateSelectionPriority(@NonNull SurfaceControl sc, int priority) {
+ sc.checkNotReleased();
+ nativeSetFrameRateSelectionPriority(mNativeObject, sc.mNativeObject, priority);
+ return this;
+ }
+
+ /**
* Request that a given surface and it's sub-tree be shown.
*
* @param sc The surface to show.