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

Commit d2fa9c3e authored by Steve Elliott's avatar Steve Elliott Committed by Myles Watson
Browse files

DO NOT MERGE ANYWHERE: resolve merge conflicts of...

DO NOT MERGE ANYWHERE: resolve merge conflicts of 77c1f608 to oc-dr1-dev

Bug: 111603898
Test: manual
Change-Id: I5933f27f2fbd90a6de447fbf7f17063f6b7f1fb8
parents 893598cd 77c1f608
Loading
Loading
Loading
Loading
+29 −2
Original line number Diff line number Diff line
@@ -32,6 +32,11 @@ 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;

/**
 * Utility method for dealing with the assistant aspects of
 * {@link com.android.internal.app.IVoiceInteractionManagerService IVoiceInteractionManagerService}.
@@ -40,6 +45,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;

@@ -152,13 +165,27 @@ 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();
        }

        Intent intent = ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
                .getAssistIntent(false);
        if (UNSET.equals(defaultSetting)) {
            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();
        ResolveInfo info = pm.resolveActivityAsUser(intent, PackageManager.MATCH_DEFAULT_ONLY,
                userId);
+4 −0
Original line number Diff line number Diff line
@@ -2981,4 +2981,8 @@

    <!-- Allow SystemUI to show the shutdown dialog -->
    <bool name="config_showSysuiShutdown">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
@@ -3061,4 +3061,6 @@
  <java-symbol type="layout" name="shutdown_dialog" />
  <java-symbol type="dimen" name="chooser_service_spacing" />
  <java-symbol type="bool" name="config_showSysuiShutdown" />

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