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

Commit 3d4fe363 authored by Alan Viverette's avatar Alan Viverette Committed by Android (Google) Code Review
Browse files

Merge "Add accessibility action to open power long-press dialog"

parents a76932b9 e34560b2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2603,6 +2603,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_POWER_DIALOG = 6; // 0x6
    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";
+5 −0
Original line number Diff line number Diff line
@@ -353,6 +353,11 @@ public abstract class AccessibilityService extends Service {
     */
    public static final int GLOBAL_ACTION_QUICK_SETTINGS = 5;

    /**
     * Action to open the power long-press dialog.
     */
    public static final int GLOBAL_ACTION_POWER_DIALOG = 6;

    private static final String LOG_TAG = "AccessibilityService";

    /**
+5 −0
Original line number Diff line number Diff line
@@ -163,6 +163,11 @@ public abstract class WindowManagerInternal {
     */
    public abstract void getWindowFrame(IBinder token, Rect outBounds);

    /**
     * Opens the global actions dialog.
     */
    public abstract void showGlobalActions();

    /**
     * Invalidate all visible windows. Then report back on the callback once all windows have
     * redrawn.
+6 −0
Original line number Diff line number Diff line
@@ -1161,6 +1161,12 @@ public interface WindowManagerPolicy {
     */
    public void showRecentApps();

    /**
     * Show the global actions dialog.
     * @hide
     */
    public void showGlobalActions();

    /**
     * @return The current height of the input method window.
     */
+13 −3
Original line number Diff line number Diff line
@@ -527,6 +527,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
    private static final int MSG_WINDOW_MANAGER_DRAWN_COMPLETE = 7;
    private static final int MSG_WAKING_UP = 8;
    private static final int MSG_DISPATCH_SHOW_RECENTS = 9;
    private static final int MSG_DISPATCH_SHOW_GLOBAL_ACTIONS = 10;

    private class PolicyHandler extends Handler {
        @Override
@@ -547,6 +548,9 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                case MSG_DISPATCH_SHOW_RECENTS:
                    showRecentApps(false);
                    break;
                case MSG_DISPATCH_SHOW_GLOBAL_ACTIONS:
                    showGlobalActionsInternal();
                    break;
                case MSG_KEYGUARD_DRAWN_COMPLETE:
                    if (DEBUG_WAKEUP) Slog.w(TAG, "Setting mKeyguardDrawComplete");
                    mKeyguardDrawComplete = true;
@@ -859,8 +863,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                if (!performHapticFeedbackLw(null, HapticFeedbackConstants.LONG_PRESS, false)) {
                    performAuditoryFeedbackForAccessibilityIfNeed();
                }
                sendCloseSystemWindows(SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS);
                showGlobalActionsDialog();
                showGlobalActionsInternal();
                break;
            case LONG_PRESS_POWER_SHUT_OFF:
            case LONG_PRESS_POWER_SHUT_OFF_NO_CONFIRM:
@@ -880,7 +883,14 @@ public class PhoneWindowManager implements WindowManagerPolicy {
        }
    };

    void showGlobalActionsDialog() {
    @Override
    public void showGlobalActions() {
        mHandler.removeMessages(MSG_DISPATCH_SHOW_GLOBAL_ACTIONS);
        mHandler.sendEmptyMessage(MSG_DISPATCH_SHOW_GLOBAL_ACTIONS);
    }

    void showGlobalActionsInternal() {
        sendCloseSystemWindows(SYSTEM_DIALOG_REASON_GLOBAL_ACTIONS);
        if (mGlobalActions == null) {
            mGlobalActions = new GlobalActions(mContext, mWindowManagerFuncs);
        }
Loading