Merge "Exposing public API to retrieve current setting of 'Match Content Frame Rate'." into sc-dev
This commit is contained in:
@@ -18842,9 +18842,14 @@ package android.hardware.display {
|
|||||||
method public android.view.Display getDisplay(int);
|
method public android.view.Display getDisplay(int);
|
||||||
method public android.view.Display[] getDisplays();
|
method public android.view.Display[] getDisplays();
|
||||||
method public android.view.Display[] getDisplays(String);
|
method public android.view.Display[] getDisplays(String);
|
||||||
|
method public int getMatchContentFrameRateUserPreference();
|
||||||
method public void registerDisplayListener(android.hardware.display.DisplayManager.DisplayListener, android.os.Handler);
|
method public void registerDisplayListener(android.hardware.display.DisplayManager.DisplayListener, android.os.Handler);
|
||||||
method public void unregisterDisplayListener(android.hardware.display.DisplayManager.DisplayListener);
|
method public void unregisterDisplayListener(android.hardware.display.DisplayManager.DisplayListener);
|
||||||
field public static final String DISPLAY_CATEGORY_PRESENTATION = "android.hardware.display.category.PRESENTATION";
|
field public static final String DISPLAY_CATEGORY_PRESENTATION = "android.hardware.display.category.PRESENTATION";
|
||||||
|
field public static final int MATCH_CONTENT_FRAMERATE_ALWAYS = 2; // 0x2
|
||||||
|
field public static final int MATCH_CONTENT_FRAMERATE_NEVER = 0; // 0x0
|
||||||
|
field public static final int MATCH_CONTENT_FRAMERATE_SEAMLESSS_ONLY = 1; // 0x1
|
||||||
|
field public static final int MATCH_CONTENT_FRAMERATE_UNKNOWN = -1; // 0xffffffff
|
||||||
field public static final int VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR = 16; // 0x10
|
field public static final int VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR = 16; // 0x10
|
||||||
field public static final int VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY = 8; // 0x8
|
field public static final int VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY = 8; // 0x8
|
||||||
field public static final int VIRTUAL_DISPLAY_FLAG_PRESENTATION = 2; // 0x2
|
field public static final int VIRTUAL_DISPLAY_FLAG_PRESENTATION = 2; // 0x2
|
||||||
|
|||||||
@@ -1155,7 +1155,6 @@ package android.hardware.display {
|
|||||||
|
|
||||||
public final class DisplayManager {
|
public final class DisplayManager {
|
||||||
method public boolean areUserDisabledHdrTypesAllowed();
|
method public boolean areUserDisabledHdrTypesAllowed();
|
||||||
method @RequiresPermission(android.Manifest.permission.MODIFY_REFRESH_RATE_SWITCHING_TYPE) public int getRefreshRateSwitchingType();
|
|
||||||
method @NonNull public int[] getUserDisabledHdrTypes();
|
method @NonNull public int[] getUserDisabledHdrTypes();
|
||||||
method public boolean isMinimalPostProcessingRequested(int);
|
method public boolean isMinimalPostProcessingRequested(int);
|
||||||
method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setAreUserDisabledHdrTypesAllowed(boolean);
|
method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setAreUserDisabledHdrTypesAllowed(boolean);
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import android.media.projection.MediaProjection;
|
|||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
|
import android.util.Slog;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.view.Display;
|
import android.view.Display;
|
||||||
import android.view.Surface;
|
import android.view.Surface;
|
||||||
@@ -347,6 +348,37 @@ public final class DisplayManager {
|
|||||||
public static final int VIRTUAL_DISPLAY_FLAG_OWN_DISPLAY_GROUP = 1 << 11;
|
public static final int VIRTUAL_DISPLAY_FLAG_OWN_DISPLAY_GROUP = 1 << 11;
|
||||||
|
|
||||||
|
|
||||||
|
/** @hide */
|
||||||
|
@IntDef(prefix = {"MATCH_CONTENT_FRAMERATE_"}, value = {
|
||||||
|
MATCH_CONTENT_FRAMERATE_UNKNOWN,
|
||||||
|
MATCH_CONTENT_FRAMERATE_NEVER,
|
||||||
|
MATCH_CONTENT_FRAMERATE_SEAMLESSS_ONLY,
|
||||||
|
MATCH_CONTENT_FRAMERATE_ALWAYS,
|
||||||
|
})
|
||||||
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
|
public @interface MatchContentFrameRateType {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Match content frame rate user preference is unknown.
|
||||||
|
*/
|
||||||
|
public static final int MATCH_CONTENT_FRAMERATE_UNKNOWN = -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* No mode switching is allowed.
|
||||||
|
*/
|
||||||
|
public static final int MATCH_CONTENT_FRAMERATE_NEVER = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only refresh rate switches without visual interruptions are allowed.
|
||||||
|
*/
|
||||||
|
public static final int MATCH_CONTENT_FRAMERATE_SEAMLESSS_ONLY = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refresh rate switches between all refresh rates are allowed even if they have visual
|
||||||
|
* interruptions for the user.
|
||||||
|
*/
|
||||||
|
public static final int MATCH_CONTENT_FRAMERATE_ALWAYS = 2;
|
||||||
|
|
||||||
/** @hide */
|
/** @hide */
|
||||||
@IntDef(prefix = {"SWITCHING_TYPE_"}, value = {
|
@IntDef(prefix = {"SWITCHING_TYPE_"}, value = {
|
||||||
SWITCHING_TYPE_NONE,
|
SWITCHING_TYPE_NONE,
|
||||||
@@ -1076,14 +1108,36 @@ public final class DisplayManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the refresh rate switching type.
|
* Returns the user preference for "Match content frame rate".
|
||||||
*
|
* <p>
|
||||||
* @hide
|
* Never: Even if the app requests it, the device will never try to match its output to the
|
||||||
|
* original frame rate of the content.
|
||||||
|
* </p><p>
|
||||||
|
* Seamless: If the app requests it, the device will match its output to the original frame
|
||||||
|
* rate of the content, ONLY if the display can transition seamlessly.
|
||||||
|
* </p><p>
|
||||||
|
* Always: If the app requests it, the device will match its output to the original
|
||||||
|
* frame rate of the content. This may cause the screen to go blank for a
|
||||||
|
* second when exiting or entering a video playback.
|
||||||
|
* </p>
|
||||||
*/
|
*/
|
||||||
@TestApi
|
@MatchContentFrameRateType public int getMatchContentFrameRateUserPreference() {
|
||||||
@RequiresPermission(Manifest.permission.MODIFY_REFRESH_RATE_SWITCHING_TYPE)
|
return toMatchContentFrameRateSetting(mGlobal.getRefreshRateSwitchingType());
|
||||||
@SwitchingType public int getRefreshRateSwitchingType() {
|
}
|
||||||
return mGlobal.getRefreshRateSwitchingType();
|
|
||||||
|
@MatchContentFrameRateType
|
||||||
|
private int toMatchContentFrameRateSetting(@SwitchingType int switchingType) {
|
||||||
|
switch (switchingType) {
|
||||||
|
case SWITCHING_TYPE_NONE:
|
||||||
|
return MATCH_CONTENT_FRAMERATE_NEVER;
|
||||||
|
case SWITCHING_TYPE_WITHIN_GROUPS:
|
||||||
|
return MATCH_CONTENT_FRAMERATE_SEAMLESSS_ONLY;
|
||||||
|
case SWITCHING_TYPE_ACROSS_AND_WITHIN_GROUPS:
|
||||||
|
return MATCH_CONTENT_FRAMERATE_ALWAYS;
|
||||||
|
default:
|
||||||
|
Slog.e(TAG, switchingType + " is not a valid value of switching type.");
|
||||||
|
return MATCH_CONTENT_FRAMERATE_UNKNOWN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2932,9 +2932,6 @@ public final class DisplayManagerService extends SystemService {
|
|||||||
|
|
||||||
@Override // Binder call
|
@Override // Binder call
|
||||||
public int getRefreshRateSwitchingType() {
|
public int getRefreshRateSwitchingType() {
|
||||||
mContext.enforceCallingOrSelfPermission(
|
|
||||||
Manifest.permission.MODIFY_REFRESH_RATE_SWITCHING_TYPE,
|
|
||||||
"Permission required read refresh rate switching type.");
|
|
||||||
final long token = Binder.clearCallingIdentity();
|
final long token = Binder.clearCallingIdentity();
|
||||||
try {
|
try {
|
||||||
return getRefreshRateSwitchingTypeInternal();
|
return getRefreshRateSwitchingTypeInternal();
|
||||||
|
|||||||
Reference in New Issue
Block a user