Loading services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java +6 −1 Original line number Diff line number Diff line Loading @@ -621,8 +621,13 @@ final class HotwordDetectionConnection { ServiceConnectionFactory(@NonNull Intent intent, boolean bindInstantServiceAllowed, int detectionServiceType) { mIntent = intent; mBindingFlags = bindInstantServiceAllowed ? Context.BIND_ALLOW_INSTANT : 0; mDetectionServiceType = detectionServiceType; int flags = bindInstantServiceAllowed ? Context.BIND_ALLOW_INSTANT : 0; if (mVisualQueryDetectionComponentName != null && mHotwordDetectionComponentName != null) { flags |= Context.BIND_SHARED_ISOLATED_PROCESS; } mBindingFlags = flags; } ServiceConnection createLocked() { Loading services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java +20 −0 Original line number Diff line number Diff line Loading @@ -738,6 +738,13 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne } else { verifyDetectorForVisualQueryDetectionLocked(sharedMemory); } if (!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 " + "android:allowSharedIsolatedProcess and android:isolatedProcess to be true " + "and android:externalService to be false in the manifest file"); } if (mHotwordDetectionConnection == null) { mHotwordDetectionConnection = new HotwordDetectionConnection(mServiceStub, mContext, Loading Loading @@ -931,6 +938,19 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne return (serviceInfo.flags & ServiceInfo.FLAG_ISOLATED_PROCESS) != 0 && (serviceInfo.flags & ServiceInfo.FLAG_EXTERNAL_SERVICE) == 0; } @GuardedBy("this") boolean verifyProcessSharingLocked() { // only check this if both VQDS and HDS are declared in the app ServiceInfo hotwordInfo = getServiceInfoLocked(mHotwordDetectionComponentName, mUser); ServiceInfo visualQueryInfo = getServiceInfoLocked(mVisualQueryDetectionComponentName, mUser); if (hotwordInfo == null || visualQueryInfo == null) { return true; } return (hotwordInfo.flags & ServiceInfo.FLAG_ALLOW_SHARED_ISOLATED_PROCESS) != 0 && (visualQueryInfo.flags & ServiceInfo.FLAG_ALLOW_SHARED_ISOLATED_PROCESS) != 0; } void forceRestartHotwordDetector() { if (mHotwordDetectionConnection == null) { Loading Loading
services/voiceinteraction/java/com/android/server/voiceinteraction/HotwordDetectionConnection.java +6 −1 Original line number Diff line number Diff line Loading @@ -621,8 +621,13 @@ final class HotwordDetectionConnection { ServiceConnectionFactory(@NonNull Intent intent, boolean bindInstantServiceAllowed, int detectionServiceType) { mIntent = intent; mBindingFlags = bindInstantServiceAllowed ? Context.BIND_ALLOW_INSTANT : 0; mDetectionServiceType = detectionServiceType; int flags = bindInstantServiceAllowed ? Context.BIND_ALLOW_INSTANT : 0; if (mVisualQueryDetectionComponentName != null && mHotwordDetectionComponentName != null) { flags |= Context.BIND_SHARED_ISOLATED_PROCESS; } mBindingFlags = flags; } ServiceConnection createLocked() { Loading
services/voiceinteraction/java/com/android/server/voiceinteraction/VoiceInteractionManagerServiceImpl.java +20 −0 Original line number Diff line number Diff line Loading @@ -738,6 +738,13 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne } else { verifyDetectorForVisualQueryDetectionLocked(sharedMemory); } if (!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 " + "android:allowSharedIsolatedProcess and android:isolatedProcess to be true " + "and android:externalService to be false in the manifest file"); } if (mHotwordDetectionConnection == null) { mHotwordDetectionConnection = new HotwordDetectionConnection(mServiceStub, mContext, Loading Loading @@ -931,6 +938,19 @@ class VoiceInteractionManagerServiceImpl implements VoiceInteractionSessionConne return (serviceInfo.flags & ServiceInfo.FLAG_ISOLATED_PROCESS) != 0 && (serviceInfo.flags & ServiceInfo.FLAG_EXTERNAL_SERVICE) == 0; } @GuardedBy("this") boolean verifyProcessSharingLocked() { // only check this if both VQDS and HDS are declared in the app ServiceInfo hotwordInfo = getServiceInfoLocked(mHotwordDetectionComponentName, mUser); ServiceInfo visualQueryInfo = getServiceInfoLocked(mVisualQueryDetectionComponentName, mUser); if (hotwordInfo == null || visualQueryInfo == null) { return true; } return (hotwordInfo.flags & ServiceInfo.FLAG_ALLOW_SHARED_ISOLATED_PROCESS) != 0 && (visualQueryInfo.flags & ServiceInfo.FLAG_ALLOW_SHARED_ISOLATED_PROCESS) != 0; } void forceRestartHotwordDetector() { if (mHotwordDetectionConnection == null) { Loading