package com.android.server.status; import android.os.IBinder; import android.util.Log; import android.view.View; import java.util.ArrayList; class NotificationViewList { private ArrayList mOngoing = new ArrayList(); private ArrayList mLatest = new ArrayList(); NotificationViewList() { } private static final int indexInList(ArrayList list, NotificationData n){ final int N = list.size(); for (int i=0; i= 0) { return latestSize + index + 1; } else { return -1; } } else { return indexInList(mLatest, n) + 1; } } void remove(StatusBarNotification notification) { NotificationData n = notification.data; int index; index = indexInList(mOngoing, n); if (index >= 0) { mOngoing.remove(index); return; } index = indexInList(mLatest, n); if (index >= 0) { mLatest.remove(index); return; } } ArrayList notificationsForPackage(String packageName) { ArrayList list = new ArrayList(); int N = mOngoing.size(); for (int i=0; i list, IBinder key) { final int N = list.size(); for (int i=0; i= 0) { return mOngoing.get(index); } index = indexForKey(mLatest, key); if (index >= 0) { return mLatest.get(index); } return null; } // gets the index of the notification in its expanded parent view int getExpandedIndex(StatusBarNotification notification) { ArrayList list = notification.data.ongoingEvent ? mOngoing : mLatest; return list.size() - indexForKey(list, notification.key) - 1; } void clearViews() { int N = mOngoing.size(); for (int i=0; i list = notification.data.ongoingEvent ? mOngoing : mLatest; long when = notification.data.when; final int N = list.size(); int index = N; for (int i=0; i when) { index = i; break; } } list.add(index, notification); if (StatusBarService.SPEW) { String s = ""; for (int i=0; i