Loading core/java/com/android/internal/statusbar/IStatusBar.aidl +3 −3 Original line number Diff line number Diff line Loading @@ -24,9 +24,9 @@ oneway interface IStatusBar { void setIcon(int index, in StatusBarIcon icon); void removeIcon(int index); void addNotification(IBinder key, in StatusBarNotification notification); void updateNotification(IBinder key, in StatusBarNotification notification); void removeNotification(IBinder key); void addNotification(in StatusBarNotification notification); void updateNotification(in StatusBarNotification notification); void removeNotification(String key); void disable(int state); void animateExpandNotificationsPanel(); void animateExpandSettingsPanel(); Loading core/java/com/android/internal/statusbar/IStatusBarService.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -39,8 +39,8 @@ interface IStatusBarService // ---- Methods below are for use by the status bar policy services ---- // You need the STATUS_BAR_SERVICE permission void registerStatusBar(IStatusBar callbacks, out StatusBarIconList iconList, out List<IBinder> notificationKeys, out List<StatusBarNotification> notifications, out int[] switches, out List<IBinder> binders); out List<StatusBarNotification> notifications, out int[] switches, out List<IBinder> binders); void onPanelRevealed(); void onPanelHidden(); void onNotificationClick(String key); Loading packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +30 −36 Original line number Diff line number Diff line Loading @@ -299,14 +299,13 @@ public abstract class BaseStatusBar extends SystemUI implements // Connect in to the status bar manager service StatusBarIconList iconList = new StatusBarIconList(); ArrayList<IBinder> notificationKeys = new ArrayList<IBinder>(); ArrayList<StatusBarNotification> notifications = new ArrayList<StatusBarNotification>(); mCommandQueue = new CommandQueue(this, iconList); int[] switches = new int[8]; ArrayList<IBinder> binders = new ArrayList<IBinder>(); try { mBarService.registerStatusBar(mCommandQueue, iconList, notificationKeys, notifications, mBarService.registerStatusBar(mCommandQueue, iconList, notifications, switches, binders); } catch (RemoteException ex) { // If the system process isn't there we're doomed anyway. Loading @@ -332,15 +331,10 @@ public abstract class BaseStatusBar extends SystemUI implements } } // Set up the initial notification state N = notificationKeys.size(); if (N == notifications.size()) { // Set up the initial notification state. N = notifications.size(); for (int i=0; i<N; i++) { addNotification(notificationKeys.get(i), notifications.get(i)); } } else { Log.wtf(TAG, "Notification list length mismatch: keys=" + N + " notifications=" + notifications.size()); addNotification(notifications.get(i)); } if (DEBUG) { Loading Loading @@ -1018,8 +1012,8 @@ public abstract class BaseStatusBar extends SystemUI implements * * WARNING: this will call back into us. Don't hold any locks. */ void handleNotificationError(IBinder key, StatusBarNotification n, String message) { removeNotification(key); void handleNotificationError(StatusBarNotification n, String message) { removeNotification(n.getKey()); try { mBarService.onNotificationError(n.getPackageName(), n.getTag(), n.getId(), n.getUid(), n.getInitialPid(), message, n.getUserId()); Loading @@ -1028,7 +1022,7 @@ public abstract class BaseStatusBar extends SystemUI implements } } protected StatusBarNotification removeNotificationViews(IBinder key) { protected StatusBarNotification removeNotificationViews(String key) { NotificationData.Entry entry = mNotificationData.remove(key); if (entry == null) { Log.w(TAG, "removeNotification for unknown key: " + key); Loading @@ -1043,10 +1037,9 @@ public abstract class BaseStatusBar extends SystemUI implements return entry.notification; } protected NotificationData.Entry createNotificationViews(IBinder key, StatusBarNotification notification) { protected NotificationData.Entry createNotificationViews(StatusBarNotification notification) { if (DEBUG) { Log.d(TAG, "createNotificationViews(key=" + key + ", notification=" + notification); Log.d(TAG, "createNotificationViews(notification=" + notification); } // Construct the icon. final StatusBarIconView iconView = new StatusBarIconView(mContext, Loading @@ -1061,13 +1054,13 @@ public abstract class BaseStatusBar extends SystemUI implements notification.getNotification().number, notification.getNotification().tickerText); if (!iconView.set(ic)) { handleNotificationError(key, notification, "Couldn't create icon: " + ic); handleNotificationError(notification, "Couldn't create icon: " + ic); return null; } // Construct the expanded view. NotificationData.Entry entry = new NotificationData.Entry(key, notification, iconView); NotificationData.Entry entry = new NotificationData.Entry(notification, iconView); if (!inflateViews(entry, mStackScroller)) { handleNotificationError(key, notification, "Couldn't expand RemoteViews for: " handleNotificationError(notification, "Couldn't expand RemoteViews for: " + notification); return null; } Loading @@ -1087,8 +1080,8 @@ public abstract class BaseStatusBar extends SystemUI implements updateRowStates(); } private void addNotificationViews(IBinder key, StatusBarNotification notification) { addNotificationViews(createNotificationViews(key, notification)); private void addNotificationViews(StatusBarNotification notification) { addNotificationViews(createNotificationViews(notification)); } /** Loading Loading @@ -1160,7 +1153,7 @@ public abstract class BaseStatusBar extends SystemUI implements protected abstract void haltTicker(); protected abstract void setAreThereNotifications(); protected abstract void updateNotificationIcons(); protected abstract void tick(IBinder key, StatusBarNotification n, boolean firstTime); protected abstract void tick(StatusBarNotification n, boolean firstTime); protected abstract void updateExpandedViewPos(int expandedPosition); protected abstract boolean shouldDisableNavbarGestures(); Loading @@ -1168,12 +1161,12 @@ public abstract class BaseStatusBar extends SystemUI implements return parent != null && parent.indexOfChild(entry.row) == 0; } public void updateNotification(IBinder key, StatusBarNotification notification) { if (DEBUG) Log.d(TAG, "updateNotification(" + key + " -> " + notification + ")"); public void updateNotification(StatusBarNotification notification) { if (DEBUG) Log.d(TAG, "updateNotification(" + notification + ")"); final NotificationData.Entry oldEntry = mNotificationData.findByKey(key); final NotificationData.Entry oldEntry = mNotificationData.findByKey(notification.getKey()); if (oldEntry == null) { Log.w(TAG, "updateNotification for unknown key: " + key); Log.w(TAG, "updateNotification for unknown key: " + notification.getKey()); return; } Loading Loading @@ -1252,7 +1245,7 @@ public abstract class BaseStatusBar extends SystemUI implements boolean isTopAnyway = isTopNotification(rowParent, oldEntry); if (contentsUnchanged && bigContentsUnchanged && headsUpContentsUnchanged && publicUnchanged && (orderUnchanged || isTopAnyway)) { if (DEBUG) Log.d(TAG, "reusing notification for key: " + key); if (DEBUG) Log.d(TAG, "reusing notification for key: " + notification.getKey()); oldEntry.notification = notification; try { updateNotificationViews(oldEntry, notification); Loading @@ -1276,7 +1269,7 @@ public abstract class BaseStatusBar extends SystemUI implements notification.getNotification().number, notification.getNotification().tickerText); if (!oldEntry.icon.set(ic)) { handleNotificationError(key, notification, "Couldn't update icon: " + ic); handleNotificationError(notification, "Couldn't update icon: " + ic); return; } updateRowStates(); Loading @@ -1284,17 +1277,18 @@ public abstract class BaseStatusBar extends SystemUI implements catch (RuntimeException e) { // It failed to add cleanly. Log, and remove the view from the panel. Log.w(TAG, "Couldn't reapply views for package " + contentView.getPackage(), e); removeNotificationViews(key); addNotificationViews(key, notification); removeNotificationViews(notification.getKey()); addNotificationViews(notification); } } else { if (DEBUG) Log.d(TAG, "not reusing notification for key: " + key); if (DEBUG) Log.d(TAG, "not reusing notification for key: " + notification.getKey()); if (DEBUG) Log.d(TAG, "contents was " + (contentsUnchanged ? "unchanged" : "changed")); if (DEBUG) Log.d(TAG, "order was " + (orderUnchanged ? "unchanged" : "changed")); if (DEBUG) Log.d(TAG, "notification is " + (isTopAnyway ? "top" : "not top")); removeNotificationViews(key); addNotificationViews(key, notification); // will also replace the heads up final NotificationData.Entry newEntry = mNotificationData.findByKey(key); removeNotificationViews(notification.getKey()); addNotificationViews(notification); // will also replace the heads up final NotificationData.Entry newEntry = mNotificationData.findByKey( notification.getKey()); final boolean userChangedExpansion = oldEntry.row.hasUserChangedExpansion(); if (userChangedExpansion) { boolean userExpanded = oldEntry.row.isUserExpanded(); Loading @@ -1314,7 +1308,7 @@ public abstract class BaseStatusBar extends SystemUI implements // Restart the ticker if it's still running if (updateTicker && isForCurrentUser) { haltTicker(); tick(key, notification, false); tick(notification, false); } // Recalculate the position of the sliding windows and the titles. Loading packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +13 −26 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.os.IBinder; import android.os.Message; import android.service.notification.StatusBarNotification; import com.android.internal.policy.IKeyguardShowCallback; import com.android.internal.statusbar.IStatusBar; import com.android.internal.statusbar.StatusBarIcon; import com.android.internal.statusbar.StatusBarIconList; Loading Loading @@ -73,11 +72,6 @@ public class CommandQueue extends IStatusBar.Stub { private Callbacks mCallbacks; private Handler mHandler = new H(); private class NotificationQueueEntry { IBinder key; StatusBarNotification notification; } /** * These methods are called back on the main thread. */ Loading @@ -86,9 +80,9 @@ public class CommandQueue extends IStatusBar.Stub { public void updateIcon(String slot, int index, int viewIndex, StatusBarIcon old, StatusBarIcon icon); public void removeIcon(String slot, int index, int viewIndex); public void addNotification(IBinder key, StatusBarNotification notification); public void updateNotification(IBinder key, StatusBarNotification notification); public void removeNotification(IBinder key); public void addNotification(StatusBarNotification notification); public void updateNotification(StatusBarNotification notification); public void removeNotification(String key); public void disable(int state); public void animateExpandNotificationsPanel(); public void animateCollapsePanels(int flags); Loading @@ -106,7 +100,6 @@ public class CommandQueue extends IStatusBar.Stub { public void showSearchPanel(); public void hideSearchPanel(); public void setWindowState(int window, int state); } public CommandQueue(Callbacks callbacks, StatusBarIconList list) { Loading @@ -130,25 +123,21 @@ public class CommandQueue extends IStatusBar.Stub { } } public void addNotification(IBinder key, StatusBarNotification notification) { @Override public void addNotification(StatusBarNotification notification) { synchronized (mList) { NotificationQueueEntry ne = new NotificationQueueEntry(); ne.key = key; ne.notification = notification; mHandler.obtainMessage(MSG_ADD_NOTIFICATION, 0, 0, ne).sendToTarget(); mHandler.obtainMessage(MSG_ADD_NOTIFICATION, 0, 0, notification).sendToTarget(); } } public void updateNotification(IBinder key, StatusBarNotification notification) { @Override public void updateNotification(StatusBarNotification notification) { synchronized (mList) { NotificationQueueEntry ne = new NotificationQueueEntry(); ne.key = key; ne.notification = notification; mHandler.obtainMessage(MSG_UPDATE_NOTIFICATION, 0, 0, ne).sendToTarget(); mHandler.obtainMessage(MSG_UPDATE_NOTIFICATION, 0, 0, notification).sendToTarget(); } } public void removeNotification(IBinder key) { public void removeNotification(String key) { synchronized (mList) { mHandler.obtainMessage(MSG_REMOVE_NOTIFICATION, 0, 0, key).sendToTarget(); } Loading Loading @@ -291,17 +280,15 @@ public class CommandQueue extends IStatusBar.Stub { break; } case MSG_ADD_NOTIFICATION: { final NotificationQueueEntry ne = (NotificationQueueEntry)msg.obj; mCallbacks.addNotification(ne.key, ne.notification); mCallbacks.addNotification((StatusBarNotification) msg.obj); break; } case MSG_UPDATE_NOTIFICATION: { final NotificationQueueEntry ne = (NotificationQueueEntry)msg.obj; mCallbacks.updateNotification(ne.key, ne.notification); mCallbacks.updateNotification((StatusBarNotification) msg.obj); break; } case MSG_REMOVE_NOTIFICATION: { mCallbacks.removeNotification((IBinder)msg.obj); mCallbacks.removeNotification((String) msg.obj); break; } case MSG_DISABLE: Loading packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.java +15 −17 Original line number Diff line number Diff line Loading @@ -18,8 +18,6 @@ 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.provider.Settings; import android.service.notification.StatusBarNotification; Loading @@ -33,13 +31,14 @@ 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 static final String SYNTHETIC_KEY = "InterceptedNotifications.SYNTHETIC_KEY"; private final Context mContext; private final PhoneStatusBar mBar; private final ArrayMap<IBinder, StatusBarNotification> mIntercepted = new ArrayMap<IBinder, StatusBarNotification>(); private final ArrayMap<String, StatusBarNotification> mIntercepted = new ArrayMap<String, StatusBarNotification>(); private Binder mSynKey; private String mSynKey; public InterceptedNotifications(Context context, PhoneStatusBar bar) { mContext = context; Loading @@ -49,36 +48,35 @@ public class InterceptedNotifications { 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); mBar.addNotification(sbn); } mIntercepted.clear(); updateSyntheticNotification(); } public boolean tryIntercept(IBinder key, StatusBarNotification notification) { public boolean tryIntercept(StatusBarNotification notification) { if (!notification.getNotification().extras.getBoolean(EXTRA_INTERCEPT)) return false; if (shouldDisplayIntercepted()) return false; mIntercepted.put(key, notification); mIntercepted.put(notification.getKey(), notification); updateSyntheticNotification(); return true; } public void remove(IBinder key) { public void remove(String key) { if (mIntercepted.remove(key) != null) { updateSyntheticNotification(); } } public boolean isSyntheticEntry(Entry ent) { return mSynKey != null && ent.key.equals(mSynKey); return ent.key.equals(SYNTHETIC_KEY); } public void update(IBinder key, StatusBarNotification notification) { if (mIntercepted.containsKey(key)) { mIntercepted.put(key, notification); public void update(StatusBarNotification notification) { if (mIntercepted.containsKey(notification.getKey())) { mIntercepted.put(notification.getKey(), notification); } } Loading Loading @@ -108,10 +106,10 @@ public class InterceptedNotifications { TAG.hashCode(), TAG, Process.myUid(), Process.myPid(), 0, n, mBar.getCurrentUserHandle()); if (mSynKey == null) { mSynKey = new Binder(); mBar.addNotification(mSynKey, sbn); mSynKey = sbn.getKey(); mBar.addNotification(sbn); } else { mBar.updateNotification(mSynKey, sbn); mBar.updateNotification(sbn); } final NotificationData.Entry entry = mBar.mNotificationData.findByKey(mSynKey); entry.row.setOnClickListener(mSynClickListener); Loading Loading
core/java/com/android/internal/statusbar/IStatusBar.aidl +3 −3 Original line number Diff line number Diff line Loading @@ -24,9 +24,9 @@ oneway interface IStatusBar { void setIcon(int index, in StatusBarIcon icon); void removeIcon(int index); void addNotification(IBinder key, in StatusBarNotification notification); void updateNotification(IBinder key, in StatusBarNotification notification); void removeNotification(IBinder key); void addNotification(in StatusBarNotification notification); void updateNotification(in StatusBarNotification notification); void removeNotification(String key); void disable(int state); void animateExpandNotificationsPanel(); void animateExpandSettingsPanel(); Loading
core/java/com/android/internal/statusbar/IStatusBarService.aidl +2 −2 Original line number Diff line number Diff line Loading @@ -39,8 +39,8 @@ interface IStatusBarService // ---- Methods below are for use by the status bar policy services ---- // You need the STATUS_BAR_SERVICE permission void registerStatusBar(IStatusBar callbacks, out StatusBarIconList iconList, out List<IBinder> notificationKeys, out List<StatusBarNotification> notifications, out int[] switches, out List<IBinder> binders); out List<StatusBarNotification> notifications, out int[] switches, out List<IBinder> binders); void onPanelRevealed(); void onPanelHidden(); void onNotificationClick(String key); Loading
packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +30 −36 Original line number Diff line number Diff line Loading @@ -299,14 +299,13 @@ public abstract class BaseStatusBar extends SystemUI implements // Connect in to the status bar manager service StatusBarIconList iconList = new StatusBarIconList(); ArrayList<IBinder> notificationKeys = new ArrayList<IBinder>(); ArrayList<StatusBarNotification> notifications = new ArrayList<StatusBarNotification>(); mCommandQueue = new CommandQueue(this, iconList); int[] switches = new int[8]; ArrayList<IBinder> binders = new ArrayList<IBinder>(); try { mBarService.registerStatusBar(mCommandQueue, iconList, notificationKeys, notifications, mBarService.registerStatusBar(mCommandQueue, iconList, notifications, switches, binders); } catch (RemoteException ex) { // If the system process isn't there we're doomed anyway. Loading @@ -332,15 +331,10 @@ public abstract class BaseStatusBar extends SystemUI implements } } // Set up the initial notification state N = notificationKeys.size(); if (N == notifications.size()) { // Set up the initial notification state. N = notifications.size(); for (int i=0; i<N; i++) { addNotification(notificationKeys.get(i), notifications.get(i)); } } else { Log.wtf(TAG, "Notification list length mismatch: keys=" + N + " notifications=" + notifications.size()); addNotification(notifications.get(i)); } if (DEBUG) { Loading Loading @@ -1018,8 +1012,8 @@ public abstract class BaseStatusBar extends SystemUI implements * * WARNING: this will call back into us. Don't hold any locks. */ void handleNotificationError(IBinder key, StatusBarNotification n, String message) { removeNotification(key); void handleNotificationError(StatusBarNotification n, String message) { removeNotification(n.getKey()); try { mBarService.onNotificationError(n.getPackageName(), n.getTag(), n.getId(), n.getUid(), n.getInitialPid(), message, n.getUserId()); Loading @@ -1028,7 +1022,7 @@ public abstract class BaseStatusBar extends SystemUI implements } } protected StatusBarNotification removeNotificationViews(IBinder key) { protected StatusBarNotification removeNotificationViews(String key) { NotificationData.Entry entry = mNotificationData.remove(key); if (entry == null) { Log.w(TAG, "removeNotification for unknown key: " + key); Loading @@ -1043,10 +1037,9 @@ public abstract class BaseStatusBar extends SystemUI implements return entry.notification; } protected NotificationData.Entry createNotificationViews(IBinder key, StatusBarNotification notification) { protected NotificationData.Entry createNotificationViews(StatusBarNotification notification) { if (DEBUG) { Log.d(TAG, "createNotificationViews(key=" + key + ", notification=" + notification); Log.d(TAG, "createNotificationViews(notification=" + notification); } // Construct the icon. final StatusBarIconView iconView = new StatusBarIconView(mContext, Loading @@ -1061,13 +1054,13 @@ public abstract class BaseStatusBar extends SystemUI implements notification.getNotification().number, notification.getNotification().tickerText); if (!iconView.set(ic)) { handleNotificationError(key, notification, "Couldn't create icon: " + ic); handleNotificationError(notification, "Couldn't create icon: " + ic); return null; } // Construct the expanded view. NotificationData.Entry entry = new NotificationData.Entry(key, notification, iconView); NotificationData.Entry entry = new NotificationData.Entry(notification, iconView); if (!inflateViews(entry, mStackScroller)) { handleNotificationError(key, notification, "Couldn't expand RemoteViews for: " handleNotificationError(notification, "Couldn't expand RemoteViews for: " + notification); return null; } Loading @@ -1087,8 +1080,8 @@ public abstract class BaseStatusBar extends SystemUI implements updateRowStates(); } private void addNotificationViews(IBinder key, StatusBarNotification notification) { addNotificationViews(createNotificationViews(key, notification)); private void addNotificationViews(StatusBarNotification notification) { addNotificationViews(createNotificationViews(notification)); } /** Loading Loading @@ -1160,7 +1153,7 @@ public abstract class BaseStatusBar extends SystemUI implements protected abstract void haltTicker(); protected abstract void setAreThereNotifications(); protected abstract void updateNotificationIcons(); protected abstract void tick(IBinder key, StatusBarNotification n, boolean firstTime); protected abstract void tick(StatusBarNotification n, boolean firstTime); protected abstract void updateExpandedViewPos(int expandedPosition); protected abstract boolean shouldDisableNavbarGestures(); Loading @@ -1168,12 +1161,12 @@ public abstract class BaseStatusBar extends SystemUI implements return parent != null && parent.indexOfChild(entry.row) == 0; } public void updateNotification(IBinder key, StatusBarNotification notification) { if (DEBUG) Log.d(TAG, "updateNotification(" + key + " -> " + notification + ")"); public void updateNotification(StatusBarNotification notification) { if (DEBUG) Log.d(TAG, "updateNotification(" + notification + ")"); final NotificationData.Entry oldEntry = mNotificationData.findByKey(key); final NotificationData.Entry oldEntry = mNotificationData.findByKey(notification.getKey()); if (oldEntry == null) { Log.w(TAG, "updateNotification for unknown key: " + key); Log.w(TAG, "updateNotification for unknown key: " + notification.getKey()); return; } Loading Loading @@ -1252,7 +1245,7 @@ public abstract class BaseStatusBar extends SystemUI implements boolean isTopAnyway = isTopNotification(rowParent, oldEntry); if (contentsUnchanged && bigContentsUnchanged && headsUpContentsUnchanged && publicUnchanged && (orderUnchanged || isTopAnyway)) { if (DEBUG) Log.d(TAG, "reusing notification for key: " + key); if (DEBUG) Log.d(TAG, "reusing notification for key: " + notification.getKey()); oldEntry.notification = notification; try { updateNotificationViews(oldEntry, notification); Loading @@ -1276,7 +1269,7 @@ public abstract class BaseStatusBar extends SystemUI implements notification.getNotification().number, notification.getNotification().tickerText); if (!oldEntry.icon.set(ic)) { handleNotificationError(key, notification, "Couldn't update icon: " + ic); handleNotificationError(notification, "Couldn't update icon: " + ic); return; } updateRowStates(); Loading @@ -1284,17 +1277,18 @@ public abstract class BaseStatusBar extends SystemUI implements catch (RuntimeException e) { // It failed to add cleanly. Log, and remove the view from the panel. Log.w(TAG, "Couldn't reapply views for package " + contentView.getPackage(), e); removeNotificationViews(key); addNotificationViews(key, notification); removeNotificationViews(notification.getKey()); addNotificationViews(notification); } } else { if (DEBUG) Log.d(TAG, "not reusing notification for key: " + key); if (DEBUG) Log.d(TAG, "not reusing notification for key: " + notification.getKey()); if (DEBUG) Log.d(TAG, "contents was " + (contentsUnchanged ? "unchanged" : "changed")); if (DEBUG) Log.d(TAG, "order was " + (orderUnchanged ? "unchanged" : "changed")); if (DEBUG) Log.d(TAG, "notification is " + (isTopAnyway ? "top" : "not top")); removeNotificationViews(key); addNotificationViews(key, notification); // will also replace the heads up final NotificationData.Entry newEntry = mNotificationData.findByKey(key); removeNotificationViews(notification.getKey()); addNotificationViews(notification); // will also replace the heads up final NotificationData.Entry newEntry = mNotificationData.findByKey( notification.getKey()); final boolean userChangedExpansion = oldEntry.row.hasUserChangedExpansion(); if (userChangedExpansion) { boolean userExpanded = oldEntry.row.isUserExpanded(); Loading @@ -1314,7 +1308,7 @@ public abstract class BaseStatusBar extends SystemUI implements // Restart the ticker if it's still running if (updateTicker && isForCurrentUser) { haltTicker(); tick(key, notification, false); tick(notification, false); } // Recalculate the position of the sliding windows and the titles. Loading
packages/SystemUI/src/com/android/systemui/statusbar/CommandQueue.java +13 −26 Original line number Diff line number Diff line Loading @@ -21,7 +21,6 @@ import android.os.IBinder; import android.os.Message; import android.service.notification.StatusBarNotification; import com.android.internal.policy.IKeyguardShowCallback; import com.android.internal.statusbar.IStatusBar; import com.android.internal.statusbar.StatusBarIcon; import com.android.internal.statusbar.StatusBarIconList; Loading Loading @@ -73,11 +72,6 @@ public class CommandQueue extends IStatusBar.Stub { private Callbacks mCallbacks; private Handler mHandler = new H(); private class NotificationQueueEntry { IBinder key; StatusBarNotification notification; } /** * These methods are called back on the main thread. */ Loading @@ -86,9 +80,9 @@ public class CommandQueue extends IStatusBar.Stub { public void updateIcon(String slot, int index, int viewIndex, StatusBarIcon old, StatusBarIcon icon); public void removeIcon(String slot, int index, int viewIndex); public void addNotification(IBinder key, StatusBarNotification notification); public void updateNotification(IBinder key, StatusBarNotification notification); public void removeNotification(IBinder key); public void addNotification(StatusBarNotification notification); public void updateNotification(StatusBarNotification notification); public void removeNotification(String key); public void disable(int state); public void animateExpandNotificationsPanel(); public void animateCollapsePanels(int flags); Loading @@ -106,7 +100,6 @@ public class CommandQueue extends IStatusBar.Stub { public void showSearchPanel(); public void hideSearchPanel(); public void setWindowState(int window, int state); } public CommandQueue(Callbacks callbacks, StatusBarIconList list) { Loading @@ -130,25 +123,21 @@ public class CommandQueue extends IStatusBar.Stub { } } public void addNotification(IBinder key, StatusBarNotification notification) { @Override public void addNotification(StatusBarNotification notification) { synchronized (mList) { NotificationQueueEntry ne = new NotificationQueueEntry(); ne.key = key; ne.notification = notification; mHandler.obtainMessage(MSG_ADD_NOTIFICATION, 0, 0, ne).sendToTarget(); mHandler.obtainMessage(MSG_ADD_NOTIFICATION, 0, 0, notification).sendToTarget(); } } public void updateNotification(IBinder key, StatusBarNotification notification) { @Override public void updateNotification(StatusBarNotification notification) { synchronized (mList) { NotificationQueueEntry ne = new NotificationQueueEntry(); ne.key = key; ne.notification = notification; mHandler.obtainMessage(MSG_UPDATE_NOTIFICATION, 0, 0, ne).sendToTarget(); mHandler.obtainMessage(MSG_UPDATE_NOTIFICATION, 0, 0, notification).sendToTarget(); } } public void removeNotification(IBinder key) { public void removeNotification(String key) { synchronized (mList) { mHandler.obtainMessage(MSG_REMOVE_NOTIFICATION, 0, 0, key).sendToTarget(); } Loading Loading @@ -291,17 +280,15 @@ public class CommandQueue extends IStatusBar.Stub { break; } case MSG_ADD_NOTIFICATION: { final NotificationQueueEntry ne = (NotificationQueueEntry)msg.obj; mCallbacks.addNotification(ne.key, ne.notification); mCallbacks.addNotification((StatusBarNotification) msg.obj); break; } case MSG_UPDATE_NOTIFICATION: { final NotificationQueueEntry ne = (NotificationQueueEntry)msg.obj; mCallbacks.updateNotification(ne.key, ne.notification); mCallbacks.updateNotification((StatusBarNotification) msg.obj); break; } case MSG_REMOVE_NOTIFICATION: { mCallbacks.removeNotification((IBinder)msg.obj); mCallbacks.removeNotification((String) msg.obj); break; } case MSG_DISABLE: Loading
packages/SystemUI/src/com/android/systemui/statusbar/InterceptedNotifications.java +15 −17 Original line number Diff line number Diff line Loading @@ -18,8 +18,6 @@ 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.provider.Settings; import android.service.notification.StatusBarNotification; Loading @@ -33,13 +31,14 @@ 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 static final String SYNTHETIC_KEY = "InterceptedNotifications.SYNTHETIC_KEY"; private final Context mContext; private final PhoneStatusBar mBar; private final ArrayMap<IBinder, StatusBarNotification> mIntercepted = new ArrayMap<IBinder, StatusBarNotification>(); private final ArrayMap<String, StatusBarNotification> mIntercepted = new ArrayMap<String, StatusBarNotification>(); private Binder mSynKey; private String mSynKey; public InterceptedNotifications(Context context, PhoneStatusBar bar) { mContext = context; Loading @@ -49,36 +48,35 @@ public class InterceptedNotifications { 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); mBar.addNotification(sbn); } mIntercepted.clear(); updateSyntheticNotification(); } public boolean tryIntercept(IBinder key, StatusBarNotification notification) { public boolean tryIntercept(StatusBarNotification notification) { if (!notification.getNotification().extras.getBoolean(EXTRA_INTERCEPT)) return false; if (shouldDisplayIntercepted()) return false; mIntercepted.put(key, notification); mIntercepted.put(notification.getKey(), notification); updateSyntheticNotification(); return true; } public void remove(IBinder key) { public void remove(String key) { if (mIntercepted.remove(key) != null) { updateSyntheticNotification(); } } public boolean isSyntheticEntry(Entry ent) { return mSynKey != null && ent.key.equals(mSynKey); return ent.key.equals(SYNTHETIC_KEY); } public void update(IBinder key, StatusBarNotification notification) { if (mIntercepted.containsKey(key)) { mIntercepted.put(key, notification); public void update(StatusBarNotification notification) { if (mIntercepted.containsKey(notification.getKey())) { mIntercepted.put(notification.getKey(), notification); } } Loading Loading @@ -108,10 +106,10 @@ public class InterceptedNotifications { TAG.hashCode(), TAG, Process.myUid(), Process.myPid(), 0, n, mBar.getCurrentUserHandle()); if (mSynKey == null) { mSynKey = new Binder(); mBar.addNotification(mSynKey, sbn); mSynKey = sbn.getKey(); mBar.addNotification(sbn); } else { mBar.updateNotification(mSynKey, sbn); mBar.updateNotification(sbn); } final NotificationData.Entry entry = mBar.mNotificationData.findByKey(mSynKey); entry.row.setOnClickListener(mSynClickListener); Loading