diff options
| author | 2018-09-21 09:46:28 -0400 | |
|---|---|---|
| committer | 2018-09-21 11:12:21 -0400 | |
| commit | 71e15d15c0e421adc46f008ac08d866d2fbd3bb6 (patch) | |
| tree | 03f29ec6a21f43cad2a9f1d1e9c0953e16e37125 | |
| parent | 7ba1d9bbd1c315b460a5013c31ffa685dc6fa78c (diff) | |
Updates copy and contentIntent on AIA notification.
Test: manually
Bug: 36989738
Change-Id: I769df6d70a4e5482a61bdfd020545b562478ec88
| -rw-r--r-- | packages/SystemUI/res/values/strings.xml | 15 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java | 26 |
2 files changed, 33 insertions, 8 deletions
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 36f97cd64642..2748687bd9b8 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -2132,14 +2132,23 @@ <!-- App label of the instant apps notification [CHAR LIMIT=60] --> <string name="instant_apps">Instant Apps</string> - <!-- Message of the instant apps notification indicating they don't need install [CHAR LIMIT=NONE] --> - <string name="instant_apps_message">Instant apps don\'t require installation.</string> + <!-- Title of notification indicating that an instant app is running. [CHAR LIMIT=60] --> + <string name="instant_apps_title"><xliff:g id="app" example="Gmail">%1$s</xliff:g> running</string> + + <!-- Message of the instant apps notification indicating they don't need install. [CHAR LIMIT=NONE] --> + <string name="instant_apps_message">App opened without being installed.</string> + + <!-- Message of the instant apps notification indicating they don't need install, plus a link to more information. [CHAR LIMIT=NONE] --> + <string name="instant_apps_message_with_help">App opened without being installed. Tap to learn more.</string> + + <!-- URL of the webpage that explains instant apps. --> + <string name="instant_apps_help_url" translatable="false"></string> <!-- Action label for launching app info on the specified app [CHAR LIMIT=20] --> <string name="app_info">App info</string> <!-- Action label for switching to a browser for an instant app [CHAR LIMIT=20] --> - <string name="go_to_web">Go to browser</string> + <string name="go_to_web">Go to web</string> <!-- Quick settings tile for toggling mobile data [CHAR LIMIT=20] --> <string name="mobile_data">Mobile data</string> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java index a900c14b2007..1afdc66b9227 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarPolicy.java @@ -595,16 +595,29 @@ public class PhoneStatusBarPolicy implements Callback, Callbacks, extras.putString(Notification.EXTRA_SUBSTITUTE_APP_NAME, mContext.getString(R.string.instant_apps)); mCurrentNotifs.add(new Pair<>(pkg, userId)); - String message = mContext.getString(R.string.instant_apps_message); + + String helpUrl = mContext.getString(R.string.instant_apps_help_url); + boolean hasHelpUrl = !helpUrl.isEmpty(); + String message = mContext.getString(hasHelpUrl + ? R.string.instant_apps_message_with_help + : R.string.instant_apps_message); + UserHandle user = UserHandle.of(userId); PendingIntent appInfoAction = PendingIntent.getActivityAsUser(mContext, 0, new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS) .setData(Uri.fromParts("package", pkg, null)), 0, null, user); Action action = new Notification.Action.Builder(null, mContext.getString(R.string.app_info), appInfoAction).build(); + PendingIntent helpCenterIntent = hasHelpUrl + ? PendingIntent.getActivityAsUser(mContext, 0, + new Intent(Intent.ACTION_VIEW).setData(Uri.parse( + helpUrl)), + 0, null, user) + : null; Intent browserIntent = getTaskIntent(taskId, userId); - Notification.Builder builder = new Notification.Builder(mContext, NotificationChannels.GENERAL); + Notification.Builder builder = new Notification.Builder(mContext, + NotificationChannels.GENERAL); if (browserIntent != null && browserIntent.isWebIntent()) { // Make sure that this doesn't resolve back to an instant app browserIntent.setComponent(null) @@ -632,7 +645,8 @@ public class PhoneStatusBarPolicy implements Callback, Callbacks, PendingIntent webPendingIntent = PendingIntent.getActivityAsUser(mContext, 0, goToWebIntent, 0, null, user); - Action webAction = new Notification.Action.Builder(null, mContext.getString(R.string.go_to_web), + Action webAction = new Notification.Action.Builder(null, + mContext.getString(R.string.go_to_web), webPendingIntent).build(); builder.addAction(webAction); } @@ -640,13 +654,15 @@ public class PhoneStatusBarPolicy implements Callback, Callbacks, noMan.notifyAsUser(pkg, SystemMessage.NOTE_INSTANT_APPS, builder .addExtras(extras) .addAction(action) - .setContentIntent(appInfoAction) + .setContentIntent(helpCenterIntent) .setColor(mContext.getColor(R.color.instant_apps_color)) - .setContentTitle(appInfo.loadLabel(mContext.getPackageManager())) + .setContentTitle(mContext.getString(R.string.instant_apps_title, + appInfo.loadLabel(mContext.getPackageManager()))) .setLargeIcon(Icon.createWithResource(pkg, appInfo.icon)) .setSmallIcon(Icon.createWithResource(mContext.getPackageName(), R.drawable.instant_icon)) .setContentText(message) + .setStyle(new Notification.BigTextStyle().bigText(message)) .setOngoing(true) .build(), new UserHandle(userId)); |