From c260f56e6a71e5b88649e30e3e4292fac30fbe0e Mon Sep 17 00:00:00 2001 From: sayakiitg Date: Wed, 12 Jan 2022 13:08:03 +0000 Subject: [PATCH] Improve notification message Improve the language of system notification when user ejects SD card in adoptable storage so that it can be conveyed to the user as to why it is bad Test: Manual testing on Jiophone next device Screenshot: https://screenshot.googleplex.com/rfuZu4sk2Kinob9.png Bug: 201252175 Change-Id: Ib01f94cc37279800d23c1bbe71a0abde51624dcd (cherry picked from commit 6a0034a404d7208b65fca01721479a30fc1e0a40) Merged-In: Ib01f94cc37279800d23c1bbe71a0abde51624dcd --- core/res/res/drawable/ic_sd_card_48dp.xml | 2 +- core/res/res/values/strings.xml | 8 ++++---- .../com/android/systemui/usb/StorageNotification.java | 11 +++++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/core/res/res/drawable/ic_sd_card_48dp.xml b/core/res/res/drawable/ic_sd_card_48dp.xml index 90bab47c03044..10fd120548201 100644 --- a/core/res/res/drawable/ic_sd_card_48dp.xml +++ b/core/res/res/drawable/ic_sd_card_48dp.xml @@ -19,6 +19,6 @@ Copyright (C) 2015 The Android Open Source Project android:viewportWidth="48.0" android:viewportHeight="48.0"> diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index e3b7100637210..b72e74b9fef31 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -3974,7 +3974,7 @@ You may need to reformat the device. Tap to eject. - For transferring photos and media + For storing photos, videos, music and more Browse media files @@ -3990,11 +3990,11 @@ You may need to reformat the device. Tap to eject. - Unsupported %s + %s detected %s isn\u2019t working - This device doesn\u2019t support this %s. Tap to set up in a supported format. + Tap to set up . Select to set up %s in a supported format. @@ -4025,7 +4025,7 @@ Switch output - + %s missing Insert device again diff --git a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java index 345fc99f8a547..4dc78f9ec8a6f 100644 --- a/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java +++ b/packages/SystemUI/src/com/android/systemui/usb/StorageNotification.java @@ -21,6 +21,7 @@ import android.app.Notification; import android.app.Notification.Action; import android.app.NotificationManager; import android.app.PendingIntent; +import android.app.ActivityManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; @@ -215,9 +216,11 @@ public class StorageNotification extends CoreStartable { } else { // Boo, annoy the user to reinsert the private volume - final CharSequence title = mContext.getString(R.string.ext_media_missing_title, + final CharSequence title = + mContext.getString(R.string.ext_media_missing_title, rec.getNickname()); - final CharSequence text = mContext.getString(R.string.ext_media_missing_message); + final CharSequence text = + mContext.getString(R.string.ext_media_missing_message); Notification.Builder builder = new Notification.Builder(mContext, NotificationChannels.STORAGE) @@ -381,8 +384,8 @@ public class StorageNotification extends CoreStartable { if (rec.isSnoozed() && disk.isAdoptable()) { return null; } - - if (disk.isAdoptable() && !rec.isInited()) { + if (disk.isAdoptable() && !rec.isInited() && rec.getType() != VolumeInfo.TYPE_PUBLIC + && rec.getType() != VolumeInfo.TYPE_PRIVATE) { final CharSequence title = disk.getDescription(); final CharSequence text = mContext.getString( R.string.ext_media_new_notification_message, disk.getDescription());