diff options
| author | Galia Peycheva <galinap@google.com> | 2019-06-26 14:05:12 +0200 |
|---|---|---|
| committer | Galia Peycheva <galinap@google.com> | 2019-12-23 17:27:55 +0100 |
| commit | 056b3ee745303f6f934e0f0018deea4208a5ea7c (patch) | |
| tree | 5908c21d925bb53deea10b9f3f22afcaff9ef655 /core/java/android/view/WindowManager.java | |
| parent | cd87f72f02009d10b186da4824549b755245f122 (diff) | |
Add minimal post processing API to framework
This API allows applications to instruct the connected display to do minimal
post processing on the produced image or video frames. This will switch the
display to a low latency mode (ALLM, Game mode or some other custom
implementation thereof), reducing lag in the final images. Thus, minimal post
processing would greatly enhance performance for gaming and video
conferencing applications. It would not, however, suit applications that
prioritise image quality over performance.
This CL adds 2 public method:
- Window.setPreferMinimalPostProcessing()
(this can also be set in WindowManager.LayoutParams.preferMinimalPostProcessing)
If minimal post processing is preferred, the connected display will be requested
to go into low latency mode, which reduces image processing, resulting in better
performance for gaming applications. If the Display sink is connected via HDMI,
the device will begin to send infoframes with Auto Low Latency Mode enabled and
Game Content Type. This will switch the connected display to a lower latency
mode (if available).
For more information, see HDMI 2.1 specification.
If the Display sink has an internal connection or uses some other protocol than
HDMI, effects may be similar but implementation-defined.
- Display.isMinimalPostProcessingPreferred()
Returns true if the connected display supports either Low Latency Mode (ALLM or
some other custom low latency implementation) or Game content type.
Bug: 135116095
Test: make -> flash on ATV OTT device -> open an activity which requests minimal
post processing -> check SurfaceControl logs -> verify correct signals are
passed to native
Change-Id: I5508bb9e5c138b0f2b42d8f8fab10e1915ba3cb6
Diffstat (limited to 'core/java/android/view/WindowManager.java')
| -rw-r--r-- | core/java/android/view/WindowManager.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index fc126396edc6..f7d9706a9fce 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -2607,6 +2607,33 @@ public interface WindowManager extends ViewManager { public long hideTimeoutMilliseconds = -1; /** + * Indicates whether this window wants the connected display to do minimal post processing + * on the produced image or video frames. This will only be requested if the window is + * visible on the screen. + * + * <p>This setting should be used when low latency has a higher priority than image + * enhancement processing (e.g. for games or video conferencing). + * + * <p>If the Display sink is connected via HDMI, the device will begin to send infoframes + * with Auto Low Latency Mode enabled and Game Content Type. This will switch the connected + * display to a minimal image processing mode (if available), which reduces latency, + * improving the user experience for gaming or video conferencing applications. For more + * information, see HDMI 2.1 specification. + * + * <p>If the Display sink has an internal connection or uses some other protocol than HDMI, + * effects may be similar but implementation-defined. + * + * <p>The ability to switch to a mode with minimal post proessing may be disabled by a user + * setting in the system settings menu. In that case, this field is ignored and the display + * will remain in its current mode. + * + * @see android.content.pm.ActivityInfo#preferMinimalPostProcessing + * @see android.view.Display#isMinimalPostProcessingSupported + * @see android.view.Window#setPreferMinimalPostProcessing + */ + public boolean preferMinimalPostProcessing = false; + + /** * The color mode requested by this window. The target display may * not be able to honor the request. When the color mode is not set * to {@link ActivityInfo#COLOR_MODE_DEFAULT}, it might override the @@ -2909,6 +2936,7 @@ public interface WindowManager extends ViewManager { out.writeInt(mFitWindowInsetsTypes); out.writeInt(mFitWindowInsetsSides); out.writeBoolean(mFitIgnoreVisibility); + out.writeBoolean(preferMinimalPostProcessing); } public static final @android.annotation.NonNull Parcelable.Creator<LayoutParams> CREATOR @@ -2969,6 +2997,7 @@ public interface WindowManager extends ViewManager { mFitWindowInsetsTypes = in.readInt(); mFitWindowInsetsSides = in.readInt(); mFitIgnoreVisibility = in.readBoolean(); + preferMinimalPostProcessing = in.readBoolean(); } @SuppressWarnings({"PointlessBitwiseExpression"}) @@ -3014,6 +3043,8 @@ public interface WindowManager extends ViewManager { public static final int COLOR_MODE_CHANGED = 1 << 26; /** {@hide} */ public static final int INSET_FLAGS_CHANGED = 1 << 27; + /** {@hide} */ + public static final int MINIMAL_POST_PROCESSING_PREFERENCE_CHANGED = 1 << 28; // internal buffer to backup/restore parameters under compatibility mode. private int[] mCompatibilityParamsBackup = null; @@ -3194,6 +3225,11 @@ public interface WindowManager extends ViewManager { changes |= COLOR_MODE_CHANGED; } + if (preferMinimalPostProcessing != o.preferMinimalPostProcessing) { + preferMinimalPostProcessing = o.preferMinimalPostProcessing; + changes |= MINIMAL_POST_PROCESSING_PREFERENCE_CHANGED; + } + // This can't change, it's only set at window creation time. hideTimeoutMilliseconds = o.hideTimeoutMilliseconds; @@ -3348,6 +3384,10 @@ public interface WindowManager extends ViewManager { if (mColorMode != COLOR_MODE_DEFAULT) { sb.append(" colorMode=").append(ActivityInfo.colorModeToString(mColorMode)); } + if (preferMinimalPostProcessing) { + sb.append(" preferMinimalPostProcessing="); + sb.append(preferMinimalPostProcessing); + } sb.append(System.lineSeparator()); sb.append(prefix).append(" fl=").append( ViewDebug.flagsToString(LayoutParams.class, "flags", flags)); |
