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

Commit b1be18a8 authored by Nate Myren's avatar Nate Myren
Browse files

Do not fail Recognition on MODE_IGNORED for preflight

Recognition will fail upon attempting to open the microphone, if it is
accessed.

Bug: 197465285
Test: manual
Change-Id: I83f1ae30295caf576eb7a6f0191313cb789f1d52
parent 4ae5386a
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ public abstract class RecognitionService extends Service {
            @NonNull AttributionSource attributionSource) {
        try {
            if (mCurrentCallback == null) {
                boolean preflightPermissionCheckPassed = checkPermissionForPreflight(
                boolean preflightPermissionCheckPassed = checkPermissionForPreflightNotHardDenied(
                        attributionSource);
                if (preflightPermissionCheckPassed) {
                    if (DBG) {
@@ -470,10 +470,11 @@ public abstract class RecognitionService extends Service {
        return mStartedDataDelivery;
    }

    private boolean checkPermissionForPreflight(AttributionSource attributionSource) {
        return PermissionChecker.checkPermissionForPreflight(RecognitionService.this,
                Manifest.permission.RECORD_AUDIO, attributionSource)
                == PermissionChecker.PERMISSION_GRANTED;
    private boolean checkPermissionForPreflightNotHardDenied(AttributionSource attributionSource) {
        int result = PermissionChecker.checkPermissionForPreflight(RecognitionService.this,
                Manifest.permission.RECORD_AUDIO, attributionSource);
        return result == PermissionChecker.PERMISSION_GRANTED
                || result == PermissionChecker.PERMISSION_SOFT_DENIED;
    }

    void finishDataDelivery() {