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

Commit 9f348c4b authored by padarshr's avatar padarshr
Browse files

Show notification when charging.

    If user selects "Charging" option from
    USB computer conection, show the notification
    "Connected in charging mode", which will also
    prevent the pending intent from getting removed.

    CRs-Fixed: 641540

Change-Id: I93a04efe52e8280da95438ceb02b4054610a4d6e
parent 06e76bf5
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -179,6 +179,14 @@ public class UsbManager {
     */
    public static final String USB_FUNCTION_PTP = "ptp";

    /**
     * Name of the CHARGING USB function.
     * Used in extras for the {@link #ACTION_USB_STATE} broadcast
     *
     * {@hide}
     */
    public static final String USB_FUNCTION_CHARGING = "charging";

    /**
     * Name of the audio source USB function.
     * Used in extras for the {@link #ACTION_USB_STATE} broadcast
+2 −0
Original line number Diff line number Diff line
@@ -3513,6 +3513,8 @@
    <string name="usb_mtp_notification_title">Connected as a media device</string>
    <!-- USB_PREFERENCES: Notification for when the user connects the phone to a computer via USB in PTP mode.  This is the title -->
    <string name="usb_ptp_notification_title">Connected as a camera</string>
    <!-- USB_PREFERENCES: Notification for when the user connects the phone to a computer via USB in CHARGING mode.  This is the title -->
    <string name="usb_charging_notification_title">Connected in charging mode</string>
    <!-- USB_PREFERENCES: Notification for when the user connects the phone to a computer via USB in mass storage mode (for installer CD image).  This is the title -->
    <string name="usb_cd_installer_notification_title">Connected as an installer</string>
    <!-- USB_PREFERENCES: Notification for when a USB accessory is attached.  This is the title -->
+1 −0
Original line number Diff line number Diff line
@@ -1632,6 +1632,7 @@
  <java-symbol type="string" name="usb_notification_message" />
  <java-symbol type="string" name="use_physical_keyboard" />
  <java-symbol type="string" name="usb_ptp_notification_title" />
  <java-symbol type="string" name="usb_charging_notification_title" />
  <java-symbol type="string" name="vpn_text" />
  <java-symbol type="string" name="vpn_text_long" />
  <java-symbol type="string" name="vpn_title" />
+3 −1
Original line number Diff line number Diff line
@@ -661,7 +661,9 @@ public class UsbDeviceManager {
            int id = 0;
            Resources r = mContext.getResources();
            if (mConnected) {
                if (containsFunction(mCurrentFunctions, UsbManager.USB_FUNCTION_MTP)) {
                if (containsFunction(mCurrentFunctions, UsbManager.USB_FUNCTION_CHARGING)) {
                    id = com.android.internal.R.string.usb_charging_notification_title;
                } else if (containsFunction(mCurrentFunctions, UsbManager.USB_FUNCTION_MTP)) {
                    id = com.android.internal.R.string.usb_mtp_notification_title;
                } else if (containsFunction(mCurrentFunctions, UsbManager.USB_FUNCTION_PTP)) {
                    id = com.android.internal.R.string.usb_ptp_notification_title;