summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Selim Cinek <cinek@google.com> 2016-01-28 16:21:08 -0800
committer Selim Cinek <cinek@google.com> 2016-01-28 19:02:22 -0800
commit757d879966fdbff1b67c9ec6fd4b6c75152b991a (patch)
treec7e340311f4c39e6d9e91d533361d061414694aa
parentfdc738f9b8ecdfb11b65c2e4fe0b9c14aee0a626 (diff)
Fixed a bug where the notification became clearable
A notification could become clearable on the lockscreen when the content was sensitive even though that shouldn't have happend. This is now fixed. Change-Id: I50f31c95dd399bfebfa9e5c46eb99820f31e37ff
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java46
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java8
2 files changed, 23 insertions, 31 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 240d32ec95bb..017112874b53 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -18,7 +18,6 @@ package com.android.systemui.statusbar;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
-import android.animation.TimeInterpolator;
import android.app.ActivityManager;
import android.app.ActivityManagerNative;
import android.app.Notification;
@@ -76,7 +75,6 @@ import android.view.ViewParent;
import android.view.WindowManager;
import android.view.WindowManagerGlobal;
import android.view.accessibility.AccessibilityManager;
-import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.RemoteViews;
import android.widget.TextView;
@@ -86,7 +84,6 @@ import com.android.internal.logging.MetricsLogger;
import com.android.internal.logging.MetricsProto.MetricsEvent;
import com.android.internal.statusbar.IStatusBarService;
import com.android.internal.statusbar.StatusBarIcon;
-import com.android.internal.util.NotificationColorUtil;
import com.android.internal.widget.LockPatternUtils;
import com.android.keyguard.KeyguardUpdateMonitor;
import com.android.systemui.DejankUtils;
@@ -828,30 +825,25 @@ public abstract class BaseStatusBar extends SystemUI implements
}
}
- protected View updateNotificationVetoButton(View row, StatusBarNotification n) {
+ protected View bindVetoButtonClickListener(View row, StatusBarNotification n) {
View vetoButton = row.findViewById(R.id.veto);
- if (n.isClearable()) {
- final String _pkg = n.getPackageName();
- final String _tag = n.getTag();
- final int _id = n.getId();
- final int _userId = n.getUserId();
- vetoButton.setOnClickListener(new View.OnClickListener() {
- public void onClick(View v) {
- // Accessibility feedback
- v.announceForAccessibility(
- mContext.getString(R.string.accessibility_notification_dismissed));
- try {
- mBarService.onNotificationClear(_pkg, _tag, _id, _userId);
+ final String _pkg = n.getPackageName();
+ final String _tag = n.getTag();
+ final int _id = n.getId();
+ final int _userId = n.getUserId();
+ vetoButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View v) {
+ // Accessibility feedback
+ v.announceForAccessibility(
+ mContext.getString(R.string.accessibility_notification_dismissed));
+ try {
+ mBarService.onNotificationClear(_pkg, _tag, _id, _userId);
- } catch (RemoteException ex) {
- // system process is dead if we're here.
- }
- }
- });
- vetoButton.setVisibility(View.VISIBLE);
- } else {
- vetoButton.setVisibility(View.GONE);
- }
+ } catch (RemoteException ex) {
+ // system process is dead if we're here.
+ }
+ }
+ });
vetoButton.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO);
return vetoButton;
}
@@ -1370,7 +1362,7 @@ public abstract class BaseStatusBar extends SystemUI implements
}
workAroundBadLayerDrawableOpacity(row);
- View vetoButton = updateNotificationVetoButton(row, sbn);
+ View vetoButton = bindVetoButtonClickListener(row, sbn);
vetoButton.setContentDescription(mContext.getString(
R.string.accessibility_remove_notification));
@@ -2010,7 +2002,7 @@ public abstract class BaseStatusBar extends SystemUI implements
// Update the veto button accordingly (and as a result, whether this row is
// swipe-dismissable)
- updateNotificationVetoButton(entry.row, notification);
+ bindVetoButtonClickListener(entry.row, notification);
if (DEBUG) {
// Is this for you?
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
index 6fae3abb513f..7f1316fe2de7 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java
@@ -28,7 +28,6 @@ import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.NotificationHeaderView;
import android.view.View;
-import android.view.ViewGroup;
import android.view.ViewStub;
import android.view.accessibility.AccessibilityEvent;
import android.widget.Chronometer;
@@ -212,7 +211,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
mStatusBarNotification = entry.notification;
mPrivateLayout.onNotificationUpdated(entry);
mPublicLayout.onNotificationUpdated(entry);
- updateVetoButton();
+ mShowingPublicInitialized = false;
+ updateClearability();
if (mIsSummaryWithChildren) {
recreateNotificationHeader();
}
@@ -911,7 +911,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
}
mPrivateLayout.updateExpandButtons(isExpandable());
- updateVetoButton();
+ updateClearability();
mShowingPublicInitialized = true;
}
@@ -947,7 +947,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView {
}
}
- private void updateVetoButton() {
+ private void updateClearability() {
// public versions cannot be dismissed
mVetoButton.setVisibility(isClearable() && !mShowingPublic ? View.VISIBLE : View.GONE);
}