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

Commit b2d60a68 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Get the HotwordDetectionService from the xml metadata" into sc-dev

parents e22b827b fd652d52
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -290,6 +290,7 @@ package android {
  public static final class R.attr {
    field public static final int allowClearUserDataOnFailedRestore = 16844288; // 0x1010600
    field public static final int hotwordDetectionService = 16844326; // 0x1010626
    field public static final int isVrOnly = 16844152; // 0x1010578
    field public static final int minExtensionVersion = 16844305; // 0x1010611
    field public static final int requiredSystemPropertyName = 16844133; // 0x1010565
+9 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package android.service.voice;

import android.Manifest;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.AppGlobals;
import android.content.ComponentName;
import android.content.pm.PackageManager;
@@ -44,6 +45,7 @@ public class VoiceInteractionServiceInfo {
    private ServiceInfo mServiceInfo;
    private String mSessionService;
    private String mRecognitionService;
    private String mHotwordDetectionService;
    private String mSettingsActivity;
    private boolean mSupportsAssist;
    private boolean mSupportsLaunchFromKeyguard;
@@ -133,6 +135,8 @@ public class VoiceInteractionServiceInfo {
                    false);
            mSupportsLocalInteraction = array.getBoolean(com.android.internal.
                    R.styleable.VoiceInteractionService_supportsLocalInteraction, false);
            mHotwordDetectionService = array.getString(com.android.internal.R.styleable
                    .VoiceInteractionService_hotwordDetectionService);
            array.recycle();
            if (mSessionService == null) {
                mParseError = "No sessionService specified";
@@ -181,4 +185,9 @@ public class VoiceInteractionServiceInfo {
    public boolean getSupportsLocalInteraction() {
        return mSupportsLocalInteraction;
    }

    @Nullable
    public String getHotwordDetectionService() {
        return mHotwordDetectionService;
    }
}
+3 −0
Original line number Diff line number Diff line
@@ -8500,6 +8500,9 @@
             interaction requests from an Activity. This flag is new in
             {@link android.os.Build.VERSION_CODES#N} and not used in previous versions. -->
        <attr name="supportsLocalInteraction" format="boolean" />
        <!-- The service that provides {@link android.service.voice.HotwordDetectionService}.
             @hide @SystemApi -->
        <attr name="hotwordDetectionService" format="string" />
    </declare-styleable>
    <!-- Use <code>voice-enrollment-application</code>
+2 −0
Original line number Diff line number Diff line
@@ -3059,6 +3059,8 @@
    <public name="hand_second" />
    <public name="memtagMode" />
    <public name="nativeHeapZeroInit" />
    <!-- @hide @SystemApi -->
    <public name="hotwordDetectionService" />
  </public-group>

  <public-group type="drawable" first-id="0x010800b5">
+12 −3
Original line number Diff line number Diff line
@@ -163,8 +163,13 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne
        mValid = true;
        mSessionComponentName = new ComponentName(service.getPackageName(),
                mInfo.getSessionService());
        // TODO : Need to get the hotword detection service from the xml metadata
        final String hotwordDetectionServiceName = mInfo.getHotwordDetectionService();
        if (hotwordDetectionServiceName != null) {
            mHotwordDetectionComponentName = new ComponentName(service.getPackageName(),
                    hotwordDetectionServiceName);
        } else {
            mHotwordDetectionComponentName = null;
        }
        mIWindowManager = IWindowManager.Stub.asInterface(
                ServiceManager.getService(Context.WINDOW_SERVICE));
        IntentFilter filter = new IntentFilter();
@@ -388,7 +393,11 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne
        if (DEBUG) {
            Slog.d(TAG, "setHotwordDetectionConfigLocked");
        }

        if (mHotwordDetectionComponentName == null) {
            Slog.e(TAG, "Calling setHotwordDetectionConfigLocked, but hotword detection service"
                    + " name not found");
            return VoiceInteractionService.HOTWORD_CONFIG_FAILURE;
        }
        if (!isIsolatedProcessLocked(mHotwordDetectionComponentName)) {
            return VoiceInteractionService.HOTWORD_CONFIG_FAILURE;
        }