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

Commit e7533615 authored by Gus Prevas's avatar Gus Prevas
Browse files

Adds config flag for USB notification.

This change modifies UsbDeviceManager such that the ongoing
system notification for USB charging state is controlled by a
config flag.

Bug: 23409719
Change-Id: I2ef24fe74923170a6e8dd02375b973b4025281e4
parent ad9a0efc
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -51,4 +51,7 @@
    <!-- Scale factor threshold used by the screen magnifier to determine when to switch from
    <!-- Scale factor threshold used by the screen magnifier to determine when to switch from
         panning to scaling the magnification viewport. -->
         panning to scaling the magnification viewport. -->
    <item name="config_screen_magnification_scaling_threshold" format="float" type="dimen">0.1</item>
    <item name="config_screen_magnification_scaling_threshold" format="float" type="dimen">0.1</item>

    <!-- Do not show the message saying USB is connected in charging mode. -->
    <bool name="config_usbChargingMessage">false</bool>
</resources>
</resources>
+4 −1
Original line number Original line Diff line number Diff line
@@ -233,7 +233,7 @@
    <integer name="config_networkTransitionTimeout">60000</integer>
    <integer name="config_networkTransitionTimeout">60000</integer>


    <!-- List of regexpressions describing the interface (if any) that represent tetherable
    <!-- List of regexpressions describing the interface (if any) that represent tetherable
         USB interfaces.  If the device doesn't want to support tething over USB this should
         USB interfaces.  If the device doesn't want to support tethering over USB this should
         be empty.  An example would be "usb.*" -->
         be empty.  An example would be "usb.*" -->
    <string-array translatable="false" name="config_tether_usb_regexs">
    <string-array translatable="false" name="config_tether_usb_regexs">
    </string-array>
    </string-array>
@@ -524,6 +524,9 @@
    <!-- If this is true, the screen will come on when you unplug usb/power/whatever. -->
    <!-- If this is true, the screen will come on when you unplug usb/power/whatever. -->
    <bool name="config_unplugTurnsOnScreen">false</bool>
    <bool name="config_unplugTurnsOnScreen">false</bool>


    <!-- If this is true, the message that USB is only being used for charging will be shown. -->
    <bool name="config_usbChargingMessage">true</bool>

    <!-- Set this true only if the device has separate attention and notification lights. -->
    <!-- Set this true only if the device has separate attention and notification lights. -->
    <bool name="config_useAttentionLight">false</bool>
    <bool name="config_useAttentionLight">false</bool>


+1 −0
Original line number Original line Diff line number Diff line
@@ -1628,6 +1628,7 @@
  <java-symbol type="bool" name="config_enableNetworkLocationOverlay" />
  <java-symbol type="bool" name="config_enableNetworkLocationOverlay" />
  <java-symbol type="bool" name="config_sf_limitedAlpha" />
  <java-symbol type="bool" name="config_sf_limitedAlpha" />
  <java-symbol type="bool" name="config_unplugTurnsOnScreen" />
  <java-symbol type="bool" name="config_unplugTurnsOnScreen" />
  <java-symbol type="bool" name="config_usbChargingMessage" />
  <java-symbol type="bool" name="config_allowAutoBrightnessWhileDozing" />
  <java-symbol type="bool" name="config_allowAutoBrightnessWhileDozing" />
  <java-symbol type="bool" name="config_allowTheaterModeWakeFromUnplug" />
  <java-symbol type="bool" name="config_allowTheaterModeWakeFromUnplug" />
  <java-symbol type="bool" name="config_allowTheaterModeWakeFromGesture" />
  <java-symbol type="bool" name="config_allowTheaterModeWakeFromGesture" />
+2 −1
Original line number Original line Diff line number Diff line
@@ -233,7 +233,8 @@ public class UsbDeviceManager {
        final StorageManager storageManager = StorageManager.from(mContext);
        final StorageManager storageManager = StorageManager.from(mContext);
        final StorageVolume primary = storageManager.getPrimaryVolume();
        final StorageVolume primary = storageManager.getPrimaryVolume();
        massStorageSupported = primary != null && primary.allowMassStorage();
        massStorageSupported = primary != null && primary.allowMassStorage();
        mUseUsbNotification = !massStorageSupported;
        mUseUsbNotification = !massStorageSupported && mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_usbChargingMessage);


        // make sure the ADB_ENABLED setting value matches the current state
        // make sure the ADB_ENABLED setting value matches the current state
        try {
        try {