Loading packages/SystemUI/res/drawable/ic_notify_zen.xmldeleted 100644 → 0 +0 −28 Original line number Diff line number Diff line <!-- 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. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" > <size android:width="24dp" android:height="24dp"/> <viewport android:viewportWidth="48.0" android:viewportHeight="48.0"/> <path android:fill="#FFFFFFFF" android:pathData="M4.0,24.0c0.0,11.0 9.0,20.0 20.0,20.0s20.0,-9.0 20.0,-20.0S35.0,4.0 24.0,4.0S4.0,13.0 4.0,24.0zM36.6,33.8L14.2,11.4C16.9,9.3 20.3,8.0 24.0,8.0c8.8,0.0 16.0,7.2 16.0,16.0C40.0,27.7 38.7,31.1 36.6,33.8zM8.0,24.0c0.0,-3.7 1.3,-7.1 3.4,-9.8L33.8,36.6C31.1,38.7 27.7,40.0 24.0,40.0C15.2,40.0 8.0,32.8 8.0,24.0z"/> </vector> packages/SystemUI/res/values/strings.xml +0 −8 Original line number Diff line number Diff line Loading @@ -577,14 +577,6 @@ <!-- 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> <!-- Zen mode: Short title. [CHAR LIMIT=40] --> <string name="zen_mode_title">Do not disturb</string> Loading packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.javadeleted 100644 → 0 +0 −143 Original line number Diff line number Diff line /* * 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.Process; import android.provider.Settings; import android.service.notification.NotificationListenerService.Ranking; import android.service.notification.NotificationListenerService.RankingMap; import android.service.notification.StatusBarNotification; import android.util.ArrayMap; import android.util.ArraySet; 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 SYNTHETIC_KEY = "InterceptedNotifications.SYNTHETIC_KEY"; private final Context mContext; private final PhoneStatusBar mBar; private final ArrayMap<String, StatusBarNotification> mIntercepted = new ArrayMap<String, StatusBarNotification>(); private final ArraySet<String> mReleased = new ArraySet<String>(); private String 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 StatusBarNotification sbn = mIntercepted.valueAt(i); mReleased.add(sbn.getKey()); mBar.displayNotification(sbn, null); } mIntercepted.clear(); updateSyntheticNotification(); } public boolean tryIntercept(StatusBarNotification notification, RankingMap rankingMap) { if (rankingMap == null) return false; if (shouldDisplayIntercepted()) return false; if (mReleased.contains(notification.getKey())) return false; Ranking ranking = rankingMap.getRanking(notification.getKey()); if (!ranking.isInterceptedByDoNotDisturb()) return false; mIntercepted.put(notification.getKey(), notification); updateSyntheticNotification(); return true; } public void retryIntercepts(RankingMap ranking) { if (ranking == null) return; final int N = mIntercepted.size(); final ArraySet<String> removed = new ArraySet<String>(N); for (int i = 0; i < N; i++) { final StatusBarNotification sbn = mIntercepted.valueAt(i); if (!tryIntercept(sbn, ranking)) { removed.add(sbn.getKey()); mBar.displayNotification(sbn, ranking); } } if (!removed.isEmpty()) { mIntercepted.removeAll(removed); updateSyntheticNotification(); } } public void remove(String key) { if (mIntercepted.remove(key) != null) { updateSyntheticNotification(); } mReleased.remove(key); } public boolean isSyntheticEntry(Entry ent) { return ent.key.equals(mSynKey); } private boolean shouldDisplayIntercepted() { return Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.DISPLAY_INTERCEPTED_NOTIFICATIONS, 0) != 0; } private void updateSyntheticNotification() { if (mIntercepted.isEmpty()) { if (mSynKey != null) { mBar.removeNotification(mSynKey, null); mSynKey = null; } return; } final Notification n = new Notification.Builder(mContext) .setSmallIcon(R.drawable.ic_notify_zen) .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 = sbn.getKey(); mBar.displayNotification(sbn, null); } else { mBar.updateNotification(sbn, null); } final NotificationData.Entry entry = mBar.mNotificationData.findByKey(mSynKey); entry.row.setOnClickListener(mSynClickListener); } private final View.OnClickListener mSynClickListener = new View.OnClickListener() { @Override public void onClick(View v) { releaseIntercepted(); } }; } packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +0 −31 Original line number Diff line number Diff line Loading @@ -110,7 +110,6 @@ import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.DragDownHelper; import com.android.systemui.statusbar.ExpandableNotificationRow; import com.android.systemui.statusbar.GestureRecorder; import com.android.systemui.statusbar.InterceptedNotifications; import com.android.systemui.statusbar.KeyguardIndicationController; import com.android.systemui.statusbar.NotificationData; import com.android.systemui.statusbar.NotificationData.Entry; Loading Loading @@ -399,7 +398,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, }}; private Runnable mOnFlipRunnable; private InterceptedNotifications mIntercepted; private VelocityTracker mSettingsTracker; private float mSettingsDownY; private boolean mSettingsStarted; Loading Loading @@ -509,19 +507,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } }; @Override public void setZenMode(int mode) { super.setZenMode(mode); if (!isDeviceProvisioned()) return; final boolean zen = mode != Settings.Global.ZEN_MODE_OFF; if (!zen) { mIntercepted.releaseIntercepted(); } if (mIconPolicy != null) { mIconPolicy.setZenMode(zen); } } @Override protected void setShowLockscreenNotifications(boolean show) { super.setShowLockscreenNotifications(show); Loading @@ -533,7 +518,6 @@ 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(); Loading Loading @@ -1074,16 +1058,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, @Override public void addNotification(StatusBarNotification notification, RankingMap ranking) { if (DEBUG) Log.d(TAG, "addNotification key=" + notification.getKey()); if (mZenMode != Global.ZEN_MODE_OFF && mIntercepted.tryIntercept(notification, ranking)) { // Forward the ranking so we can sort the new notification. mNotificationData.updateRanking(ranking); return; } mIntercepted.remove(notification.getKey()); displayNotification(notification, ranking); } public void displayNotification(StatusBarNotification notification, RankingMap ranking) { if (mUseHeadsUp && shouldInterrupt(notification)) { if (DEBUG) Log.d(TAG, "launching notification in heads up mode"); Entry interruptionCandidate = new Entry(notification, null); Loading Loading @@ -1167,7 +1141,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, @Override protected void updateNotificationRanking(RankingMap ranking) { mNotificationData.updateRanking(ranking); mIntercepted.retryIntercepts(ranking); updateNotifications(); } Loading Loading @@ -1195,7 +1168,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, animateCollapsePanels(); } } mIntercepted.remove(key); setAreThereNotifications(); } Loading Loading @@ -1351,9 +1323,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, // in "public" mode (atop a secure keyguard), secret notifs are totally hidden continue; } if (mIntercepted.isSyntheticEntry(ent)) { continue; } toShow.add(ent.icon); } Loading Loading
packages/SystemUI/res/drawable/ic_notify_zen.xmldeleted 100644 → 0 +0 −28 Original line number Diff line number Diff line <!-- 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. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" > <size android:width="24dp" android:height="24dp"/> <viewport android:viewportWidth="48.0" android:viewportHeight="48.0"/> <path android:fill="#FFFFFFFF" android:pathData="M4.0,24.0c0.0,11.0 9.0,20.0 20.0,20.0s20.0,-9.0 20.0,-20.0S35.0,4.0 24.0,4.0S4.0,13.0 4.0,24.0zM36.6,33.8L14.2,11.4C16.9,9.3 20.3,8.0 24.0,8.0c8.8,0.0 16.0,7.2 16.0,16.0C40.0,27.7 38.7,31.1 36.6,33.8zM8.0,24.0c0.0,-3.7 1.3,-7.1 3.4,-9.8L33.8,36.6C31.1,38.7 27.7,40.0 24.0,40.0C15.2,40.0 8.0,32.8 8.0,24.0z"/> </vector>
packages/SystemUI/res/values/strings.xml +0 −8 Original line number Diff line number Diff line Loading @@ -577,14 +577,6 @@ <!-- 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> <!-- Zen mode: Short title. [CHAR LIMIT=40] --> <string name="zen_mode_title">Do not disturb</string> Loading
packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.javadeleted 100644 → 0 +0 −143 Original line number Diff line number Diff line /* * 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.Process; import android.provider.Settings; import android.service.notification.NotificationListenerService.Ranking; import android.service.notification.NotificationListenerService.RankingMap; import android.service.notification.StatusBarNotification; import android.util.ArrayMap; import android.util.ArraySet; 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 SYNTHETIC_KEY = "InterceptedNotifications.SYNTHETIC_KEY"; private final Context mContext; private final PhoneStatusBar mBar; private final ArrayMap<String, StatusBarNotification> mIntercepted = new ArrayMap<String, StatusBarNotification>(); private final ArraySet<String> mReleased = new ArraySet<String>(); private String 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 StatusBarNotification sbn = mIntercepted.valueAt(i); mReleased.add(sbn.getKey()); mBar.displayNotification(sbn, null); } mIntercepted.clear(); updateSyntheticNotification(); } public boolean tryIntercept(StatusBarNotification notification, RankingMap rankingMap) { if (rankingMap == null) return false; if (shouldDisplayIntercepted()) return false; if (mReleased.contains(notification.getKey())) return false; Ranking ranking = rankingMap.getRanking(notification.getKey()); if (!ranking.isInterceptedByDoNotDisturb()) return false; mIntercepted.put(notification.getKey(), notification); updateSyntheticNotification(); return true; } public void retryIntercepts(RankingMap ranking) { if (ranking == null) return; final int N = mIntercepted.size(); final ArraySet<String> removed = new ArraySet<String>(N); for (int i = 0; i < N; i++) { final StatusBarNotification sbn = mIntercepted.valueAt(i); if (!tryIntercept(sbn, ranking)) { removed.add(sbn.getKey()); mBar.displayNotification(sbn, ranking); } } if (!removed.isEmpty()) { mIntercepted.removeAll(removed); updateSyntheticNotification(); } } public void remove(String key) { if (mIntercepted.remove(key) != null) { updateSyntheticNotification(); } mReleased.remove(key); } public boolean isSyntheticEntry(Entry ent) { return ent.key.equals(mSynKey); } private boolean shouldDisplayIntercepted() { return Settings.Secure.getInt(mContext.getContentResolver(), Settings.Secure.DISPLAY_INTERCEPTED_NOTIFICATIONS, 0) != 0; } private void updateSyntheticNotification() { if (mIntercepted.isEmpty()) { if (mSynKey != null) { mBar.removeNotification(mSynKey, null); mSynKey = null; } return; } final Notification n = new Notification.Builder(mContext) .setSmallIcon(R.drawable.ic_notify_zen) .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 = sbn.getKey(); mBar.displayNotification(sbn, null); } else { mBar.updateNotification(sbn, null); } final NotificationData.Entry entry = mBar.mNotificationData.findByKey(mSynKey); entry.row.setOnClickListener(mSynClickListener); } private final View.OnClickListener mSynClickListener = new View.OnClickListener() { @Override public void onClick(View v) { releaseIntercepted(); } }; }
packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +0 −31 Original line number Diff line number Diff line Loading @@ -110,7 +110,6 @@ import com.android.systemui.statusbar.CommandQueue; import com.android.systemui.statusbar.DragDownHelper; import com.android.systemui.statusbar.ExpandableNotificationRow; import com.android.systemui.statusbar.GestureRecorder; import com.android.systemui.statusbar.InterceptedNotifications; import com.android.systemui.statusbar.KeyguardIndicationController; import com.android.systemui.statusbar.NotificationData; import com.android.systemui.statusbar.NotificationData.Entry; Loading Loading @@ -399,7 +398,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, }}; private Runnable mOnFlipRunnable; private InterceptedNotifications mIntercepted; private VelocityTracker mSettingsTracker; private float mSettingsDownY; private boolean mSettingsStarted; Loading Loading @@ -509,19 +507,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, } }; @Override public void setZenMode(int mode) { super.setZenMode(mode); if (!isDeviceProvisioned()) return; final boolean zen = mode != Settings.Global.ZEN_MODE_OFF; if (!zen) { mIntercepted.releaseIntercepted(); } if (mIconPolicy != null) { mIconPolicy.setZenMode(zen); } } @Override protected void setShowLockscreenNotifications(boolean show) { super.setShowLockscreenNotifications(show); Loading @@ -533,7 +518,6 @@ 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(); Loading Loading @@ -1074,16 +1058,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, @Override public void addNotification(StatusBarNotification notification, RankingMap ranking) { if (DEBUG) Log.d(TAG, "addNotification key=" + notification.getKey()); if (mZenMode != Global.ZEN_MODE_OFF && mIntercepted.tryIntercept(notification, ranking)) { // Forward the ranking so we can sort the new notification. mNotificationData.updateRanking(ranking); return; } mIntercepted.remove(notification.getKey()); displayNotification(notification, ranking); } public void displayNotification(StatusBarNotification notification, RankingMap ranking) { if (mUseHeadsUp && shouldInterrupt(notification)) { if (DEBUG) Log.d(TAG, "launching notification in heads up mode"); Entry interruptionCandidate = new Entry(notification, null); Loading Loading @@ -1167,7 +1141,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, @Override protected void updateNotificationRanking(RankingMap ranking) { mNotificationData.updateRanking(ranking); mIntercepted.retryIntercepts(ranking); updateNotifications(); } Loading Loading @@ -1195,7 +1168,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, animateCollapsePanels(); } } mIntercepted.remove(key); setAreThereNotifications(); } Loading Loading @@ -1351,9 +1323,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, // in "public" mode (atop a secure keyguard), secret notifs are totally hidden continue; } if (mIntercepted.isSyntheticEntry(ent)) { continue; } toShow.add(ent.icon); } Loading