diff options
author | 2025-02-26 13:18:54 -0800 | |
---|---|---|
committer | 2025-02-26 13:18:54 -0800 | |
commit | fedfa7913018180ad37f22ebbc7ffe773331ecdb (patch) | |
tree | 8f39d62bfcae512056a50d694c819e976c2e7028 | |
parent | 7bf5872d967350068514dc357044274abf60aaa0 (diff) | |
parent | 7eacb90ec8b8869c63e0ea623a42ceb1321a7d99 (diff) |
Merge "SurfaceView reports setSecure in AssistStructure" into main
-rw-r--r-- | core/java/android/app/contextualsearch/flags.aconfig | 12 | ||||
-rw-r--r-- | core/java/android/view/SurfaceView.java | 21 | ||||
-rw-r--r-- | core/java/android/view/ViewStructure.java | 13 |
3 files changed, 46 insertions, 0 deletions
diff --git a/core/java/android/app/contextualsearch/flags.aconfig b/core/java/android/app/contextualsearch/flags.aconfig index 1de034b23a7a..1a14b20d6c09 100644 --- a/core/java/android/app/contextualsearch/flags.aconfig +++ b/core/java/android/app/contextualsearch/flags.aconfig @@ -23,6 +23,18 @@ flag { bug: "371065456" } + +flag { + name: "report_secure_surfaces_in_assist_structure" + namespace: "windowing_frontend" + description: "SurfaceView reports when the surface is using a SECURE flag." + bug: "390504528" + metadata { + purpose: PURPOSE_BUGFIX + } +} + + flag { name: "contextual_search_prevent_self_capture" namespace: "sysui_integrations" diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java index b98f4db5dce6..4f6c730857a8 100644 --- a/core/java/android/view/SurfaceView.java +++ b/core/java/android/view/SurfaceView.java @@ -2247,6 +2247,27 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall t.reparent(sc, mBlastSurfaceControl).show(sc); } + /** + * Populates a {@link ViewStructure} for content capture. + * + * <p>If {@link #setSecure(boolean)} has been enabled, will add a property to the + * {@link android.app.assist.AssistStructure.ViewNode} to indicate that content will not + * be available for this part of the screen. + * + * @hide + */ + @Override + protected void onProvideStructure(@NonNull ViewStructure structure, + @ViewStructureType int viewFor, int flags) { + super.onProvideStructure(structure, viewFor, flags); + if (android.app.contextualsearch.flags.Flags.reportSecureSurfacesInAssistStructure()) { + if ((mSurfaceFlags & SurfaceControl.SECURE) != 0) { + structure.getExtras().putBoolean( + ViewStructure.EXTRA_CONTAINS_SECURE_LAYERS, true); + } + } + } + /** @hide */ @Override public void onInitializeAccessibilityNodeInfoInternal(AccessibilityNodeInfo info) { diff --git a/core/java/android/view/ViewStructure.java b/core/java/android/view/ViewStructure.java index 43a946a234ba..53953a9379df 100644 --- a/core/java/android/view/ViewStructure.java +++ b/core/java/android/view/ViewStructure.java @@ -77,6 +77,19 @@ public abstract class ViewStructure { "android.view.ViewStructure.extra.FIRST_ACTIVE_POSITION"; /** + * Key used for confirming whether the view draws graphics containing secure layers. + * + * <p>Secure layers cannot be read back into main memory and will show up as blank regions + * in assist screenshots. + * + * @see android.view.SurfaceControl#SECURE + * + * @hide + */ + public static final String EXTRA_CONTAINS_SECURE_LAYERS = + "android.view.ViewStructure.extra.CONTAINS_SECURE_LAYERS"; + + /** * Key used for writing the type of the view that generated the virtual structure of its * children. * |