diff options
| -rw-r--r-- | core/java/com/android/internal/app/AssistUtils.java | 21 | ||||
| -rw-r--r-- | core/res/res/values/config.xml | 8 | ||||
| -rw-r--r-- | core/res/res/values/symbols.xml | 2 |
3 files changed, 29 insertions, 2 deletions
diff --git a/core/java/com/android/internal/app/AssistUtils.java b/core/java/com/android/internal/app/AssistUtils.java index 0f8295ac5868..7c371cb18878 100644 --- a/core/java/com/android/internal/app/AssistUtils.java +++ b/core/java/com/android/internal/app/AssistUtils.java @@ -31,6 +31,8 @@ import android.os.ServiceManager; import android.provider.Settings; import android.util.Log; +import com.android.internal.R; + import java.util.ArrayList; import java.util.Set; @@ -42,6 +44,14 @@ public class AssistUtils { private static final String TAG = "AssistUtils"; + /** + * Sentinel value for "no default assistant specified." + * + * Empty string is already used to represent an explicit setting of No Assistant. null cannot + * be used because we can't represent a null value in XML. + */ + private static final String UNSET = "#+UNSET"; + private final Context mContext; private final IVoiceInteractionManagerService mVoiceInteractionManagerService; @@ -178,10 +188,21 @@ public class AssistUtils { return ComponentName.unflattenFromString(setting); } + final String defaultSetting = mContext.getResources().getString( + R.string.config_defaultAssistantComponentName); + if (defaultSetting != null && !defaultSetting.equals(UNSET)) { + return ComponentName.unflattenFromString(defaultSetting); + } + // Fallback to keep backward compatible behavior when there is no user setting. if (activeServiceSupportsAssistGesture()) { return getActiveServiceComponentName(); } + + if (UNSET.equals(defaultSetting)) { + return null; + } + final SearchManager searchManager = (SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE); if (searchManager == null) { diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 8b73b6768479..50a5734a896a 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -378,8 +378,8 @@ Values must be from NetworkCapabilities#NET_CAPABILITIES_* constants. [IP config] Optional. If empty or not specified - DHCP will be used, otherwise use the following format to specify static IP configuration: - ip=<ip-address/mask> gateway=<ip-address> dns=<comma-sep-ip-addresses> - domains=<comma-sep-domains> + ip=<ip-address/mask> gateway=<ip-address> dns=<comma-sep-ip-addresses> + domains=<comma-sep-domains> --> <string-array translatable="false" name="config_ethernet_interfaces"> <!-- @@ -3553,4 +3553,8 @@ <!-- Whether or not the "SMS app service" feature is enabled --> <bool name="config_useSmsAppService">true</bool> + + <!-- Component name for default assistant on this device --> + <string name="config_defaultAssistantComponentName">#+UNSET</string> + </resources> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 7e7c7b252e21..58d93654d9ba 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3478,4 +3478,6 @@ <java-symbol type="fraction" name="config_prescaleAbsoluteVolume_index3" /> <java-symbol type="bool" name="config_useSmsAppService" /> + + <java-symbol type="string" name="config_defaultAssistantComponentName" /> </resources> |