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

Commit e20a177d authored by Svetoslav Ganov's avatar Svetoslav Ganov
Browse files

Adding a global accessibility action to open quick settings.

1. Added APIs for opening the quick settings to the StatusBarManagerService
   and the local StatausBarManager. The new APIs are protected by the old
   EXPAND_STATUS_BAR permission.
   Renamed the expand* and collapse* non-public APIs that are expanding
   the notifications to expandNotifications* collapseNotifications* to
   better convey what they do given that this change adds
   expandQuickSettings* and collapseQuickSettings*.
   Added a global action to the accessibility layer to expand the quick
   settings which is calling into the new status bar manager APIs.

bug:7030487

Change-Id: Ic7b46e1a132f1c0d71355f18e7c5a9a2424171c3
parent 1ab8a08a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2066,6 +2066,7 @@ package android.accessibilityservice {
    field public static final int GLOBAL_ACTION_BACK = 1; // 0x1
    field public static final int GLOBAL_ACTION_HOME = 2; // 0x2
    field public static final int GLOBAL_ACTION_NOTIFICATIONS = 4; // 0x4
    field public static final int GLOBAL_ACTION_QUICK_SETTINGS = 5; // 0x5
    field public static final int GLOBAL_ACTION_RECENTS = 3; // 0x3
    field public static final java.lang.String SERVICE_INTERFACE = "android.accessibilityservice.AccessibilityService";
    field public static final java.lang.String SERVICE_META_DATA = "android.accessibilityservice";
+6 −1
Original line number Diff line number Diff line
@@ -323,7 +323,7 @@ public abstract class AccessibilityService extends Service {
    public static final int GLOBAL_ACTION_HOME = 2;

    /**
     * Action to open the recents.
     * Action to open the recent apps.
     */
    public static final int GLOBAL_ACTION_RECENTS = 3;

@@ -332,6 +332,11 @@ public abstract class AccessibilityService extends Service {
     */
    public static final int GLOBAL_ACTION_NOTIFICATIONS = 4;

    /**
     * Action to open the quick settings.
     */
    public static final int GLOBAL_ACTION_QUICK_SETTINGS = 5;

    private static final String LOG_TAG = "AccessibilityService";

    interface Callbacks {
+36 −6
Original line number Diff line number Diff line
@@ -97,13 +97,13 @@ public class StatusBarManager {
    }
    
    /**
     * Expand the status bar.
     * Expand the notifications.
     */
    public void expand() {
    public void expandNotifications() {
        try {
            final IStatusBarService svc = getService();
            if (svc != null) {
                svc.expand();
                svc.expandNotifications();
            }
        } catch (RemoteException ex) {
            // system process is dead anyway.
@@ -112,13 +112,43 @@ public class StatusBarManager {
    }
    
    /**
     * Collapse the status bar.
     * Collapse the notifications.
     */
    public void collapse() {
    public void collapseNotifications() {
        try {
            final IStatusBarService svc = getService();
            if (svc != null) {
                svc.collapse();
                svc.collapseNotifications();
            }
        } catch (RemoteException ex) {
            // system process is dead anyway.
            throw new RuntimeException(ex);
        }
    }

    /**
     * Expand the quick settings.
     */
    public void expandQuickSettings() {
        try {
            final IStatusBarService svc = getService();
            if (svc != null) {
                svc.expandQuickSettings();
            }
        } catch (RemoteException ex) {
            // system process is dead anyway.
            throw new RuntimeException(ex);
        }
    }

    /**
     * Collapse the quick settings.
     */
    public void collapseQuickSettings() {
        try {
            final IStatusBarService svc = getService();
            if (svc != null) {
                svc.collapseQuickSettings();
            }
        } catch (RemoteException ex) {
            // system process is dead anyway.
+4 −2
Original line number Diff line number Diff line
@@ -28,8 +28,10 @@ oneway interface IStatusBar
    void updateNotification(IBinder key, in StatusBarNotification notification);
    void removeNotification(IBinder key);
    void disable(int state);
    void animateExpand();
    void animateCollapse();
    void animateExpandNotifications();
    void animateCollapseNotifications();
    void animateExpandQuickSettings();
    void animateCollapseQuickSettings();
    void setSystemUiVisibility(int vis, int mask);
    void topAppWindowChanged(boolean menuVisible);
    void setImeWindowStatus(in IBinder token, int vis, int backDisposition);
+4 −2
Original line number Diff line number Diff line
@@ -24,8 +24,10 @@ import com.android.internal.statusbar.StatusBarNotification;
/** @hide */
interface IStatusBarService
{
    void expand();
    void collapse();
    void expandNotifications();
    void collapseNotifications();
    void expandQuickSettings();
    void collapseQuickSettings();
    void disable(int what, IBinder token, String pkg);
    void setIcon(String slot, String iconPackage, int iconId, int iconLevel, String contentDescription);
    void setIconVisibility(String slot, boolean visible);
Loading