From 6a0034a404d7208b65fca01721479a30fc1e0a40 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 --- 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 2879759db5212..b3bf3c859268a 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -3924,7 +3924,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 @@ -3940,11 +3940,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. @@ -3975,7 +3975,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 90c7f1f7ac724..769d4cba5bfa8 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; @@ -207,9 +208,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) @@ -373,8 +376,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());