From 71e15d15c0e421adc46f008ac08d866d2fbd3bb6 Mon Sep 17 00:00:00 2001 From: Gus Prevas Date: Fri, 21 Sep 2018 09:46:28 -0400 Subject: Updates copy and contentIntent on AIA notification. Test: manually Bug: 36989738 Change-Id: I769df6d70a4e5482a61bdfd020545b562478ec88 --- packages/SystemUI/res/values/strings.xml | 15 ++++++++++--- .../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 @@ Instant Apps - - Instant apps don\'t require installation. + + %1$s running + + + App opened without being installed. + + + App opened without being installed. Tap to learn more. + + + App info - Go to browser + Go to web Mobile data 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)); -- cgit v1.2.3-59-g8ed1b