Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 81aa0216 authored by kaiyiz's avatar kaiyiz
Browse files

UMS: Add the missing notification when USB connected

The default USB functions not fall into any of the conditions,
cause "USB computer connection" missing.

Add the bool resource "always_popup_usb_computer_connection", use
it to control whether "USB computer connection" option appear.

This patch fixes the issue that "No USB menu pops up when connect
the device to PC".

CRs-Fixed: 760672
(cherry-picked from commit c6c4bec1)

Change-Id: I3e8a62a290fd0b1867954cea00dced672524ac35
parent f742ebf4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
-->

<resources>
    <!-- Whether to popup usb computer connection-->
    <bool name="always_popup_usb_computer_connection">false</bool>
    <!-- Whether to popup usb computer connection option-->
    <bool name="always_popup_usb_computer_connection_option">false</bool>
    <bool name="kg_enable_camera_default_widget">true</bool>
+1 −0
Original line number Diff line number Diff line
@@ -254,6 +254,7 @@
  <java-symbol type="bool" name="action_bar_embed_tabs_pre_jb" />
  <java-symbol type="bool" name="action_bar_expanded_action_views_exclusive" />
  <java-symbol type="bool" name="config_avoidGfxAccel" />
  <java-symbol type="bool" name="always_popup_usb_computer_connection" />
  <java-symbol type="bool" name="always_popup_usb_computer_connection_option" />
  <java-symbol type="bool" name="config_allowActionMenuItemTextWithIcon" />
  <java-symbol type="bool" name="config_bluetooth_address_validation" />
+10 −0
Original line number Diff line number Diff line
@@ -723,6 +723,16 @@ public class UsbDeviceManager {
                    id = com.android.internal.R.string.usb_cd_installer_notification_title;
                } else if (containsFunction(mCurrentFunctions, UsbManager.USB_FUNCTION_ACCESSORY)) {
                    id = com.android.internal.R.string.usb_accessory_notification_title;
                } else if (r.getBoolean(
                        com.android.internal.R.bool.always_popup_usb_computer_connection)) {
                    // Default usb function is get from the property "persist.sys.usb.config"
                    // in device/qcom/common/rootdir/etc/init.qcom.usb.sh, which may not fall
                    // into any case above, like "diag,serial_smd,rmnet_bam,adb" for some
                    // device,this cause missing USB connection notification.

                    // Default config is false which can be overlaid, when it is true,
                    // it will still show USB connection notification.
                    id = com.android.internal.R.string.usb_cd_installer_notification_title;
                } else {
                    if (AppOpsManager.isStrictEnable()) {
                        id = com.android.internal.R.string.usb_choose_notification_title;