Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5269abcf authored by Steve Elliott's avatar Steve Elliott Committed by Android (Google) Code Review
Browse files

Merge "Add configurable default setting for assistant componentname"

parents cfc152af 433c83dc
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -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) {
+6 −2
Original line number Diff line number Diff line
@@ -3557,4 +3557,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>
+2 −0
Original line number Diff line number Diff line
@@ -3481,4 +3481,6 @@
  <java-symbol type="fraction" name="config_prescaleAbsoluteVolume_index3" />

  <java-symbol type="bool" name="config_useSmsAppService" />

  <java-symbol type="string" name="config_defaultAssistantComponentName" />
</resources>