From cc8b467c590170dd52e817dc1fd48ace83e6599e Mon Sep 17 00:00:00 2001 From: Bryce Lee Date: Thu, 5 Feb 2015 18:39:01 -0800 Subject: [PATCH] Add voice assist action for global actions. Bug: 18919886 Change-Id: Idd74cf6980207deabfb312732a0316a2edf3c176 --- core/res/res/values-watch/config.xml | 2 +- core/res/res/values/strings.xml | 3 +++ core/res/res/values/symbols.xml | 2 ++ .../internal/policy/impl/GlobalActions.java | 25 +++++++++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/core/res/res/values-watch/config.xml b/core/res/res/values-watch/config.xml index 3eede32bd344c..307a1ea09c701 100644 --- a/core/res/res/values-watch/config.xml +++ b/core/res/res/values-watch/config.xml @@ -23,7 +23,7 @@ - settings + voiceassist Settings + + Voice Assist + Lock now diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 105554794f53d..77c981a980965 100755 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1527,6 +1527,7 @@ + @@ -1614,6 +1615,7 @@ + diff --git a/policy/src/com/android/internal/policy/impl/GlobalActions.java b/policy/src/com/android/internal/policy/impl/GlobalActions.java index b0b2886fcdb4d..20a2c9f76b781 100644 --- a/policy/src/com/android/internal/policy/impl/GlobalActions.java +++ b/policy/src/com/android/internal/policy/impl/GlobalActions.java @@ -100,6 +100,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac private static final String GLOBAL_ACTION_KEY_USERS = "users"; private static final String GLOBAL_ACTION_KEY_SETTINGS = "settings"; private static final String GLOBAL_ACTION_KEY_LOCKDOWN = "lockdown"; + private static final String GLOBAL_ACTION_KEY_VOICEASSIST = "voiceassist"; private final Context mContext; private final WindowManagerFuncs mWindowManagerFuncs; @@ -291,6 +292,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac mItems.add(getSettingsAction()); } else if (GLOBAL_ACTION_KEY_LOCKDOWN.equals(actionKey)) { mItems.add(getLockdownAction()); + } else if (GLOBAL_ACTION_KEY_VOICEASSIST.equals(actionKey)) { + mItems.add(getVoiceAssistAction()); } else { Log.e(TAG, "Invalid global action key " + actionKey); } @@ -436,6 +439,28 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac }; } + private Action getVoiceAssistAction() { + return new SinglePressAction(com.android.internal.R.drawable.ic_voice_search, + R.string.global_action_voice_assist) { + @Override + public void onPress() { + Intent intent = new Intent(Intent.ACTION_VOICE_ASSIST); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); + mContext.startActivity(intent); + } + + @Override + public boolean showDuringKeyguard() { + return true; + } + + @Override + public boolean showBeforeProvisioning() { + return true; + } + }; + } + private Action getLockdownAction() { return new SinglePressAction(com.android.internal.R.drawable.ic_lock_lock, R.string.global_action_lockdown) {