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

Commit 22e87752 authored by Sandeep Bandaru's avatar Sandeep Bandaru
Browse files

Handle race condition in isKnownIsolatedComputeApp

Assign HotwordDetectionServiceProvider to local variable before checking for null etc.

Bug: 436236152
Test: make
Flag: EXEMPT bugfix
Change-Id: I8f52afbbe7981cd3eb758daad4c003f906a76dbf
parent 4e13a4e0
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -143,6 +143,7 @@ import com.android.server.ondeviceintelligence.OnDeviceIntelligenceManagerLocal;
import com.android.server.pm.parsing.PackageInfoUtils;
import com.android.server.pm.parsing.pkg.AndroidPackageUtils;
import com.android.server.pm.permission.PermissionManagerServiceInternal;
import com.android.server.pm.permission.PermissionManagerServiceInternal.HotwordDetectionServiceProvider;
import com.android.server.pm.pkg.AndroidPackage;
import com.android.server.pm.pkg.PackageState;
import com.android.server.pm.pkg.PackageStateInternal;
@@ -5780,10 +5781,11 @@ public class ComputerEngine implements Computer {
        if (!Process.isIsolatedUid(uid)) {
            return false;
        }
        final HotwordDetectionServiceProvider hotwordDetectionServiceProvider =
                mPermissionManager.getHotwordDetectionServiceProvider();
        final boolean isHotword =
                mPermissionManager.getHotwordDetectionServiceProvider() != null
                        && uid
                        == mPermissionManager.getHotwordDetectionServiceProvider().getUid();
                 hotwordDetectionServiceProvider != null
                        && uid == hotwordDetectionServiceProvider.getUid();
        if (isHotword) {
            return true;
        }
+1 −1
Original line number Diff line number Diff line
@@ -475,7 +475,7 @@ public interface PermissionManagerServiceInternal extends PermissionManagerInter
     * {@link android.service.voice.HotwordDetectionService}, which should be granted RECORD_AUDIO,
     * CAPTURE_AUDIO_HOTWORD and CAPTURE_AUDIO_OUTPUT permissions.
     */
    interface HotwordDetectionServiceProvider {
    public interface HotwordDetectionServiceProvider {
        int getUid();
    }
}