Merge "Trust System UI owned display to receive keys" into rvc-dev

This commit is contained in:
Charles Chen
2020-06-16 13:56:55 +00:00
committed by Android (Google) Code Review
19 changed files with 109 additions and 29 deletions

View File

@@ -241,12 +241,25 @@ public final class Display {
* This flag identifies secondary displays that should show system decorations, such as status
* bar, navigation bar, home activity or IME.
* </p>
* <p>Note that this flag doesn't work without {@link #FLAG_TRUSTED}</p>
*
* @see #getFlags()
* @hide
*/
// TODO (b/114338689): Remove the flag and use IWindowManager#setShouldShowSystemDecors
public static final int FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS = 1 << 6;
/**
* Flag: The display is trusted to show system decorations and receive inputs without users'
* touch.
* @see #FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS
*
* @see #getFlags()
* @hide
*/
@TestApi
public static final int FLAG_TRUSTED = 1 << 7;
/**
* Display flag: Indicates that the contents of the display should not be scaled
* to fit the physical screen dimensions. Used for development only to emulate
@@ -564,6 +577,7 @@ public final class Display {
* @see #FLAG_SUPPORTS_PROTECTED_BUFFERS
* @see #FLAG_SECURE
* @see #FLAG_PRIVATE
* @see #FLAG_ROUND
*/
public int getFlags() {
return mFlags;
@@ -1222,6 +1236,16 @@ public final class Display {
Display.FLAG_PRESENTATION;
}
/**
* @return {@code true} if the display is a trusted display.
*
* @see #FLAG_TRUSTED
* @hide
*/
public boolean isTrusted() {
return (mFlags & FLAG_TRUSTED) == FLAG_TRUSTED;
}
private void updateDisplayInfoLocked() {
// Note: The display manager caches display info objects on our behalf.
DisplayInfo newInfo = mGlobal.getDisplayInfo(mDisplayId);

View File

@@ -717,6 +717,15 @@ public final class DisplayInfo implements Parcelable {
if ((flags & Display.FLAG_ROUND) != 0) {
result.append(", FLAG_ROUND");
}
if ((flags & Display.FLAG_CAN_SHOW_WITH_INSECURE_KEYGUARD) != 0) {
result.append(", FLAG_CAN_SHOW_WITH_INSECURE_KEYGUARD");
}
if ((flags & Display.FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS) != 0) {
result.append(", FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS");
}
if ((flags & Display.FLAG_TRUSTED) != 0) {
result.append(", FLAG_TRUSTED");
}
return result.toString();
}
}