Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2a0b67d0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Updates copy and contentIntent on AIA notification."

parents 8750eebf 71e15d15
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -2138,14 +2138,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>
+21 −5
Original line number Diff line number Diff line
@@ -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));