From 3f287f25c9333142178c15bc4d8f980d0da53871 Mon Sep 17 00:00:00 2001 From: Agatha Man Date: Thu, 26 Mar 2020 09:53:56 -0700 Subject: [PATCH] Remove unsupported and unmountable intent for automotive devices The automotive car settings does not have handlers to fix unsupported and unmountable usb devices and other storage notification actions. This change will notify the user that the usb drive is unsupported or unmountable with no actionables and temporarily remove pending intent for other notifications. Bug: 151671685 Test: Manual with unsupported usb drive Change-Id: I0f5b39bdc56ce4bf7598a0662ea6f9df5efc3afb --- core/res/res/values/strings.xml | 8 ++++++- .../systemui/usb/StorageNotification.java | 23 +++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 06f776013233e..e650155501693 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -3597,6 +3597,8 @@ New %s Tap to set up + + For transferring photos and media @@ -3605,8 +3607,10 @@ Issue with %s Tap to fix - + %s is corrupt. Select to fix. + + Unsupported %s @@ -3614,6 +3618,8 @@ This device doesn\u2019t support this %s. Tap to set up in a supported format. This device doesn\u2019t support this %s. Select to set up in a supported format. + + This device doesn\u2019t support this %s. %s unexpectedly removed diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java index 11885c55b51d7..442c7eaae7296 100644 --- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java +++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java @@ -187,8 +187,9 @@ public class StorageNotification extends SystemUI { } private void updateMissingPrivateVolumes() { - if (isTv()) { + if (isTv() || isAutomotive()) { // On TV, TvSettings displays a modal full-screen activity in this case. + // Not applicable for automotive. return; } @@ -595,6 +596,9 @@ public class StorageNotification extends SystemUI { if (isTv()) { intent.setPackage("com.android.tv.settings"); intent.setAction("com.android.tv.settings.action.NEW_STORAGE"); + } else if (isAutomotive()) { + // TODO(b/151671685): add intent to handle unsupported usb + return null; } else { intent.setClassName("com.android.settings", "com.android.settings.deviceinfo.StorageWizardInit"); @@ -611,6 +615,9 @@ public class StorageNotification extends SystemUI { if (isTv()) { intent.setPackage("com.android.tv.settings"); intent.setAction("com.android.tv.settings.action.NEW_STORAGE"); + } else if (isAutomotive()) { + // TODO(b/151671685): add intent to handle unmountable usb + return null; } else { intent.setClassName("com.android.settings", "com.android.settings.deviceinfo.StorageWizardInit"); @@ -669,6 +676,9 @@ public class StorageNotification extends SystemUI { if (isTv()) { intent.setPackage("com.android.tv.settings"); intent.setAction(Settings.ACTION_INTERNAL_STORAGE_SETTINGS); + } else if (isAutomotive()) { + // TODO(b/151671685): add volume settings intent for automotive + return null; } else { switch (vol.getType()) { case VolumeInfo.TYPE_PRIVATE: @@ -700,7 +710,7 @@ public class StorageNotification extends SystemUI { } private PendingIntent buildForgetPendingIntent(VolumeRecord rec) { - // Not used on TV + // Not used on TV and Automotive final Intent intent = new Intent(); intent.setClassName("com.android.settings", "com.android.settings.Settings$PrivateVolumeForgetActivity"); @@ -716,6 +726,9 @@ public class StorageNotification extends SystemUI { if (isTv()) { intent.setPackage("com.android.tv.settings"); intent.setAction("com.android.tv.settings.action.MIGRATE_STORAGE"); + } else if (isAutomotive()) { + // TODO(b/151671685): add storage migrate intent for automotive + return null; } else { intent.setClassName("com.android.settings", "com.android.settings.deviceinfo.StorageWizardMigrateProgress"); @@ -735,6 +748,9 @@ public class StorageNotification extends SystemUI { if (isTv()) { intent.setPackage("com.android.tv.settings"); intent.setAction("com.android.tv.settings.action.MOVE_APP"); + } else if (isAutomotive()) { + // TODO(b/151671685): add storage move intent for automotive + return null; } else { intent.setClassName("com.android.settings", "com.android.settings.deviceinfo.StorageWizardMoveProgress"); @@ -750,6 +766,9 @@ public class StorageNotification extends SystemUI { if (isTv()) { intent.setPackage("com.android.tv.settings"); intent.setAction(Settings.ACTION_INTERNAL_STORAGE_SETTINGS); + } else if (isAutomotive()) { + // TODO(b/151671685): add storage ready intent for automotive + return null; } else { intent.setClassName("com.android.settings", "com.android.settings.deviceinfo.StorageWizardReady");