Loading core/java/com/android/internal/statusbar/IStatusBar.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -17,12 +17,16 @@ package com.android.internal.statusbar; import com.android.internal.statusbar.StatusBarIcon; import com.android.internal.statusbar.StatusBarNotification; /** @hide */ 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 disable(int state); void animateExpand(); void animateCollapse(); Loading core/java/com/android/internal/statusbar/StatusBarNotification.aidl 0 → 100644 +20 −0 Original line number Diff line number Diff line /* * Copyright (c) 2010, 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.internal.statusbar; parcelable StatusBarNotification; core/java/com/android/internal/statusbar/StatusBarNotification.java +1 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ public class StatusBarNotification implements Parcelable { public String pkg; public int id; public String tag; Notification notification; public Notification notification; public StatusBarNotification() { } Loading core/java/com/android/internal/statusbar/StatusBarNotificationList.java +6 −7 Original line number Diff line number Diff line Loading @@ -24,6 +24,9 @@ import android.os.Parcelable; import java.io.PrintWriter; import java.util.ArrayList; /** * Contains a list of status bar notifications and IBinder keys in no particular order. */ public class StatusBarNotificationList implements Parcelable { private class Entry { IBinder key; Loading Loading @@ -116,17 +119,14 @@ public class StatusBarNotificationList implements Parcelable { return mEntries.size(); } public IBinder add(StatusBarNotification notification) { public void add(IBinder key, StatusBarNotification notification) { if (notification == null) throw new NullPointerException(); Entry entry = new Entry(); entry.key = new Binder(); entry.key = key; entry.notification = notification.clone(); // TODO: Sort correctly by "when" mEntries.add(entry); return entry.key; } public void update(IBinder key, StatusBarNotification notification) { Loading @@ -134,8 +134,7 @@ public class StatusBarNotificationList implements Parcelable { if (index < 0) { throw new IllegalArgumentException("got invalid key: " + key); } final Entry entry = mEntries.get(index); entry.notification = notification.clone(); mEntries.get(index).notification = notification.clone(); } public void remove(IBinder key) { Loading packages/StatusBarPhone/src/com/android/policy/statusbar/phone/CommandQueue.java +55 −3 Original line number Diff line number Diff line Loading @@ -17,12 +17,15 @@ package com.android.policy.statusbar.phone; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.util.Slog; import com.android.internal.statusbar.IStatusBar; import com.android.internal.statusbar.StatusBarIcon; import com.android.internal.statusbar.StatusBarIconList; import com.android.internal.statusbar.StatusBarNotification; import com.android.internal.statusbar.StatusBarNotificationList; /** * This class takes the functions from IStatusBar that come in on Loading @@ -41,9 +44,13 @@ class CommandQueue extends IStatusBar.Stub { private static final int OP_SET_ICON = 1; private static final int OP_REMOVE_ICON = 2; private static final int MSG_DISABLE = 0x00020000; private static final int MSG_ADD_NOTIFICATION = 0x00020000; private static final int MSG_UPDATE_NOTIFICATION = 0x00030000; private static final int MSG_REMOVE_NOTIFICATION = 0x00040000; private static final int MSG_SET_VISIBILITY = 0x00030000; private static final int MSG_DISABLE = 0x00050000; private static final int MSG_SET_VISIBILITY = 0x00060000; private static final int OP_EXPAND = 1; private static final int OP_COLLAPSE = 2; Loading @@ -51,6 +58,11 @@ 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 @@ -59,6 +71,9 @@ 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 disable(int state); public void animateExpand(); public void animateCollapse(); Loading @@ -85,6 +100,30 @@ class CommandQueue extends IStatusBar.Stub { } } public void addNotification(IBinder key, StatusBarNotification notification) { synchronized (mList) { NotificationQueueEntry ne = new NotificationQueueEntry(); ne.key = key; ne.notification = notification; mHandler.obtainMessage(MSG_ADD_NOTIFICATION, 0, 0, ne).sendToTarget(); } } public void updateNotification(IBinder key, StatusBarNotification notification) { synchronized (mList) { NotificationQueueEntry ne = new NotificationQueueEntry(); ne.key = key; ne.notification = notification; mHandler.obtainMessage(MSG_UPDATE_NOTIFICATION, 0, 0, ne).sendToTarget(); } } public void removeNotification(IBinder key) { synchronized (mList) { mHandler.obtainMessage(MSG_REMOVE_NOTIFICATION, 0, 0, key).sendToTarget(); } } public void disable(int state) { synchronized (mList) { mHandler.removeMessages(MSG_DISABLE); Loading Loading @@ -135,6 +174,20 @@ class CommandQueue extends IStatusBar.Stub { } break; } case MSG_ADD_NOTIFICATION: { final NotificationQueueEntry ne = (NotificationQueueEntry)msg.obj; mCallbacks.addNotification(ne.key, ne.notification); break; } case MSG_UPDATE_NOTIFICATION: { final NotificationQueueEntry ne = (NotificationQueueEntry)msg.obj; mCallbacks.updateNotification(ne.key, ne.notification); break; } case MSG_REMOVE_NOTIFICATION: { mCallbacks.removeNotification((IBinder)msg.obj); break; } case MSG_DISABLE: mCallbacks.disable(msg.arg1); break; Loading @@ -149,4 +202,3 @@ class CommandQueue extends IStatusBar.Stub { } } Loading
core/java/com/android/internal/statusbar/IStatusBar.aidl +4 −0 Original line number Diff line number Diff line Loading @@ -17,12 +17,16 @@ package com.android.internal.statusbar; import com.android.internal.statusbar.StatusBarIcon; import com.android.internal.statusbar.StatusBarNotification; /** @hide */ 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 disable(int state); void animateExpand(); void animateCollapse(); Loading
core/java/com/android/internal/statusbar/StatusBarNotification.aidl 0 → 100644 +20 −0 Original line number Diff line number Diff line /* * Copyright (c) 2010, 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.internal.statusbar; parcelable StatusBarNotification;
core/java/com/android/internal/statusbar/StatusBarNotification.java +1 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,7 @@ public class StatusBarNotification implements Parcelable { public String pkg; public int id; public String tag; Notification notification; public Notification notification; public StatusBarNotification() { } Loading
core/java/com/android/internal/statusbar/StatusBarNotificationList.java +6 −7 Original line number Diff line number Diff line Loading @@ -24,6 +24,9 @@ import android.os.Parcelable; import java.io.PrintWriter; import java.util.ArrayList; /** * Contains a list of status bar notifications and IBinder keys in no particular order. */ public class StatusBarNotificationList implements Parcelable { private class Entry { IBinder key; Loading Loading @@ -116,17 +119,14 @@ public class StatusBarNotificationList implements Parcelable { return mEntries.size(); } public IBinder add(StatusBarNotification notification) { public void add(IBinder key, StatusBarNotification notification) { if (notification == null) throw new NullPointerException(); Entry entry = new Entry(); entry.key = new Binder(); entry.key = key; entry.notification = notification.clone(); // TODO: Sort correctly by "when" mEntries.add(entry); return entry.key; } public void update(IBinder key, StatusBarNotification notification) { Loading @@ -134,8 +134,7 @@ public class StatusBarNotificationList implements Parcelable { if (index < 0) { throw new IllegalArgumentException("got invalid key: " + key); } final Entry entry = mEntries.get(index); entry.notification = notification.clone(); mEntries.get(index).notification = notification.clone(); } public void remove(IBinder key) { Loading
packages/StatusBarPhone/src/com/android/policy/statusbar/phone/CommandQueue.java +55 −3 Original line number Diff line number Diff line Loading @@ -17,12 +17,15 @@ package com.android.policy.statusbar.phone; import android.os.Handler; import android.os.IBinder; import android.os.Message; import android.util.Slog; import com.android.internal.statusbar.IStatusBar; import com.android.internal.statusbar.StatusBarIcon; import com.android.internal.statusbar.StatusBarIconList; import com.android.internal.statusbar.StatusBarNotification; import com.android.internal.statusbar.StatusBarNotificationList; /** * This class takes the functions from IStatusBar that come in on Loading @@ -41,9 +44,13 @@ class CommandQueue extends IStatusBar.Stub { private static final int OP_SET_ICON = 1; private static final int OP_REMOVE_ICON = 2; private static final int MSG_DISABLE = 0x00020000; private static final int MSG_ADD_NOTIFICATION = 0x00020000; private static final int MSG_UPDATE_NOTIFICATION = 0x00030000; private static final int MSG_REMOVE_NOTIFICATION = 0x00040000; private static final int MSG_SET_VISIBILITY = 0x00030000; private static final int MSG_DISABLE = 0x00050000; private static final int MSG_SET_VISIBILITY = 0x00060000; private static final int OP_EXPAND = 1; private static final int OP_COLLAPSE = 2; Loading @@ -51,6 +58,11 @@ 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 @@ -59,6 +71,9 @@ 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 disable(int state); public void animateExpand(); public void animateCollapse(); Loading @@ -85,6 +100,30 @@ class CommandQueue extends IStatusBar.Stub { } } public void addNotification(IBinder key, StatusBarNotification notification) { synchronized (mList) { NotificationQueueEntry ne = new NotificationQueueEntry(); ne.key = key; ne.notification = notification; mHandler.obtainMessage(MSG_ADD_NOTIFICATION, 0, 0, ne).sendToTarget(); } } public void updateNotification(IBinder key, StatusBarNotification notification) { synchronized (mList) { NotificationQueueEntry ne = new NotificationQueueEntry(); ne.key = key; ne.notification = notification; mHandler.obtainMessage(MSG_UPDATE_NOTIFICATION, 0, 0, ne).sendToTarget(); } } public void removeNotification(IBinder key) { synchronized (mList) { mHandler.obtainMessage(MSG_REMOVE_NOTIFICATION, 0, 0, key).sendToTarget(); } } public void disable(int state) { synchronized (mList) { mHandler.removeMessages(MSG_DISABLE); Loading Loading @@ -135,6 +174,20 @@ class CommandQueue extends IStatusBar.Stub { } break; } case MSG_ADD_NOTIFICATION: { final NotificationQueueEntry ne = (NotificationQueueEntry)msg.obj; mCallbacks.addNotification(ne.key, ne.notification); break; } case MSG_UPDATE_NOTIFICATION: { final NotificationQueueEntry ne = (NotificationQueueEntry)msg.obj; mCallbacks.updateNotification(ne.key, ne.notification); break; } case MSG_REMOVE_NOTIFICATION: { mCallbacks.removeNotification((IBinder)msg.obj); break; } case MSG_DISABLE: mCallbacks.disable(msg.arg1); break; Loading @@ -149,4 +202,3 @@ class CommandQueue extends IStatusBar.Stub { } }