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

Commit 9305647e authored by Joe Onorato's avatar Joe Onorato
Browse files

Plumb lights out mode through from the window manager to the status bar...

Plumb lights out mode through from the window manager to the status bar running in the system ui process.

Lights out mode itself isn't implemented.

Change-Id: Ieeef0eb9ae5be23000f770e74e8ee66472f4c673
parent 5af8c63e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -30,5 +30,6 @@ oneway interface IStatusBar
    void disable(int state);
    void animateExpand();
    void animateCollapse();
    void setLightsOn(boolean on);
}
+3 −1
Original line number Diff line number Diff line
@@ -30,11 +30,13 @@ interface IStatusBarService
    void setIcon(String slot, String iconPackage, int iconId, int iconLevel);
    void setIconVisibility(String slot, boolean visible);
    void removeIcon(String slot);
    void setActiveWindowIsFullscreen(boolean fullscreen);

    // ---- 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 List<IBinder> notificationKeys, out List<StatusBarNotification> notifications,
            out boolean[] lightsOn);
    void onPanelRevealed();
    void onNotificationClick(String pkg, String tag, int id);
    void onNotificationError(String pkg, String tag, int id,
+14 −0
Original line number Diff line number Diff line
@@ -52,6 +52,8 @@ public class CommandQueue extends IStatusBar.Stub {
    private static final int OP_EXPAND = 1;
    private static final int OP_COLLAPSE = 2;

    private static final int MSG_SET_LIGHTS_ON = 0x00070000;

    private StatusBarIconList mList;
    private Callbacks mCallbacks;
    private Handler mHandler = new H();
@@ -75,6 +77,7 @@ public class CommandQueue extends IStatusBar.Stub {
        public void disable(int state);
        public void animateExpand();
        public void animateCollapse();
        public void setLightsOn(boolean on);
    }

    public CommandQueue(Callbacks callbacks, StatusBarIconList list) {
@@ -143,6 +146,13 @@ public class CommandQueue extends IStatusBar.Stub {
        }
    }

    public void setLightsOn(boolean on) {
        synchronized (mList) {
            mHandler.removeMessages(MSG_SET_LIGHTS_ON);
            mHandler.obtainMessage(MSG_SET_LIGHTS_ON, on ? 1 : 0, 0, null).sendToTarget();
        }
    }

    private final class H extends Handler {
        public void handleMessage(Message msg) {
            final int what = msg.what & MSG_MASK;
@@ -194,6 +204,10 @@ public class CommandQueue extends IStatusBar.Stub {
                    } else {
                        mCallbacks.animateCollapse();
                    }
                    break;
                case MSG_SET_LIGHTS_ON:
                    mCallbacks.setLightsOn(msg.arg1 != 0);
                    break;
            }
        }
    }
+9 −0
Original line number Diff line number Diff line
@@ -1011,6 +1011,15 @@ public class PhoneStatusBarService extends StatusBarService {
        return false;
    }

    public void setLightsOn(boolean on) {
        if (!on) {
            // All we do for "lights out" mode on a phone is hide the status bar,
            // which the window manager does.  But we do need to hide the windowshade
            // on our own.
            animateCollapse();
        }
    }

    private class Launcher implements View.OnClickListener {
        private PendingIntent mIntent;
        private String mPkg;
+5 −1
Original line number Diff line number Diff line
@@ -72,12 +72,16 @@ public abstract class StatusBarService extends Service implements CommandQueue.C
        mCommandQueue = new CommandQueue(this, iconList);
        mBarService = IStatusBarService.Stub.asInterface(
                ServiceManager.getService(Context.STATUS_BAR_SERVICE));
        boolean[] lightsOn = new boolean[1];
        try {
            mBarService.registerStatusBar(mCommandQueue, iconList, notificationKeys, notifications);
            mBarService.registerStatusBar(mCommandQueue, iconList, notificationKeys, notifications,
                    lightsOn);
        } catch (RemoteException ex) {
            // If the system process isn't there we're doomed anyway.
        }

        setLightsOn(lightsOn[0]);

        // Set up the initial icon state
        int N = iconList.size();
        int viewIndex = 0;
Loading