Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a0c56fe9 authored by Joe Onorato's avatar Joe Onorato
Browse files

Checkpoint. Doesn't build.

Change-Id: I92e4d539ea71af9e22ced02cbdee7fbd456b7971
parent 18e69dfc
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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();
+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;
+1 −1
Original line number Diff line number Diff line
@@ -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() {
    }
+6 −7
Original line number Diff line number Diff line
@@ -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;
@@ -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) {
@@ -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) {
+55 −3
Original line number Diff line number Diff line
@@ -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
@@ -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;

@@ -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.
     */
@@ -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();
@@ -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);
@@ -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;
@@ -149,4 +202,3 @@ class CommandQueue extends IStatusBar.Stub {
    }
}
Loading