DO NOT MERGE ANYWHERE: resolve merge conflicts of 77c1f60801 to oc-dr1-dev
Bug: 111603898 Test: manual Change-Id: I5933f27f2fbd90a6de447fbf7f17063f6b7f1fb8
This commit is contained in:
@@ -32,6 +32,11 @@ 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;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 +45,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;
|
||||||
|
|
||||||
@@ -152,13 +165,27 @@ public class AssistUtils {
|
|||||||
return ComponentName.unflattenFromString(setting);
|
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.
|
// Fallback to keep backward compatible behavior when there is no user setting.
|
||||||
if (activeServiceSupportsAssistGesture()) {
|
if (activeServiceSupportsAssistGesture()) {
|
||||||
return getActiveServiceComponentName();
|
return getActiveServiceComponentName();
|
||||||
}
|
}
|
||||||
|
|
||||||
Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
|
if (UNSET.equals(defaultSetting)) {
|
||||||
.getAssistIntent(false);
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
final SearchManager searchManager =
|
||||||
|
(SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE);
|
||||||
|
if (searchManager == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
final Intent intent = searchManager.getAssistIntent(false);
|
||||||
PackageManager pm = mContext.getPackageManager();
|
PackageManager pm = mContext.getPackageManager();
|
||||||
ResolveInfo info = pm.resolveActivityAsUser(intent, PackageManager.MATCH_DEFAULT_ONLY,
|
ResolveInfo info = pm.resolveActivityAsUser(intent, PackageManager.MATCH_DEFAULT_ONLY,
|
||||||
userId);
|
userId);
|
||||||
|
|||||||
@@ -2981,4 +2981,8 @@
|
|||||||
|
|
||||||
<!-- Allow SystemUI to show the shutdown dialog -->
|
<!-- Allow SystemUI to show the shutdown dialog -->
|
||||||
<bool name="config_showSysuiShutdown">true</bool>
|
<bool name="config_showSysuiShutdown">true</bool>
|
||||||
|
|
||||||
|
<!-- Component name for default assistant on this device -->
|
||||||
|
<string name="config_defaultAssistantComponentName">#+UNSET</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -3061,4 +3061,6 @@
|
|||||||
<java-symbol type="layout" name="shutdown_dialog" />
|
<java-symbol type="layout" name="shutdown_dialog" />
|
||||||
<java-symbol type="dimen" name="chooser_service_spacing" />
|
<java-symbol type="dimen" name="chooser_service_spacing" />
|
||||||
<java-symbol type="bool" name="config_showSysuiShutdown" />
|
<java-symbol type="bool" name="config_showSysuiShutdown" />
|
||||||
|
|
||||||
|
<java-symbol type="string" name="config_defaultAssistantComponentName" />
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user