diff options
| author | 2024-05-07 15:40:13 -0700 | |
|---|---|---|
| committer | 2024-05-30 16:31:38 -0700 | |
| commit | af46212e9b2c700e29dc67eda4ebb0da09397937 (patch) | |
| tree | ad7a8170ce22bf33e341dccc31e290a5b1463380 | |
| parent | b7b487937a6059fb1c60ee0ab28c09461ab2d8f0 (diff) | |
update java doc for CONTENT_SENSITIVITY_AUTO & FLAG_SECURE
Fix: 332776308
Fix: 331987297
Test: build
Change-Id: I4560fe8c3c14170eabe0f4d2e3e766683812b05d
| -rw-r--r-- | core/java/android/view/View.java | 35 | ||||
| -rw-r--r-- | core/java/android/view/WindowManager.java | 4 |
2 files changed, 33 insertions, 6 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 1cb276568244..8ae999149dc8 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -1984,9 +1984,25 @@ public class View implements Drawable.Callback, KeyEvent.Callback, public @interface ContentSensitivity {} /** - * Automatically determine whether a view displays sensitive content. For example, available - * autofill hints (or some other signal) can be used to determine if this view - * displays sensitive content. + * Content sensitivity is determined by the framework. The framework uses a heuristic to + * determine if this view displays sensitive content. + * Autofill hints i.e. {@link #getAutofillHints()} are used in the heuristic + * to determine if this view should be considered as a sensitive view. + * <p> + * {@link #AUTOFILL_HINT_USERNAME}, + * {@link #AUTOFILL_HINT_PASSWORD}, + * {@link #AUTOFILL_HINT_CREDIT_CARD_NUMBER}, + * {@link #AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE}, + * {@link #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE}, + * {@link #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY}, + * {@link #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH}, + * {@link #AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR} + * are considered sensitive hints by the framework, and the list may include more hints + * in the future. + * + * <p> The window hosting a sensitive view will be marked as secure during an active media + * projection session. This would be equivalent to applying + * {@link android.view.WindowManager.LayoutParams#FLAG_SECURE} to the window. * * @see #getContentSensitivity() */ @@ -1996,6 +2012,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback, /** * The view displays sensitive content. * + * <p> The window hosting a sensitive view will be marked as secure during an active media + * projection session. This would be equivalent to applying + * {@link android.view.WindowManager.LayoutParams#FLAG_SECURE} to the window. + * * @see #getContentSensitivity() */ @FlaggedApi(FLAG_SENSITIVE_CONTENT_APP_PROTECTION_API) @@ -10548,9 +10568,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, /** * Sets content sensitivity mode to determine whether this view displays sensitive content - * (e.g. username, password etc.). The system may improve user privacy i.e. hide content + * (e.g. username, password etc.). The system will improve user privacy i.e. hide content * drawn by a sensitive view from screen sharing and recording. * + * <p> The window hosting a sensitive view will be marked as secure during an active media + * projection session. This would be equivalent to applying + * {@link android.view.WindowManager.LayoutParams#FLAG_SECURE} to the window. + * * @param mode {@link #CONTENT_SENSITIVITY_AUTO}, {@link #CONTENT_SENSITIVITY_NOT_SENSITIVE} * or {@link #CONTENT_SENSITIVITY_SENSITIVE} */ @@ -10574,8 +10598,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * {@link #setContentSensitivity(int)}. */ @FlaggedApi(FLAG_SENSITIVE_CONTENT_APP_PROTECTION_API) - public @ContentSensitivity - final int getContentSensitivity() { + public @ContentSensitivity final int getContentSensitivity() { return (mPrivateFlags4 & PFLAG4_CONTENT_SENSITIVITY_MASK) >> PFLAG4_CONTENT_SENSITIVITY_SHIFT; } diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 0f54940ba0e5..42bf420b9812 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -2801,6 +2801,10 @@ public interface WindowManager extends ViewManager { * it from appearing in screenshots or from being viewed on non-secure * displays. * + * <p>See {@link android.view.View#setContentSensitivity(int)}, a window hosting + * a sensitive view will be marked as secure during media projection, preventing + * it from being viewed on non-secure displays and during screen share. + * * <p>See {@link android.view.Display#FLAG_SECURE} for more details about * secure surfaces and secure displays. */ |