From 8326554788c78f47d7b5f266a074fd2d24fb7fd0 Mon Sep 17 00:00:00 2001 From: Bryce Lee Date: Sat, 14 Mar 2015 07:57:48 -0700 Subject: [PATCH] Add Assist global action for wear to different from VOICE_ASSIST Bug: 19722315 Change-Id: I0b1e5625a2eaabfe0015a4d730b25e84d60a3714 --- 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 745aa7399aca0..90448023bbf84 100644 --- a/core/res/res/values-watch/config.xml +++ b/core/res/res/values-watch/config.xml @@ -23,7 +23,7 @@ - voiceassist + assist Settings + + Assist + Voice Assist diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index e7bd90afc1bf5..7ba6ec2c2a4f5 100755 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -1537,6 +1537,7 @@ + @@ -1627,6 +1628,7 @@ + diff --git a/policy/src/com/android/internal/policy/impl/GlobalActions.java b/policy/src/com/android/internal/policy/impl/GlobalActions.java index 20a2c9f76b781..07fc4c7d7e8dc 100644 --- a/policy/src/com/android/internal/policy/impl/GlobalActions.java +++ b/policy/src/com/android/internal/policy/impl/GlobalActions.java @@ -101,6 +101,7 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac 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 static final String GLOBAL_ACTION_KEY_ASSIST = "assist"; private final Context mContext; private final WindowManagerFuncs mWindowManagerFuncs; @@ -294,6 +295,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac mItems.add(getLockdownAction()); } else if (GLOBAL_ACTION_KEY_VOICEASSIST.equals(actionKey)) { mItems.add(getVoiceAssistAction()); + } else if (GLOBAL_ACTION_KEY_ASSIST.equals(actionKey)) { + mItems.add(getAssistAction()); } else { Log.e(TAG, "Invalid global action key " + actionKey); } @@ -439,6 +442,28 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac }; } + private Action getAssistAction() { + return new SinglePressAction(com.android.internal.R.drawable.ic_action_assist_focused, + R.string.global_action_assist) { + @Override + public void onPress() { + Intent intent = new Intent(Intent.ACTION_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 getVoiceAssistAction() { return new SinglePressAction(com.android.internal.R.drawable.ic_voice_search, R.string.global_action_voice_assist) {