Merge "Add voice assist action for global actions." into lmp-mr1-modular-dev

This commit is contained in:
Bryce Lee
2015-02-06 23:05:04 +00:00
committed by Android (Google) Code Review
4 changed files with 31 additions and 1 deletions

View File

@@ -23,7 +23,7 @@
<!-- Only show settings item due to smaller real estate. -->
<string-array translatable="false" name="config_globalActionsList">
<item>settings</item>
<item>voiceassist</item>
</string-array>
<!-- Base "touch slop" value used by ViewConfiguration as a

View File

@@ -482,6 +482,9 @@
<!-- label for item that launches settings in phone options dialog [CHAR LIMIT=15]-->
<string name="global_action_settings">Settings</string>
<!-- label for item that launches voice assist in phone options dialog [CHAR LIMIT=15]-->
<string name="global_action_voice_assist">Voice Assist</string>
<!-- label for item that locks the phone and enforces that it can't be unlocked without entering a credential. [CHAR LIMIT=15] -->
<string name="global_action_lockdown">Lock now</string>

View File

@@ -1527,6 +1527,7 @@
<java-symbol type="string" name="global_action_silent_mode_on_status" />
<java-symbol type="string" name="global_action_toggle_silent_mode" />
<java-symbol type="string" name="global_action_lockdown" />
<java-symbol type="string" name="global_action_voice_assist" />
<java-symbol type="string" name="invalidPuk" />
<java-symbol type="string" name="lockscreen_carrier_default" />
<java-symbol type="style" name="Animation.LockScreen" />
@@ -1614,6 +1615,7 @@
<java-symbol type="drawable" name="ic_notification_ime_default" />
<java-symbol type="drawable" name="ic_menu_refresh" />
<java-symbol type="drawable" name="ic_settings" />
<java-symbol type="drawable" name="ic_voice_search" />
<java-symbol type="drawable" name="stat_notify_car_mode" />
<java-symbol type="drawable" name="stat_notify_disabled_data" />
<java-symbol type="drawable" name="stat_notify_disk_full" />

View File

@@ -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) {