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

Commit d9a274cf authored by Nate Myren's avatar Nate Myren Committed by Android (Google) Code Review
Browse files

Merge "Do not fail Recognition on MODE_IGNORED for preflight" into sc-qpr1-dev

parents 2494a839 922e104b
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() {