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

Commit cde0a2a9 authored by Benjamin Franz's avatar Benjamin Franz
Browse files

Introduce disable2 into StatusBarManager

We ran out of space for new disable flags, so need to introduce a
disable2 API into StatusBarManager and update all the underlying code
to support the second set of flags.

Bug: 20331928
Change-Id: I5009b393133c576b37d7e2bae0df97cb8c41a065
parent 69812636
Loading
Loading
Loading
Loading
+32 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@

package android.app;

import android.annotation.IntDef;
import android.content.Context;
import android.os.Binder;
import android.os.RemoteException;
@@ -27,6 +28,9 @@ import android.view.View;

import com.android.internal.statusbar.IStatusBarService;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

/**
 * Allows an app to control the status bar.
 *
@@ -59,6 +63,15 @@ public class StatusBarManager {
            | DISABLE_SYSTEM_INFO | DISABLE_RECENT | DISABLE_HOME | DISABLE_BACK | DISABLE_CLOCK
            | DISABLE_SEARCH;

    public static final int DISABLE2_NONE = 0x00000000;

    public static final int DISABLE2_MASK = 0x00000000;

    @IntDef(flag = true,
            value = {DISABLE2_NONE, DISABLE2_MASK})
    @Retention(RetentionPolicy.SOURCE)
    public @interface Disable2Flags {}

    public static final int NAVIGATION_HINT_BACK_ALT      = 1 << 0;
    public static final int NAVIGATION_HINT_IME_SHOWN     = 1 << 1;

@@ -104,6 +117,24 @@ public class StatusBarManager {
        }
    }

    /**
     * Disable additional status bar features. Pass the bitwise-or of the DISABLE2_* flags.
     * To re-enable everything, pass {@link #DISABLE_NONE}.
     *
     * Warning: Only pass DISABLE2_* flags into this function, do not use DISABLE_* flags.
     */
    public void disable2(@Disable2Flags int what) {
        try {
            final IStatusBarService svc = getService();
            if (svc != null) {
                svc.disable2(what, mToken, mContext.getPackageName());
            }
        } catch (RemoteException ex) {
            // system process is dead anyway.
            throw new RuntimeException(ex);
        }
    }

    /**
     * Expand the notifications panel.
     */
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ oneway interface IStatusBar
{
    void setIcon(int index, in StatusBarIcon icon);
    void removeIcon(int index);
    void disable(int state);
    void disable(int state1, int state2);
    void animateExpandNotificationsPanel();
    void animateExpandSettingsPanel();
    void animateCollapsePanels();
+2 −0
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@ interface IStatusBarService
    void collapsePanels();
    void disable(int what, IBinder token, String pkg);
    void disableForUser(int what, IBinder token, String pkg, int userId);
    void disable2(int what, IBinder token, String pkg);
    void disable2ForUser(int what, IBinder token, String pkg, int userId);
    void setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription);
    void setIconVisibility(String slot, boolean visible);
    void removeIcon(String slot);
+1 −1
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ option java_package com.android.systemui;
# ---------------------------
# PhoneStatusBar.java
# ---------------------------
36000 sysui_statusbar_touch (type|1),(x|1),(y|1),(enabled|1)
36000 sysui_statusbar_touch (type|1),(x|1),(y|1),(disable1|1),(disable2|1)
36001 sysui_heads_up_status (key|3),(visible|1)
36002 sysui_fullscreen_notification (key|3)
36003 sysui_heads_up_escalation (key|3)
+1 −1
Original line number Diff line number Diff line
@@ -581,7 +581,7 @@ public abstract class BaseStatusBar extends SystemUI implements
        createAndAddWindows();

        mSettingsObserver.onChange(false); // set up
        disable(switches[0], false /* animate */);
        disable(switches[0], switches[6], false /* animate */);
        setSystemUiVisibility(switches[1], 0xffffffff);
        topAppWindowChanged(switches[2] != 0);
        // StatusBarManagerService has a back up of IME token and it's restored here.
Loading