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 6a0034a404)
Merged-In: Ib01f94cc37279800d23c1bbe71a0abde51624dcd
This commit is contained in:
sayakiitg
2022-01-12 13:08:03 +00:00
committed by Sayak Dutta
parent cd981b3681
commit c260f56e6a
3 changed files with 12 additions and 9 deletions

View File

@@ -19,6 +19,6 @@ Copyright (C) 2015 The Android Open Source Project
android:viewportWidth="48.0"
android:viewportHeight="48.0">
<path
android:fillColor="#FF000000"
android:fillColor="?android:attr/colorAccent"
android:pathData="M36 4H20L8.04 16 8 40c0 2.2 1.8 4 4 4h24c2.2 0 4,-1.8 4,-4V8c0,-2.2,-1.8,-4,-4,-4zM24 16h-4V8h4v8zm6 0h-4V8h4v8zm6 0h-4V8h4v8z"/>
</vector>

View File

@@ -3974,7 +3974,7 @@
<string name="ext_media_new_notification_message" product="automotive">You may need to reformat the device. Tap to eject.</string>
<!-- Notification body when external media is ready for use [CHAR LIMIT=NONE] -->
<string name="ext_media_ready_notification_message">For transferring photos and media</string>
<string name="ext_media_ready_notification_message">For storing photos, videos, music and more</string>
<!-- TV specific notification body when external media is ready for use [CHAR LIMIT=75] -->
<string name="ext_media_ready_notification_message" product="tv">Browse media files</string>
@@ -3990,11 +3990,11 @@
<string name="ext_media_unmountable_notification_message" product="automotive">You may need to reformat the device. Tap to eject.</string>
<!-- Notification title when external media is unsupported [CHAR LIMIT=30] -->
<string name="ext_media_unsupported_notification_title">Unsupported <xliff:g id="name" example="SD card">%s</xliff:g></string>
<string name="ext_media_unsupported_notification_title"><xliff:g id="name" example="SD card">%s</xliff:g> detected </string>
<!-- Automotive specific notification title when external media is unsupported [CHAR LIMIT=30] -->
<string name="ext_media_unsupported_notification_title" product="automotive"><xliff:g id="name" example="SD card">%s</xliff:g> isn\u2019t working</string>
<!-- Notification body when external media is unsupported [CHAR LIMIT=NONE] -->
<string name="ext_media_unsupported_notification_message">This device doesn\u2019t support this <xliff:g id="name" example="SD card">%s</xliff:g>. Tap to set up in a supported format.</string>
<string name="ext_media_unsupported_notification_message">Tap to set up .</string>
<!-- TV-specific notification body when external media is unsupported [CHAR LIMIT=75] -->
<string name="ext_media_unsupported_notification_message" product="tv">Select to set up <xliff:g id="name" example="SD card">%s</xliff:g> in a supported format.</string>
<!-- Automotive specific notification body when external media is unsupported [CHAR LIMIT=NONE] -->
@@ -4025,7 +4025,7 @@
<!-- Notification action to transfer media [CHAR LIMIT=40] -->
<string name="ext_media_seamless_action">Switch output</string>
<!-- Notification title when external media is missing [CHAR LIMIT=30] -->
<!-- Notification title when adoptable storage media is ejected [CHAR LIMIT=30] -->
<string name="ext_media_missing_title"><xliff:g id="name" example="SD card">%s</xliff:g> missing</string>
<!-- Notification body when external media is missing [CHAR LIMIT=30] -->
<string name="ext_media_missing_message">Insert device again</string>

View File

@@ -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());