Merge "Add configurable default setting for assistant componentname" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
afda78ad15
@@ -32,6 +32,8 @@ import android.os.ServiceManager;
|
|||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.android.internal.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method for dealing with the assistant aspects of
|
* Utility method for dealing with the assistant aspects of
|
||||||
* {@link com.android.internal.app.IVoiceInteractionManagerService IVoiceInteractionManagerService}.
|
* {@link com.android.internal.app.IVoiceInteractionManagerService IVoiceInteractionManagerService}.
|
||||||
@@ -40,6 +42,14 @@ public class AssistUtils {
|
|||||||
|
|
||||||
private static final String TAG = "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 Context mContext;
|
||||||
private final IVoiceInteractionManagerService mVoiceInteractionManagerService;
|
private final IVoiceInteractionManagerService mVoiceInteractionManagerService;
|
||||||
|
|
||||||
@@ -154,7 +164,7 @@ public class AssistUtils {
|
|||||||
|
|
||||||
final String defaultSetting = mContext.getResources().getString(
|
final String defaultSetting = mContext.getResources().getString(
|
||||||
R.string.config_defaultAssistantComponentName);
|
R.string.config_defaultAssistantComponentName);
|
||||||
if (defaultSetting != null) {
|
if (defaultSetting != null && !defaultSetting.equals(UNSET)) {
|
||||||
return ComponentName.unflattenFromString(defaultSetting);
|
return ComponentName.unflattenFromString(defaultSetting);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,6 +172,11 @@ public class AssistUtils {
|
|||||||
if (activeServiceSupportsAssistGesture()) {
|
if (activeServiceSupportsAssistGesture()) {
|
||||||
return getActiveServiceComponentName();
|
return getActiveServiceComponentName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (UNSET.equals(defaultSetting)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
final SearchManager searchManager =
|
final SearchManager searchManager =
|
||||||
(SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
|
(SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
|
||||||
if (searchManager == null) {
|
if (searchManager == null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user