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

Commit 28b6fc9c authored by Jerry Zhang's avatar Jerry Zhang
Browse files

Usb changes and strings for connected devices 2.0

New metrics constant and usb strings for the new
notification / details page.

Bug: 69333961
Test: Check notification
Change-Id: If9bde7f787e40e42bb991a99b032e1ff968a0a41
parent 327b809a
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -3222,19 +3222,23 @@
    <string name="dlg_ok">OK</string>

    <!-- USB_PREFERENCES: Notification for when the user connected to the charger only.  This is the title -->
    <string name="usb_charging_notification_title">USB charging this device</string>
    <string name="usb_charging_notification_title">Charging this device via USB</string>
    <!-- USB_PREFERENCES: Notification for when the user connects the phone to supply power to attached device.  This is the title -->
    <string name="usb_supplying_notification_title">USB supplying power to attached device</string>
    <string name="usb_supplying_notification_title">Charging connected device via USB</string>
    <!-- USB_PREFERENCES: Notification for when the user connects the phone to a computer via USB in MTP mode.  This is the title -->
    <string name="usb_mtp_notification_title">USB for file transfer</string>
    <string name="usb_mtp_notification_title">USB file transfer turned on</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">USB for photo transfer</string>
    <string name="usb_ptp_notification_title">PTP via USB turned on</string>
    <!-- USB_PREFERENCES: Notification for when the user connects the phone to a computer via USB in Tethering mode.  This is the title -->
    <string name="usb_tether_notification_title">USB tethering turned on</string>
    <!-- USB_PREFERENCES: Notification for when the user connects the phone to a computer via USB in MIDI mode.  This is the title -->
    <string name="usb_midi_notification_title">USB for MIDI</string>
    <string name="usb_midi_notification_title">MIDI via USB turned on</string>
    <!-- USB_PREFERENCES: Notification for when a USB accessory is attached.  This is the title -->
    <string name="usb_accessory_notification_title">Connected to a USB accessory</string>
    <string name="usb_accessory_notification_title">USB accessory mode turned on</string>
    <!-- See USB_PREFERENCES. This is the message. -->
    <string name="usb_notification_message">Tap for more options.</string>
    <!-- See USB_PREFERENCES. This is the message when a data mode is turned on (mtp, ptp, midi) and the device is supplying power.. -->
    <string name="usb_power_notification_message">Charging connected device. Tap for more options.</string>
    <!-- USB_PREFERENCES: Notification for when a type-c USB audio accessory is attached but not supported.  This is the title -->
    <string name="usb_unsupported_audio_accessory_title">Analog audio accessory detected</string>
    <!-- Message of notification shown when a type-c USB audio accessory is attached but not supported. -->
+2 −0
Original line number Diff line number Diff line
@@ -2026,8 +2026,10 @@
  <java-symbol type="string" name="usb_mtp_notification_title" />
  <java-symbol type="string" name="usb_charging_notification_title" />
  <java-symbol type="string" name="usb_notification_message" />
  <java-symbol type="string" name="usb_power_notification_message" />
  <java-symbol type="string" name="usb_ptp_notification_title" />
  <java-symbol type="string" name="usb_midi_notification_title" />
  <java-symbol type="string" name="usb_tether_notification_title" />
  <java-symbol type="string" name="usb_supplying_notification_title" />
  <java-symbol type="string" name="usb_unsupported_audio_accessory_title" />
  <java-symbol type="string" name="usb_unsupported_audio_accessory_message" />
+5 −0
Original line number Diff line number Diff line
@@ -5173,6 +5173,11 @@ message MetricsEvent {
    // OS: P
    AUTOFILL_INVALID_PERMISSION = 1289;
    
    // OPEN: Settings->Connected Devices->USB->(click on details link)
    // CATEGORY: SETTINGS
    // OS: P
    USB_DEVICE_DETAILS = 1290;

    // ---- End P Constants, all P constants go above this line ----
    // Add new aosp constants above this line.
    // END OF AOSP CONSTANTS
+4 −0
Original line number Diff line number Diff line
@@ -200,6 +200,10 @@ message SystemMessage {
    // Package: android
    NOTE_CARRIER_NETWORK_AVAILABLE = 46;

    // Inform that USB is configured for Tethering
    // Package: android
    NOTE_USB_TETHER = 47;

    // ADD_NEW_IDS_ABOVE_THIS_LINE
    // Legacy IDs with arbitrary values appear below
    // Legacy IDs existed as stable non-conflicting constants prior to the O release
+16 −8
Original line number Diff line number Diff line
@@ -1072,6 +1072,8 @@ public class UsbDeviceManager implements ActivityManagerInternal.ScreenObserver
            int id = 0;
            int titleRes = 0;
            Resources r = mContext.getResources();
            CharSequence message = r.getText(
                    com.android.internal.R.string.usb_notification_message);
            if (mAudioAccessoryConnected && !mAudioAccessorySupported) {
                titleRes = com.android.internal.R.string.usb_unsupported_audio_accessory_title;
                id = SystemMessage.NOTE_USB_AUDIO_ACCESSORY_NOT_SUPPORTED;
@@ -1085,13 +1087,22 @@ public class UsbDeviceManager implements ActivityManagerInternal.ScreenObserver
                } else if (mCurrentFunctions == UsbManager.FUNCTION_MIDI) {
                    titleRes = com.android.internal.R.string.usb_midi_notification_title;
                    id = SystemMessage.NOTE_USB_MIDI;
                } else if (mCurrentFunctions == UsbManager.FUNCTION_RNDIS) {
                    titleRes = com.android.internal.R.string.usb_tether_notification_title;
                    id = SystemMessage.NOTE_USB_TETHER;
                } else if (mCurrentFunctions == UsbManager.FUNCTION_ACCESSORY) {
                    titleRes = com.android.internal.R.string.usb_accessory_notification_title;
                    id = SystemMessage.NOTE_USB_ACCESSORY;
                } else if (mSourcePower) {
                }
                if (mSourcePower) {
                    if (titleRes != 0) {
                        message = r.getText(
                                com.android.internal.R.string.usb_power_notification_message);
                    } else {
                        titleRes = com.android.internal.R.string.usb_supplying_notification_title;
                        id = SystemMessage.NOTE_USB_SUPPLYING;
                } else {
                    }
                } else if (titleRes == 0) {
                    titleRes = com.android.internal.R.string.usb_charging_notification_title;
                    id = SystemMessage.NOTE_USB_CHARGING;
                }
@@ -1111,7 +1122,6 @@ public class UsbDeviceManager implements ActivityManagerInternal.ScreenObserver
                    mUsbNotificationId = 0;
                }
                if (id != 0) {
                    CharSequence message;
                    CharSequence title = r.getText(titleRes);
                    PendingIntent pi;
                    String channel;
@@ -1121,12 +1131,10 @@ public class UsbDeviceManager implements ActivityManagerInternal.ScreenObserver
                            .usb_unsupported_audio_accessory_title) {
                        Intent intent = Intent.makeRestartActivityTask(
                                new ComponentName("com.android.settings",
                                        "com.android.settings.deviceinfo.UsbModeChooserActivity"));
                                        "com.android.settings.Settings$UsbDetailsActivity"));
                        pi = PendingIntent.getActivityAsUser(mContext, 0,
                                intent, 0, null, UserHandle.CURRENT);
                        channel = SystemNotificationChannels.USB;
                        message = r.getText(
                                com.android.internal.R.string.usb_notification_message);
                    } else {
                        final Intent intent = new Intent();
                        intent.setClassName("com.android.settings",