Merge changes from topic \'substitute-notification-app-name\' into nyc-dev

am: 955009f

* commit '955009f9d384d1b19ebb441814ca0a3fac0fbc47':
  Move EXTRA_SUBSTITUTE_APP_NAME to the published system api.
  Show "Android System" instead of "System UI" in screenshot notifications.

Change-Id: I709f92bda6edd41abd8b22bbee2d4c887cb8dc1c
This commit is contained in:
Dan Sandler
2016-04-25 19:34:48 +00:00
committed by android-build-merger
4 changed files with 16 additions and 4 deletions

View File

@@ -5085,6 +5085,7 @@ package android.app {
field public static final java.lang.String EXTRA_SHOW_CHRONOMETER = "android.showChronometer";
field public static final java.lang.String EXTRA_SHOW_WHEN = "android.showWhen";
field public static final java.lang.String EXTRA_SMALL_ICON = "android.icon";
field public static final java.lang.String EXTRA_SUBSTITUTE_APP_NAME = "android.substName";
field public static final java.lang.String EXTRA_SUB_TEXT = "android.subText";
field public static final java.lang.String EXTRA_SUMMARY_TEXT = "android.summaryText";
field public static final java.lang.String EXTRA_TEMPLATE = "android.template";

View File

@@ -976,10 +976,8 @@ public class Notification implements Parcelable
*/
public static final String EXTRA_CONTAINS_CUSTOM_VIEW = "android.contains.customView";
/**
* @SystemApi
* @hide
*/
/** @hide */
@SystemApi
public static final String EXTRA_SUBSTITUTE_APP_NAME = "android.substName";
private Icon mSmallIcon;

View File

@@ -162,6 +162,9 @@
<!-- It's like, reality, but, you know, virtual -->
<uses-permission android:name="android.permission.ACCESS_VR_MANAGER" />
<!-- the ability to rename notifications posted by other apps -->
<uses-permission android:name="android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME" />
<application
android:name=".SystemUIApplication"
android:persistent="true"

View File

@@ -43,6 +43,7 @@ import android.graphics.Rect;
import android.media.MediaActionSound;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.os.Process;
import android.provider.MediaStore;
@@ -164,6 +165,11 @@ class SaveImageInBackgroundTask extends AsyncTask<Void, Void, Void> {
c.drawColor(overlayColor);
c.setBitmap(null);
// swap "System UI" out for "Android System"
final Bundle extras = new Bundle();
extras.putString(Notification.EXTRA_SUBSTITUTE_APP_NAME,
context.getString(com.android.internal.R.string.android_system_label));
// Show the intermediate notification
mTickerAddSpace = !mTickerAddSpace;
mNotificationManager = nManager;
@@ -180,6 +186,8 @@ class SaveImageInBackgroundTask extends AsyncTask<Void, Void, Void> {
.setSmallIcon(R.drawable.stat_notify_image)
.setCategory(Notification.CATEGORY_PROGRESS)
.setWhen(now)
.setShowWhen(true)
.addExtras(extras)
.setColor(r.getColor(
com.android.internal.R.color.system_notification_accent_color));
@@ -190,6 +198,8 @@ class SaveImageInBackgroundTask extends AsyncTask<Void, Void, Void> {
.setContentText(r.getString(R.string.screenshot_saving_text))
.setSmallIcon(R.drawable.stat_notify_image)
.setWhen(now)
.setShowWhen(true)
.addExtras(extras)
.setColor(r.getColor(com.android.internal.R.color.system_notification_accent_color))
.setStyle(mNotificationStyle)
.setPublicVersion(mPublicNotificationBuilder.build());