Avoiding overlay activities when usb device is attached.
Adding property android.app.PROPERTY_RESTRICT_USB_OVERLAY_ACTIVITIES
in manifest. This property will be honored only for applications which
have MANAGE_USB permission(i.e only priviledged applications). If this
property is set on application which is in foreground when usb device is
attached then, usb flow would not resolveActivity.
If there is no application in foreground with this field set,
then usb attachment will start overlay activities.
Bug: 307231174
Test: Manually tested the flow.
Test: atest UsbManagerTests
Change-Id: Ica4f557ec5eeb0887373f5bd1a44f05f1bdfeecd
diff --git a/services/usb/Android.bp b/services/usb/Android.bp
index 3a0a6ab..e8ffe54 100644
--- a/services/usb/Android.bp
+++ b/services/usb/Android.bp
@@ -34,8 +34,20 @@
"android.hardware.usb-V1.2-java",
"android.hardware.usb-V1.3-java",
"android.hardware.usb-V3-java",
+ "usb_flags_lib",
],
lint: {
baseline_filename: "lint-baseline.xml",
},
}
+
+aconfig_declarations {
+ name: "usb_flags",
+ package: "com.android.server.usb.flags",
+ srcs: ["**/usb_flags.aconfig"],
+}
+
+java_aconfig_library {
+ name: "usb_flags_lib",
+ aconfig_declarations: "usb_flags",
+}