summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Selim Cinek <cinek@google.com> 2017-07-20 14:06:09 -0700
committer Selim Cinek <cinek@google.com> 2017-07-20 14:16:13 -0700
commit499c20f25d0f6ba03b82a8c4444eabc67f11eb81 (patch)
treed74e404b413d711402a25dd78f29106e640895bf
parent925abb706ecab0300c72cef3c472242a275e72ac (diff)
Removing contents hidden string for public notifications
We're now only showing the notification header instead of the repetitive contents hidden string. On Aod, we're still showing a string however, since without it, it looked too empty. Test: manual, set sensitive setting on lockscreen, observe notifications Change-Id: If2bb66b9b3b366715aa68087e5c35cf1cdff3693 Fixes: 63741232
-rw-r--r--core/java/android/app/Notification.java13
-rw-r--r--core/java/android/view/NotificationHeaderView.java18
-rw-r--r--core/res/res/values/strings.xml5
-rw-r--r--core/res/res/values/symbols.xml1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java21
5 files changed, 26 insertions, 32 deletions
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index 46e597aada56..e31e73f145af 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -4545,11 +4545,16 @@ public class Notification implements Parcelable
savedBundle.getBoolean(EXTRA_SHOW_CHRONOMETER));
publicExtras.putBoolean(EXTRA_CHRONOMETER_COUNT_DOWN,
savedBundle.getBoolean(EXTRA_CHRONOMETER_COUNT_DOWN));
- publicExtras.putCharSequence(EXTRA_TITLE,
- mContext.getString(com.android.internal.R.string.notification_hidden_text));
mN.extras = publicExtras;
- final RemoteViews view = ambient ? makeAmbientNotification()
- : applyStandardTemplate(getBaseLayoutResource());
+ RemoteViews view;
+ if (ambient) {
+ publicExtras.putCharSequence(EXTRA_TITLE,
+ mContext.getString(com.android.internal.R.string.notification_hidden_text));
+ view = makeAmbientNotification();
+ } else{
+ view = makeNotificationHeader(false /* ambient */);
+ view.setBoolean(R.id.notification_header, "setExpandOnlyOnButton", true);
+ }
mN.extras = savedBundle;
mN.mLargeIcon = largeIcon;
mN.largeIcon = largeIconLegacy;
diff --git a/core/java/android/view/NotificationHeaderView.java b/core/java/android/view/NotificationHeaderView.java
index 568c40a02878..580456023d68 100644
--- a/core/java/android/view/NotificationHeaderView.java
+++ b/core/java/android/view/NotificationHeaderView.java
@@ -59,6 +59,7 @@ public class NotificationHeaderView extends ViewGroup {
private Drawable mBackground;
private int mHeaderBackgroundHeight;
private boolean mEntireHeaderClickable;
+ private boolean mExpandOnlyOnButton;
private boolean mAcceptAllTouches;
ViewOutlineProvider mProvider = new ViewOutlineProvider() {
@@ -315,6 +316,7 @@ public class NotificationHeaderView extends ViewGroup {
public class HeaderTouchListener implements View.OnTouchListener {
private final ArrayList<Rect> mTouchRects = new ArrayList<>();
+ private Rect mExpandButtonRect;
private int mTouchSlop;
private boolean mTrackGesture;
private float mDownX;
@@ -326,7 +328,7 @@ public class NotificationHeaderView extends ViewGroup {
public void bindTouchRects() {
mTouchRects.clear();
addRectAroundView(mIcon);
- addRectAroundView(mExpandButton);
+ mExpandButtonRect = addRectAroundView(mExpandButton);
addWidthRect();
mTouchSlop = ViewConfiguration.get(getContext()).getScaledTouchSlop();
}
@@ -340,9 +342,10 @@ public class NotificationHeaderView extends ViewGroup {
mTouchRects.add(r);
}
- private void addRectAroundView(View view) {
+ private Rect addRectAroundView(View view) {
final Rect r = getRectAroundView(view);
mTouchRects.add(r);
+ return r;
}
private Rect getRectAroundView(View view) {
@@ -395,6 +398,9 @@ public class NotificationHeaderView extends ViewGroup {
if (mAcceptAllTouches) {
return true;
}
+ if (mExpandOnlyOnButton) {
+ return mExpandButtonRect.contains((int) x, (int) y);
+ }
for (int i = 0; i < mTouchRects.size(); i++) {
Rect r = mTouchRects.get(i);
if (r.contains((int) x, (int) y)) {
@@ -440,4 +446,12 @@ public class NotificationHeaderView extends ViewGroup {
public void setAcceptAllTouches(boolean acceptAllTouches) {
mAcceptAllTouches = mEntireHeaderClickable || acceptAllTouches;
}
+
+ /**
+ * Sets whether only the expand icon itself should serve as the expand target.
+ */
+ @RemotableViewMethod
+ public void setExpandOnlyOnButton(boolean expandOnlyOnButton) {
+ mExpandOnlyOnButton = expandOnlyOnButton;
+ }
}
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index bd8e14ea4127..46d784df9c3e 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -591,10 +591,7 @@
<string name="notification_header_divider_symbol_with_spaces" 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>
-
- <!-- Text shown in place of notification contents when the notification is hidden by policy on a secure lockscreen -->
- <string name="notification_hidden_by_policy_text">Contents hidden by policy</string>
+ <string name="notification_hidden_text">New notification</string>
<!-- Text shown when viewing channel settings for notifications related to the virtual keyboard -->
<string name="notification_channel_virtual_keyboard">Virtual keyboard</string>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 58c653b3e5a6..32825a60a5d8 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2560,7 +2560,6 @@
<java-symbol type="id" name="notification_material_reply_text_3" />
<java-symbol type="string" name="notification_hidden_text" />
- <java-symbol type="string" name="notification_hidden_by_policy_text" />
<java-symbol type="id" name="app_name_text" />
<java-symbol type="id" name="header_text" />
<java-symbol type="id" name="expand_button" />
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
index 23969f985e32..c956f5ebe53a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -1925,9 +1925,6 @@ public class StatusBar extends SystemUI implements DemoMode,
boolean sensitive = userPublic && needsRedaction;
boolean deviceSensitive = devicePublic
&& !userAllowsPrivateNotificationsInPublic(mCurrentUserId);
- if (sensitive) {
- updatePublicContentView(ent, ent.notification);
- }
ent.row.setSensitive(sensitive, deviceSensitive);
ent.row.setNeedsRedaction(needsRedaction);
if (mGroupManager.isChildInGroupWithSummary(ent.row.getStatusBarNotification())) {
@@ -7183,24 +7180,6 @@ public class StatusBar extends SystemUI implements DemoMode,
setAreThereNotifications();
}
- protected void updatePublicContentView(Entry entry,
- StatusBarNotification sbn) {
- final RemoteViews publicContentView = entry.cachedPublicContentView;
- View inflatedView = entry.getPublicContentView();
- if (entry.autoRedacted && publicContentView != null && inflatedView != null) {
- final boolean disabledByPolicy =
- !adminAllowsUnredactedNotifications(entry.notification.getUserId());
- String notificationHiddenText = mContext.getString(disabledByPolicy
- ? com.android.internal.R.string.notification_hidden_by_policy_text
- : com.android.internal.R.string.notification_hidden_text);
- TextView titleView = (TextView) inflatedView.findViewById(android.R.id.title);
- if (titleView != null
- && !titleView.getText().toString().equals(notificationHiddenText)) {
- titleView.setText(notificationHiddenText);
- }
- }
- }
-
protected void notifyHeadsUpScreenOff() {
maybeEscalateHeadsUp();
}