// lock on mToastQueue
 private void keepProcessAliveLocked(int pid) {
   int toastCount = 0; // toasts from this pid
   ArrayList<ToastRecord> list = mToastQueue;
   int N = list.size();
   for (int i = 0; i < N; i++) {
     ToastRecord r = list.get(i);
     if (r.pid == pid) {
       toastCount++;
     }
   }
   try {
     mAm.setProcessForeground(mForegroundToken, pid, toastCount > 0);
   } catch (RemoteException e) {
     // Shouldn't happen.
   }
 }