summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 f4277ce3917e..a218274481a0 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -4563,11 +4563,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 bfd141e1c082..c97702069210 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -539,10 +539,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 6ca923d3d8d2..df3036ec2d44 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -2549,7 +2549,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 ec5edee94a31..191de7a3593f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBar.java
@@ -1929,9 +1929,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())) {
@@ -7218,24 +7215,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();
}