Merge "Add voice assist action for global actions." into lmp-mr1-modular-dev
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
<!-- Only show settings item due to smaller real estate. -->
|
<!-- Only show settings item due to smaller real estate. -->
|
||||||
<string-array translatable="false" name="config_globalActionsList">
|
<string-array translatable="false" name="config_globalActionsList">
|
||||||
<item>settings</item>
|
<item>voiceassist</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<!-- Base "touch slop" value used by ViewConfiguration as a
|
<!-- Base "touch slop" value used by ViewConfiguration as a
|
||||||
|
|||||||
@@ -482,6 +482,9 @@
|
|||||||
<!-- label for item that launches settings in phone options dialog [CHAR LIMIT=15]-->
|
<!-- label for item that launches settings in phone options dialog [CHAR LIMIT=15]-->
|
||||||
<string name="global_action_settings">Settings</string>
|
<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] -->
|
<!-- 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>
|
<string name="global_action_lockdown">Lock now</string>
|
||||||
|
|
||||||
|
|||||||
@@ -1527,6 +1527,7 @@
|
|||||||
<java-symbol type="string" name="global_action_silent_mode_on_status" />
|
<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_toggle_silent_mode" />
|
||||||
<java-symbol type="string" name="global_action_lockdown" />
|
<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="invalidPuk" />
|
||||||
<java-symbol type="string" name="lockscreen_carrier_default" />
|
<java-symbol type="string" name="lockscreen_carrier_default" />
|
||||||
<java-symbol type="style" name="Animation.LockScreen" />
|
<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_notification_ime_default" />
|
||||||
<java-symbol type="drawable" name="ic_menu_refresh" />
|
<java-symbol type="drawable" name="ic_menu_refresh" />
|
||||||
<java-symbol type="drawable" name="ic_settings" />
|
<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_car_mode" />
|
||||||
<java-symbol type="drawable" name="stat_notify_disabled_data" />
|
<java-symbol type="drawable" name="stat_notify_disabled_data" />
|
||||||
<java-symbol type="drawable" name="stat_notify_disk_full" />
|
<java-symbol type="drawable" name="stat_notify_disk_full" />
|
||||||
|
|||||||
@@ -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_USERS = "users";
|
||||||
private static final String GLOBAL_ACTION_KEY_SETTINGS = "settings";
|
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_LOCKDOWN = "lockdown";
|
||||||
|
private static final String GLOBAL_ACTION_KEY_VOICEASSIST = "voiceassist";
|
||||||
|
|
||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final WindowManagerFuncs mWindowManagerFuncs;
|
private final WindowManagerFuncs mWindowManagerFuncs;
|
||||||
@@ -291,6 +292,8 @@ class GlobalActions implements DialogInterface.OnDismissListener, DialogInterfac
|
|||||||
mItems.add(getSettingsAction());
|
mItems.add(getSettingsAction());
|
||||||
} else if (GLOBAL_ACTION_KEY_LOCKDOWN.equals(actionKey)) {
|
} else if (GLOBAL_ACTION_KEY_LOCKDOWN.equals(actionKey)) {
|
||||||
mItems.add(getLockdownAction());
|
mItems.add(getLockdownAction());
|
||||||
|
} else if (GLOBAL_ACTION_KEY_VOICEASSIST.equals(actionKey)) {
|
||||||
|
mItems.add(getVoiceAssistAction());
|
||||||
} else {
|
} else {
|
||||||
Log.e(TAG, "Invalid global action key " + actionKey);
|
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() {
|
private Action getLockdownAction() {
|
||||||
return new SinglePressAction(com.android.internal.R.drawable.ic_lock_lock,
|
return new SinglePressAction(com.android.internal.R.drawable.ic_lock_lock,
|
||||||
R.string.global_action_lockdown) {
|
R.string.global_action_lockdown) {
|
||||||
|
|||||||
Reference in New Issue
Block a user