Loading core/java/android/service/voice/VoiceInteractionService.java +8 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.os.PersistableBundle; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SharedMemory; import android.os.SystemProperties; import android.provider.Settings; import android.util.ArraySet; import android.util.Log; Loading Loading @@ -131,6 +132,9 @@ public class VoiceInteractionService extends Service { @EnabledSince(targetSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE) static final long MULTIPLE_ACTIVE_HOTWORD_DETECTORS = 193232191L; private static final boolean SYSPROP_VISUAL_QUERY_SERVICE_ENABLED = SystemProperties.getBoolean("ro.hotword.visual_query_service_enabled", false); IVoiceInteractionService mInterface = new IVoiceInteractionService.Stub() { @Override public void ready() { Loading Loading @@ -947,6 +951,10 @@ public class VoiceInteractionService extends Service { Objects.requireNonNull(executor); Objects.requireNonNull(callback); if (!SYSPROP_VISUAL_QUERY_SERVICE_ENABLED) { throw new IllegalStateException("VisualQueryDetectionService is not enabled on this " + "system. Please set ro.hotword.visual_query_service_enabled to true."); } if (mSystemService == null) { throw new IllegalStateException("Not available until onReady() is called"); } Loading services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java +7 −2 Original line number Diff line number Diff line Loading @@ -27,9 +27,9 @@ import static com.android.internal.util.FrameworkStatsLog.HOTWORD_DETECTOR_KEYPH import static com.android.internal.util.FrameworkStatsLog.HOTWORD_DETECTOR_KEYPHRASE_TRIGGERED__RESULT__KEYPHRASE_TRIGGER; import static com.android.internal.util.FrameworkStatsLog.HOTWORD_DETECTOR_KEYPHRASE_TRIGGERED__RESULT__SERVICE_CRASH; import android.app.AppOpsManager; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.AppOpsManager; import android.compat.annotation.ChangeId; import android.compat.annotation.Disabled; import android.content.ComponentName; Loading @@ -50,6 +50,7 @@ import android.os.PersistableBundle; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SharedMemory; import android.os.SystemProperties; import android.provider.DeviceConfig; import android.service.voice.HotwordDetectionService; import android.service.voice.HotwordDetectionServiceFailure; Loading Loading @@ -114,6 +115,9 @@ final class HotwordDetectionConnection { private static final long RESET_DEBUG_HOTWORD_LOGGING_TIMEOUT_MILLIS = 60 * 60 * 1000; // 1 hour private static final int MAX_ISOLATED_PROCESS_NUMBER = 10; private static final boolean SYSPROP_VISUAL_QUERY_SERVICE_ENABLED = SystemProperties.getBoolean("ro.hotword.visual_query_service_enabled", false); /** * Indicates the {@link HotwordDetectionService} is created. */ Loading Loading @@ -680,7 +684,8 @@ final class HotwordDetectionConnection { mIntent = intent; mDetectionServiceType = detectionServiceType; int flags = bindInstantServiceAllowed ? Context.BIND_ALLOW_INSTANT : 0; if (mVisualQueryDetectionComponentName != null if (SYSPROP_VISUAL_QUERY_SERVICE_ENABLED && mVisualQueryDetectionComponentName != null && mHotwordDetectionComponentName != null) { flags |= Context.BIND_SHARED_ISOLATED_PROCESS; } Loading services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java +5 −1 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ import android.os.RemoteCallback; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SharedMemory; import android.os.SystemProperties; import android.os.UserHandle; import android.service.voice.HotwordDetector; import android.service.voice.IMicrophoneHotwordDetectionVoiceInteractionCallback; Loading Loading @@ -96,6 +97,8 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne /** The delay time for retrying to request DirectActions. */ private static final long REQUEST_DIRECT_ACTIONS_RETRY_TIME_MS = 200; private static final boolean SYSPROP_VISUAL_QUERY_SERVICE_ENABLED = SystemProperties.getBoolean("ro.hotword.visual_query_service_enabled", false); final boolean mValid; Loading Loading @@ -715,7 +718,7 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne } else { verifyDetectorForVisualQueryDetectionLocked(sharedMemory); } if (!verifyProcessSharingLocked()) { if (SYSPROP_VISUAL_QUERY_SERVICE_ENABLED && !verifyProcessSharingLocked()) { Slog.w(TAG, "Sandboxed detection service not in shared isolated process"); throw new IllegalStateException("VisualQueryDetectionService or HotworDetectionService " + "not in a shared isolated process. Please make sure to set " Loading Loading @@ -914,6 +917,7 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne if (hotwordInfo == null || visualQueryInfo == null) { return true; } // Enforce shared isolated option is used when VisualQueryDetectionservice is enabled return (hotwordInfo.flags & ServiceInfo.FLAG_ALLOW_SHARED_ISOLATED_PROCESS) != 0 && (visualQueryInfo.flags & ServiceInfo.FLAG_ALLOW_SHARED_ISOLATED_PROCESS) != 0; } Loading Loading
core/java/android/service/voice/VoiceInteractionService.java +8 −0 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ import android.os.PersistableBundle; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SharedMemory; import android.os.SystemProperties; import android.provider.Settings; import android.util.ArraySet; import android.util.Log; Loading Loading @@ -131,6 +132,9 @@ public class VoiceInteractionService extends Service { @EnabledSince(targetSdkVersion = Build.VERSION_CODES.UPSIDE_DOWN_CAKE) static final long MULTIPLE_ACTIVE_HOTWORD_DETECTORS = 193232191L; private static final boolean SYSPROP_VISUAL_QUERY_SERVICE_ENABLED = SystemProperties.getBoolean("ro.hotword.visual_query_service_enabled", false); IVoiceInteractionService mInterface = new IVoiceInteractionService.Stub() { @Override public void ready() { Loading Loading @@ -947,6 +951,10 @@ public class VoiceInteractionService extends Service { Objects.requireNonNull(executor); Objects.requireNonNull(callback); if (!SYSPROP_VISUAL_QUERY_SERVICE_ENABLED) { throw new IllegalStateException("VisualQueryDetectionService is not enabled on this " + "system. Please set ro.hotword.visual_query_service_enabled to true."); } if (mSystemService == null) { throw new IllegalStateException("Not available until onReady() is called"); } Loading
services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java +7 −2 Original line number Diff line number Diff line Loading @@ -27,9 +27,9 @@ import static com.android.internal.util.FrameworkStatsLog.HOTWORD_DETECTOR_KEYPH import static com.android.internal.util.FrameworkStatsLog.HOTWORD_DETECTOR_KEYPHRASE_TRIGGERED__RESULT__KEYPHRASE_TRIGGER; import static com.android.internal.util.FrameworkStatsLog.HOTWORD_DETECTOR_KEYPHRASE_TRIGGERED__RESULT__SERVICE_CRASH; import android.app.AppOpsManager; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.AppOpsManager; import android.compat.annotation.ChangeId; import android.compat.annotation.Disabled; import android.content.ComponentName; Loading @@ -50,6 +50,7 @@ import android.os.PersistableBundle; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SharedMemory; import android.os.SystemProperties; import android.provider.DeviceConfig; import android.service.voice.HotwordDetectionService; import android.service.voice.HotwordDetectionServiceFailure; Loading Loading @@ -114,6 +115,9 @@ final class HotwordDetectionConnection { private static final long RESET_DEBUG_HOTWORD_LOGGING_TIMEOUT_MILLIS = 60 * 60 * 1000; // 1 hour private static final int MAX_ISOLATED_PROCESS_NUMBER = 10; private static final boolean SYSPROP_VISUAL_QUERY_SERVICE_ENABLED = SystemProperties.getBoolean("ro.hotword.visual_query_service_enabled", false); /** * Indicates the {@link HotwordDetectionService} is created. */ Loading Loading @@ -680,7 +684,8 @@ final class HotwordDetectionConnection { mIntent = intent; mDetectionServiceType = detectionServiceType; int flags = bindInstantServiceAllowed ? Context.BIND_ALLOW_INSTANT : 0; if (mVisualQueryDetectionComponentName != null if (SYSPROP_VISUAL_QUERY_SERVICE_ENABLED && mVisualQueryDetectionComponentName != null && mHotwordDetectionComponentName != null) { flags |= Context.BIND_SHARED_ISOLATED_PROCESS; } Loading
services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java +5 −1 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ import android.os.RemoteCallback; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SharedMemory; import android.os.SystemProperties; import android.os.UserHandle; import android.service.voice.HotwordDetector; import android.service.voice.IMicrophoneHotwordDetectionVoiceInteractionCallback; Loading Loading @@ -96,6 +97,8 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne /** The delay time for retrying to request DirectActions. */ private static final long REQUEST_DIRECT_ACTIONS_RETRY_TIME_MS = 200; private static final boolean SYSPROP_VISUAL_QUERY_SERVICE_ENABLED = SystemProperties.getBoolean("ro.hotword.visual_query_service_enabled", false); final boolean mValid; Loading Loading @@ -715,7 +718,7 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne } else { verifyDetectorForVisualQueryDetectionLocked(sharedMemory); } if (!verifyProcessSharingLocked()) { if (SYSPROP_VISUAL_QUERY_SERVICE_ENABLED && !verifyProcessSharingLocked()) { Slog.w(TAG, "Sandboxed detection service not in shared isolated process"); throw new IllegalStateException("VisualQueryDetectionService or HotworDetectionService " + "not in a shared isolated process. Please make sure to set " Loading Loading @@ -914,6 +917,7 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne if (hotwordInfo == null || visualQueryInfo == null) { return true; } // Enforce shared isolated option is used when VisualQueryDetectionservice is enabled return (hotwordInfo.flags & ServiceInfo.FLAG_ALLOW_SHARED_ISOLATED_PROCESS) != 0 && (visualQueryInfo.flags & ServiceInfo.FLAG_ALLOW_SHARED_ISOLATED_PROCESS) != 0; } Loading