Fixed the public notifications views on the lockscreen
The views were based on a legacy systemUI notification.
We are now creating it in Notification.java in order to
always have the latest visuals and avoiding duplicate work.
Change-Id: I3f544cad069a8eab34d4464404d020e06d7f6626
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 620ab50..15967c8 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -3312,6 +3312,37 @@
return applyStandardTemplateWithActions(getBigBaseLayoutResource());
}
+ /**
+ * Construct a RemoteViews for the display in public contexts like on the lockscreen.
+ *
+ * @hide
+ */
+ public RemoteViews makePublicContentView() {
+ if (mN.publicVersion != null) {
+ final Builder builder = recoverBuilder(mContext, mN.publicVersion);
+ return builder.makeContentView();
+ }
+ Bundle savedBundle = mN.extras;
+ Style style = mStyle;
+ mStyle = null;
+ Icon largeIcon = mN.mLargeIcon;
+ mN.mLargeIcon = null;
+ Bundle publicExtras = new Bundle();
+ publicExtras.putBoolean(EXTRA_SHOW_WHEN,
+ savedBundle.getBoolean(EXTRA_SHOW_WHEN));
+ publicExtras.putBoolean(EXTRA_SHOW_CHRONOMETER,
+ savedBundle.getBoolean(EXTRA_SHOW_CHRONOMETER));
+ publicExtras.putCharSequence(EXTRA_TITLE,
+ mContext.getString(R.string.notification_hidden_text));
+ mN.extras = publicExtras;
+ final RemoteViews publicView = applyStandardTemplate(getBaseLayoutResource());
+ mN.extras = savedBundle;
+ mN.mLargeIcon = largeIcon;
+ mStyle = style;
+ return publicView;
+ }
+
+
private RemoteViews generateActionButton(Action action) {
final boolean tombstone = (action.actionIntent == null);
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index a127d94..595ef54 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -537,6 +537,9 @@
<!-- The divider symbol between different parts of the notification header. not translatable [CHAR LIMIT=1] -->
<string name="notification_header_divider_symbol" translatable="false">•</string>
+ <!-- Text shown in place of notification contents when the notification is hidden on a secure lockscreen -->
+ <string name="notification_hidden_text">Contents hidden</string>
+
<!-- Displayed to the user to tell them that they have started up the phone in "safe mode" -->
<string name="safeMode">Safe mode</string>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 3ee1ca9..1f398e1 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2362,6 +2362,7 @@
<java-symbol type="id" name="deleteButton" />
<java-symbol type="string" name="notification_children_count_bracketed" />
+ <java-symbol type="string" name="notification_hidden_text" />
<java-symbol type="id" name="app_name_text" />
<java-symbol type="id" name="number_of_children" />
<java-symbol type="id" name="header_sub_text" />