summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/InputDevices/res/values-es/strings.xml2
-rw-r--r--packages/InputDevices/res/values-hr/strings.xml10
-rw-r--r--packages/InputDevices/res/values-zu/strings.xml2
-rw-r--r--packages/SystemUI/res/layout/status_bar_toggle_slider.xml2
-rw-r--r--packages/SystemUI/res/values/strings.xml8
-rw-r--r--packages/SystemUI/src/com/android/systemui/settings/ToggleSeekBar.java45
-rw-r--r--packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java98
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java27
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.java119
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java92
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java4
12 files changed, 300 insertions, 116 deletions
diff --git a/packages/InputDevices/res/values-es/strings.xml b/packages/InputDevices/res/values-es/strings.xml
index 8cb01c1..5dc85a0 100644
--- a/packages/InputDevices/res/values-es/strings.xml
+++ b/packages/InputDevices/res/values-es/strings.xml
@@ -38,5 +38,5 @@
<string name="keyboard_layout_greek" msgid="7289253560162386040">"Griego"</string>
<string name="keyboard_layout_hebrew" msgid="7241473985890173812">"Hebreo"</string>
<string name="keyboard_layout_lithuanian" msgid="6943110873053106534">"Lituano"</string>
- <string name="keyboard_layout_spanish_latin" msgid="5690539836069535697">"Español (latino)"</string>
+ <string name="keyboard_layout_spanish_latin" msgid="5690539836069535697">"Español (Latinoamérica)"</string>
</resources>
diff --git a/packages/InputDevices/res/values-hr/strings.xml b/packages/InputDevices/res/values-hr/strings.xml
index 0f83293..512ffd7 100644
--- a/packages/InputDevices/res/values-hr/strings.xml
+++ b/packages/InputDevices/res/values-hr/strings.xml
@@ -34,9 +34,9 @@
<string name="keyboard_layout_slovenian" msgid="1735933028924982368">"slovenska"</string>
<string name="keyboard_layout_turkish" msgid="7736163250907964898">"turska"</string>
<string name="keyboard_layout_ukrainian" msgid="8176637744389480417">"ukrajinska"</string>
- <string name="keyboard_layout_arabic" msgid="5671970465174968712">"Arapski"</string>
- <string name="keyboard_layout_greek" msgid="7289253560162386040">"Grčki"</string>
- <string name="keyboard_layout_hebrew" msgid="7241473985890173812">"Hebrejski"</string>
- <string name="keyboard_layout_lithuanian" msgid="6943110873053106534">"Litavski"</string>
- <string name="keyboard_layout_spanish_latin" msgid="5690539836069535697">"Španjolski (Latinska Amerika)"</string>
+ <string name="keyboard_layout_arabic" msgid="5671970465174968712">"arapski"</string>
+ <string name="keyboard_layout_greek" msgid="7289253560162386040">"grčki"</string>
+ <string name="keyboard_layout_hebrew" msgid="7241473985890173812">"hebrejski"</string>
+ <string name="keyboard_layout_lithuanian" msgid="6943110873053106534">"litavski"</string>
+ <string name="keyboard_layout_spanish_latin" msgid="5690539836069535697">"španjolski (Latinska Amerika)"</string>
</resources>
diff --git a/packages/InputDevices/res/values-zu/strings.xml b/packages/InputDevices/res/values-zu/strings.xml
index 2cdfe52..3e4ad67 100644
--- a/packages/InputDevices/res/values-zu/strings.xml
+++ b/packages/InputDevices/res/values-zu/strings.xml
@@ -34,7 +34,7 @@
<string name="keyboard_layout_slovenian" msgid="1735933028924982368">"Isi-Slovenian"</string>
<string name="keyboard_layout_turkish" msgid="7736163250907964898">"Isi-Turkish"</string>
<string name="keyboard_layout_ukrainian" msgid="8176637744389480417">"Isi-Ukrainian"</string>
- <string name="keyboard_layout_arabic" msgid="5671970465174968712">"I-Arabhu"</string>
+ <string name="keyboard_layout_arabic" msgid="5671970465174968712">"Isi-Arabic"</string>
<string name="keyboard_layout_greek" msgid="7289253560162386040">"Isi-Greek"</string>
<string name="keyboard_layout_hebrew" msgid="7241473985890173812">"Isi-Hebrew"</string>
<string name="keyboard_layout_lithuanian" msgid="6943110873053106534">"Isi-Lithuanian"</string>
diff --git a/packages/SystemUI/res/layout/status_bar_toggle_slider.xml b/packages/SystemUI/res/layout/status_bar_toggle_slider.xml
index 834cc2c..e6d7c93 100644
--- a/packages/SystemUI/res/layout/status_bar_toggle_slider.xml
+++ b/packages/SystemUI/res/layout/status_bar_toggle_slider.xml
@@ -29,7 +29,7 @@
android:layout_alignParentBottom="true"
android:button="@null"
/>
- <SeekBar
+ <com.android.systemui.settings.ToggleSeekBar
android:id="@+id/slider"
android:layout_width="0dp"
android:layout_height="wrap_content"
diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml
index ce05639..ad10545 100644
--- a/packages/SystemUI/res/values/strings.xml
+++ b/packages/SystemUI/res/values/strings.xml
@@ -526,4 +526,12 @@
<string name="description_direction_up">Slide up for <xliff:g id="target_description" example="Unlock">%s</xliff:g>.</string>
<!-- Description of the left direction in which one can to slide the handle in the Slide unlock screen. [CHAR LIMIT=NONE] -->
<string name="description_direction_left">"Slide left for <xliff:g id="target_description" example="Unlock">%s</xliff:g>.</string>
+
+ <!-- Zen mode: Summary notification content title. [CHAR LIMIT=NONE] -->
+ <plurals name="zen_mode_notification_title">
+ <item quantity="one">Notification hidden</item>
+ <item quantity="other">%d notifications hidden</item>
+ </plurals>
+ <!-- Zen mode: Summary notification content text. [CHAR LIMIT=NONE] -->
+ <string name="zen_mode_notification_text">Touch to show</string>
</resources>
diff --git a/packages/SystemUI/src/com/android/systemui/settings/ToggleSeekBar.java b/packages/SystemUI/src/com/android/systemui/settings/ToggleSeekBar.java
new file mode 100644
index 0000000..a0a5561
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/settings/ToggleSeekBar.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.settings;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.MotionEvent;
+import android.widget.SeekBar;
+
+public class ToggleSeekBar extends SeekBar {
+ public ToggleSeekBar(Context context) {
+ super(context);
+ }
+
+ public ToggleSeekBar(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public ToggleSeekBar(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ @Override
+ public boolean onTouchEvent(MotionEvent event) {
+ if (!isEnabled()) {
+ setEnabled(true);
+ }
+
+ return super.onTouchEvent(event);
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java b/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java
index c99f691..7d38058 100644
--- a/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java
+++ b/packages/SystemUI/src/com/android/systemui/settings/ToggleSlider.java
@@ -19,20 +19,18 @@ package com.android.systemui.settings;
import android.content.Context;
import android.content.res.Resources;
import android.content.res.TypedArray;
-import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.CompoundButton;
+import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.RelativeLayout;
import android.widget.SeekBar;
+import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
import com.android.systemui.R;
-public class ToggleSlider extends RelativeLayout
- implements CompoundButton.OnCheckedChangeListener, SeekBar.OnSeekBarChangeListener {
- private static final String TAG = "StatusBar.ToggleSlider";
-
+public class ToggleSlider extends RelativeLayout {
public interface Listener {
public void onInit(ToggleSlider v);
public void onChanged(ToggleSlider v, boolean tracking, boolean checked, int value);
@@ -55,20 +53,21 @@ public class ToggleSlider extends RelativeLayout
public ToggleSlider(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
+
View.inflate(context, R.layout.status_bar_toggle_slider, this);
final Resources res = context.getResources();
- TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ToggleSlider,
- defStyle, 0);
+ final TypedArray a = context.obtainStyledAttributes(
+ attrs, R.styleable.ToggleSlider, defStyle, 0);
- mToggle = (CompoundButton)findViewById(R.id.toggle);
- mToggle.setOnCheckedChangeListener(this);
- mToggle.setBackgroundDrawable(res.getDrawable(R.drawable.status_bar_toggle_button));
+ mToggle = (CompoundButton) findViewById(R.id.toggle);
+ mToggle.setOnCheckedChangeListener(mCheckListener);
+ mToggle.setBackground(res.getDrawable(R.drawable.status_bar_toggle_button));
- mSlider = (SeekBar)findViewById(R.id.slider);
- mSlider.setOnSeekBarChangeListener(this);
+ mSlider = (SeekBar) findViewById(R.id.slider);
+ mSlider.setOnSeekBarChangeListener(mSeekListener);
- mLabel = (TextView)findViewById(R.id.label);
+ mLabel = (TextView) findViewById(R.id.label);
mLabel.setText(a.getString(R.styleable.ToggleSlider_text));
a.recycle();
@@ -82,35 +81,6 @@ public class ToggleSlider extends RelativeLayout
}
}
- public void onCheckedChanged(CompoundButton toggle, boolean checked) {
- mSlider.setEnabled(checked);
-
- if (mListener != null) {
- mListener.onChanged(this, mTracking, checked, mSlider.getProgress());
- }
- }
-
- public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
- if (mListener != null) {
- mListener.onChanged(this, mTracking, mToggle.isChecked(), progress);
- }
- }
-
- public void onStartTrackingTouch(SeekBar seekBar) {
- mTracking = true;
- if (mListener != null) {
- mListener.onChanged(this, mTracking, mToggle.isChecked(), mSlider.getProgress());
- }
- mToggle.setChecked(false);
- }
-
- public void onStopTrackingTouch(SeekBar seekBar) {
- mTracking = false;
- if (mListener != null) {
- mListener.onChanged(this, mTracking, mToggle.isChecked(), mSlider.getProgress());
- }
- }
-
public void setOnChangedListener(Listener l) {
mListener = l;
}
@@ -130,5 +100,49 @@ public class ToggleSlider extends RelativeLayout
public void setValue(int value) {
mSlider.setProgress(value);
}
+
+ private final OnCheckedChangeListener mCheckListener = new OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(CompoundButton toggle, boolean checked) {
+ mSlider.setEnabled(!checked);
+
+ if (mListener != null) {
+ mListener.onChanged(
+ ToggleSlider.this, mTracking, checked, mSlider.getProgress());
+ }
+ }
+ };
+
+ private final OnSeekBarChangeListener mSeekListener = new OnSeekBarChangeListener() {
+ @Override
+ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+ if (mListener != null) {
+ mListener.onChanged(
+ ToggleSlider.this, mTracking, mToggle.isChecked(), progress);
+ }
+ }
+
+ @Override
+ public void onStartTrackingTouch(SeekBar seekBar) {
+ mTracking = true;
+
+ if (mListener != null) {
+ mListener.onChanged(
+ ToggleSlider.this, mTracking, mToggle.isChecked(), mSlider.getProgress());
+ }
+
+ mToggle.setChecked(false);
+ }
+
+ @Override
+ public void onStopTrackingTouch(SeekBar seekBar) {
+ mTracking = false;
+
+ if (mListener != null) {
+ mListener.onChanged(
+ ToggleSlider.this, mTracking, mToggle.isChecked(), mSlider.getProgress());
+ }
+ }
+ };
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 844b964..f1299fe 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -109,9 +109,6 @@ public abstract class BaseStatusBar extends SystemUI implements
public static final int EXPANDED_LEAVE_ALONE = -10000;
public static final int EXPANDED_FULL_OPEN = -10001;
- private static final String EXTRA_INTERCEPT = "android.intercept";
- private static final float INTERCEPTED_ALPHA = .2f;
-
protected CommandQueue mCommandQueue;
protected IStatusBarService mBarService;
protected H mHandler = createHandler();
@@ -1049,7 +1046,6 @@ public abstract class BaseStatusBar extends SystemUI implements
if (DEBUG) {
Log.d(TAG, "addNotificationViews: added at " + pos);
}
- updateInterceptedState(entry);
updateExpansionStates();
updateNotificationIcons();
}
@@ -1082,32 +1078,10 @@ public abstract class BaseStatusBar extends SystemUI implements
protected void setZenMode(int mode) {
if (!isDeviceProvisioned()) return;
- final boolean change = mZenMode != mode;
mZenMode = mode;
- final int N = mNotificationData.size();
- for (int i = 0; i < N; i++) {
- final NotificationData.Entry entry = mNotificationData.get(i);
- if (change && !shouldIntercept()) {
- entry.notification.getNotification().extras.putBoolean(EXTRA_INTERCEPT, false);
- }
- updateInterceptedState(entry);
- }
updateNotificationIcons();
}
- private boolean shouldIntercept() {
- return mZenMode != Settings.Global.ZEN_MODE_OFF;
- }
-
- protected boolean shouldIntercept(Notification n) {
- return shouldIntercept() && n.extras.getBoolean(EXTRA_INTERCEPT);
- }
-
- private void updateInterceptedState(NotificationData.Entry entry) {
- final boolean intercepted = shouldIntercept(entry.notification.getNotification());
- entry.row.findViewById(R.id.container).setAlpha(intercepted ? INTERCEPTED_ALPHA : 1);
- }
-
protected abstract void haltTicker();
protected abstract void setAreThereNotifications();
protected abstract void updateNotificationIcons();
@@ -1312,7 +1286,6 @@ public abstract class BaseStatusBar extends SystemUI implements
} else {
entry.content.setOnClickListener(null);
}
- updateInterceptedState(entry);
}
protected void notifyHeadsUpScreenOn(boolean screenOn) {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.java b/packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.java
new file mode 100644
index 0000000..d563968
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.systemui.statusbar;
+
+import android.app.Notification;
+import android.content.Context;
+import android.os.Binder;
+import android.os.IBinder;
+import android.os.Process;
+import android.service.notification.StatusBarNotification;
+import android.util.ArrayMap;
+import android.view.View;
+
+import com.android.systemui.R;
+import com.android.systemui.statusbar.NotificationData.Entry;
+import com.android.systemui.statusbar.phone.PhoneStatusBar;
+
+public class InterceptedNotifications {
+ private static final String TAG = "InterceptedNotifications";
+ private static final String EXTRA_INTERCEPT = "android.intercept";
+
+ private final Context mContext;
+ private final PhoneStatusBar mBar;
+ private final ArrayMap<IBinder, StatusBarNotification> mIntercepted
+ = new ArrayMap<IBinder, StatusBarNotification>();
+
+ private Binder mSynKey;
+
+ public InterceptedNotifications(Context context, PhoneStatusBar bar) {
+ mContext = context;
+ mBar = bar;
+ }
+
+ public void releaseIntercepted() {
+ final int n = mIntercepted.size();
+ for (int i = 0; i < n; i++) {
+ final IBinder key = mIntercepted.keyAt(i);
+ final StatusBarNotification sbn = mIntercepted.valueAt(i);
+ sbn.getNotification().extras.putBoolean(EXTRA_INTERCEPT, false);
+ mBar.addNotification(key, sbn);
+ }
+ mIntercepted.clear();
+ updateSyntheticNotification();
+ }
+
+ public boolean tryIntercept(IBinder key, StatusBarNotification notification) {
+ if (!notification.getNotification().extras.getBoolean(EXTRA_INTERCEPT)) return false;
+ mIntercepted.put(key, notification);
+ updateSyntheticNotification();
+ return true;
+ }
+
+ public void remove(IBinder key) {
+ if (mIntercepted.remove(key) != null) {
+ updateSyntheticNotification();
+ }
+ }
+
+ public boolean isSyntheticEntry(Entry ent) {
+ return mSynKey != null && ent.key.equals(mSynKey);
+ }
+
+ public void update(IBinder key, StatusBarNotification notification) {
+ if (mIntercepted.containsKey(key)) {
+ mIntercepted.put(key, notification);
+ }
+ }
+
+ private void updateSyntheticNotification() {
+ if (mIntercepted.isEmpty()) {
+ if (mSynKey != null) {
+ mBar.removeNotification(mSynKey);
+ mSynKey = null;
+ }
+ return;
+ }
+ final Notification n = new Notification.Builder(mContext)
+ .setSmallIcon(R.drawable.stat_sys_zen_limited)
+ .setContentTitle(mContext.getResources().getQuantityString(
+ R.plurals.zen_mode_notification_title,
+ mIntercepted.size(), mIntercepted.size()))
+ .setContentText(mContext.getString(R.string.zen_mode_notification_text))
+ .setOngoing(true)
+ .build();
+ final StatusBarNotification sbn = new StatusBarNotification(mContext.getPackageName(),
+ mContext.getBasePackageName(),
+ TAG.hashCode(), TAG, Process.myUid(), Process.myPid(), 0, n,
+ mBar.getCurrentUserHandle());
+ if (mSynKey == null) {
+ mSynKey = new Binder();
+ mBar.addNotification(mSynKey, sbn);
+ } else {
+ mBar.updateNotification(mSynKey, sbn);
+ }
+ final NotificationData.Entry entry = mBar.mNotificationData.findByKey(mSynKey);
+ entry.content.setOnClickListener(mSynClickListener);
+ }
+
+ private final View.OnClickListener mSynClickListener = new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ releaseIntercepted();
+ }
+ };
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
index 4730f2f..f3dd7e3 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -59,6 +59,7 @@ import android.os.RemoteException;
import android.os.SystemClock;
import android.os.UserHandle;
import android.provider.Settings;
+import android.provider.Settings.Global;
import android.service.notification.StatusBarNotification;
import android.util.DisplayMetrics;
import android.util.EventLog;
@@ -89,11 +90,11 @@ import com.android.systemui.R;
import com.android.systemui.statusbar.BaseStatusBar;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.GestureRecorder;
+import com.android.systemui.statusbar.InterceptedNotifications;
import com.android.systemui.statusbar.NotificationData;
import com.android.systemui.statusbar.NotificationData.Entry;
import com.android.systemui.statusbar.SignalClusterView;
import com.android.systemui.statusbar.StatusBarIconView;
-
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.BluetoothController;
import com.android.systemui.statusbar.policy.DateView;
@@ -101,7 +102,6 @@ import com.android.systemui.statusbar.policy.HeadsUpNotificationView;
import com.android.systemui.statusbar.policy.LocationController;
import com.android.systemui.statusbar.policy.NetworkController;
import com.android.systemui.statusbar.policy.RotationLockController;
-
import com.android.systemui.statusbar.stack.NotificationStackScrollLayout;
import java.io.FileDescriptor;
@@ -347,6 +347,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
}};
private Runnable mOnFlipRunnable;
+ private InterceptedNotifications mIntercepted;
public void setOnFlipRunnable(Runnable onFlipRunnable) {
mOnFlipRunnable = onFlipRunnable;
@@ -357,7 +358,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
super.setZenMode(mode);
if (mModeIcon == null) return;
if (!isDeviceProvisioned()) return;
- mModeIcon.setVisibility(mode != Settings.Global.ZEN_MODE_OFF ? View.VISIBLE : View.GONE);
+ final boolean zen = mode != Settings.Global.ZEN_MODE_OFF;
+ mModeIcon.setVisibility(zen ? View.VISIBLE : View.GONE);
+ if (!zen) {
+ mIntercepted.releaseIntercepted();
+ }
}
@Override
@@ -365,7 +370,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
mDisplay = ((WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE))
.getDefaultDisplay();
updateDisplaySize();
-
+ mIntercepted = new InterceptedNotifications(mContext, this);
super.start(); // calls createAndAddWindows()
addNavigationBar();
@@ -931,49 +936,54 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
mStatusIcons.removeViewAt(viewIndex);
}
+ public UserHandle getCurrentUserHandle() {
+ return new UserHandle(mCurrentUserId);
+ }
+
public void addNotification(IBinder key, StatusBarNotification notification) {
if (DEBUG) Log.d(TAG, "addNotification score=" + notification.getScore());
Entry shadeEntry = createNotificationViews(key, notification);
if (shadeEntry == null) {
return;
}
- if (!shouldIntercept(notification.getNotification())) {
- if (mUseHeadsUp && shouldInterrupt(notification)) {
- if (DEBUG) Log.d(TAG, "launching notification in heads up mode");
- Entry interruptionCandidate = new Entry(key, notification, null);
- ViewGroup holder = mHeadsUpNotificationView.getHolder();
- if (inflateViewsForHeadsUp(interruptionCandidate, holder)) {
- mInterruptingNotificationTime = System.currentTimeMillis();
- mInterruptingNotificationEntry = interruptionCandidate;
- shadeEntry.setInterruption();
+ if (mZenMode != Global.ZEN_MODE_OFF && mIntercepted.tryIntercept(key, notification)) {
+ return;
+ }
+ if (mUseHeadsUp && shouldInterrupt(notification)) {
+ if (DEBUG) Log.d(TAG, "launching notification in heads up mode");
+ Entry interruptionCandidate = new Entry(key, notification, null);
+ ViewGroup holder = mHeadsUpNotificationView.getHolder();
+ if (inflateViewsForHeadsUp(interruptionCandidate, holder)) {
+ mInterruptingNotificationTime = System.currentTimeMillis();
+ mInterruptingNotificationEntry = interruptionCandidate;
+ shadeEntry.setInterruption();
- // 1. Populate mHeadsUpNotificationView
- mHeadsUpNotificationView.setNotification(mInterruptingNotificationEntry);
+ // 1. Populate mHeadsUpNotificationView
+ mHeadsUpNotificationView.setNotification(mInterruptingNotificationEntry);
- // 2. Animate mHeadsUpNotificationView in
- mHandler.sendEmptyMessage(MSG_SHOW_HEADS_UP);
+ // 2. Animate mHeadsUpNotificationView in
+ mHandler.sendEmptyMessage(MSG_SHOW_HEADS_UP);
- // 3. Set alarm to age the notification off
- resetHeadsUpDecayTimer();
- }
- } else if (notification.getNotification().fullScreenIntent != null) {
- // Stop screensaver if the notification has a full-screen intent.
- // (like an incoming phone call)
- awakenDreams();
+ // 3. Set alarm to age the notification off
+ resetHeadsUpDecayTimer();
+ }
+ } else if (notification.getNotification().fullScreenIntent != null) {
+ // Stop screensaver if the notification has a full-screen intent.
+ // (like an incoming phone call)
+ awakenDreams();
- // not immersive & a full-screen alert should be shown
- if (DEBUG) Log.d(TAG, "Notification has fullScreenIntent; sending fullScreenIntent");
- try {
- notification.getNotification().fullScreenIntent.send();
- } catch (PendingIntent.CanceledException e) {
- }
- } else {
- // usual case: status bar visible & not immersive
+ // not immersive & a full-screen alert should be shown
+ if (DEBUG) Log.d(TAG, "Notification has fullScreenIntent; sending fullScreenIntent");
+ try {
+ notification.getNotification().fullScreenIntent.send();
+ } catch (PendingIntent.CanceledException e) {
+ }
+ } else {
+ // usual case: status bar visible & not immersive
- // show the ticker if there isn't already a heads up
- if (mInterruptingNotificationEntry == null) {
- tick(null, notification, true);
- }
+ // show the ticker if there isn't already a heads up
+ if (mInterruptingNotificationEntry == null) {
+ tick(null, notification, true);
}
}
addNotificationViews(shadeEntry);
@@ -991,6 +1001,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
}
}
+ @Override
+ public void updateNotification(IBinder key, StatusBarNotification notification) {
+ super.updateNotification(key, notification);
+ mIntercepted.update(key, notification);
+ }
+
public void removeNotification(IBinder key) {
StatusBarNotification old = removeNotificationViews(key);
if (SPEW) Log.d(TAG, "removeNotification key=" + key + " old=" + old);
@@ -1012,7 +1028,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
animateCollapsePanels();
}
}
-
+ mIntercepted.remove(key);
setAreThereNotifications();
}
@@ -1129,7 +1145,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode {
// in "public" mode (atop a secure keyguard), secret notifs are totally hidden
continue;
}
- if (shouldIntercept(ent.notification.getNotification())) {
+ if (mIntercepted.isSyntheticEntry(ent)) {
continue;
}
toShow.add(ent.icon);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
index 04b7f53..e2d6c5b 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/NotificationStackScrollLayout.java
@@ -31,7 +31,6 @@ import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
-import android.view.ViewParent;
import android.widget.OverScroller;
import com.android.systemui.ExpandHelper;
@@ -710,6 +709,12 @@ public class NotificationStackScrollLayout extends ViewGroup
super.onInterceptTouchEvent(ev);
}
+ @Override
+ protected void onViewRemoved(View child) {
+ super.onViewRemoved(child);
+ mCurrentStackScrollState.removeViewStateForView(child);
+ }
+
private boolean onInterceptTouchEventScroll(MotionEvent ev) {
/*
* This method JUST determines whether we want to intercept the motion.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java
index 881730a..67a1735 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/stack/StackScrollState.java
@@ -72,6 +72,10 @@ public class StackScrollState {
return mStateMap.get(requestedView);
}
+ public void removeViewStateForView(View child) {
+ mStateMap.remove(child);
+ }
+
/**
* Apply the properties saved in {@link #mStateMap} to the children of the {@link #mHostView}.
* The properties are only applied if they effectively changed.