diff options
author | 2014-07-11 00:23:54 +0000 | |
---|---|---|
committer | 2014-07-10 20:54:59 +0000 | |
commit | 3d4fe363b25293577faae3fddf85e6f73f76b0cd (patch) | |
tree | c9d31415d2166396dab4c6713df4fef1a14b500e | |
parent | a76932b909ccc6afaa88af2c31deb240d5b6d9cf (diff) | |
parent | e34560b21989eea54a139a0586d156ba573cc2ea (diff) |
Merge "Add accessibility action to open power long-press dialog"
7 files changed, 47 insertions, 4 deletions
diff --git a/api/current.txt b/api/current.txt index a40f08d7907a..d55cac6ec5ac 100644 --- a/api/current.txt +++ b/api/current.txt @@ -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"; diff --git a/core/java/android/accessibilityservice/AccessibilityService.java b/core/java/android/accessibilityservice/AccessibilityService.java index cbc815015318..19a91a67705f 100644 --- a/core/java/android/accessibilityservice/AccessibilityService.java +++ b/core/java/android/accessibilityservice/AccessibilityService.java @@ -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"; /** diff --git a/core/java/android/view/WindowManagerInternal.java b/core/java/android/view/WindowManagerInternal.java index bf5c84efb49b..38e372367ac5 100644 --- a/core/java/android/view/WindowManagerInternal.java +++ b/core/java/android/view/WindowManagerInternal.java @@ -164,6 +164,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. */ diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java index ee542a1fb7e0..5f0fa1841323 100644 --- a/core/java/android/view/WindowManagerPolicy.java +++ b/core/java/android/view/WindowManagerPolicy.java @@ -1162,6 +1162,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. */ public int getInputMethodWindowVisibleHeightLw(); diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 0b1252ea361e..28f7a0f8362b 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -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); } diff --git a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java index 1be1572d80ae..ee7eb9f2136f 100644 --- a/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java +++ b/services/accessibility/java/com/android/server/accessibility/AccessibilityManagerService.java @@ -2443,6 +2443,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { case AccessibilityService.GLOBAL_ACTION_QUICK_SETTINGS: { expandQuickSettings(); } return true; + case AccessibilityService.GLOBAL_ACTION_POWER_DIALOG: { + showGlobalActions(); + } return true; } return false; } finally { @@ -2781,6 +2784,10 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub { Binder.restoreCallingIdentity(token); } + private void showGlobalActions() { + mWindowManagerService.showGlobalActions(); + } + private IAccessibilityInteractionConnection getConnectionLocked(int windowId) { if (DEBUG) { Slog.i(LOG_TAG, "Trying to get interaction connection to windowId: " + windowId); diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 771b53bccb21..396ec8fa78cb 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -5171,6 +5171,10 @@ public class WindowManagerService extends IWindowManager.Stub } } + void showGlobalActions() { + mPolicy.showGlobalActions(); + } + @Override public void closeSystemDialogs(String reason) { synchronized(mWindowMap) { @@ -11130,7 +11134,12 @@ public class WindowManagerService extends IWindowManager.Stub @Override public boolean isKeyguardLocked() { - return isKeyguardLocked(); + return WindowManagerService.this.isKeyguardLocked(); + } + + @Override + public void showGlobalActions() { + WindowManagerService.this.showGlobalActions(); } @Override |