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

Commit 3438a233 authored by Michael W's avatar Michael W Committed by Bruno Martins
Browse files

Recorder: Fix wrong denial message in Recorder

* After starting a screen recording for the first time, the user is
  requested to accept the necessary permissions
* Upon accepting, without this patch there is a "you have denied" message
  once
* Fix this by checking the required permissions properly instead

Change-Id: I82ef806f989f344111b6e4947ca0f9a3763e0bde
parent bc2cfef5
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -170,7 +170,8 @@ public class RecorderActivity extends AppCompatActivity implements
    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
                                           @NonNull int[] results) {
        if (hasAllPermissions()) {
        if (requestCode == REQUEST_SCREEN_REC_PERMS && hasAllScreenRecorderPermissions() ||
                requestCode == REQUEST_SOUND_REC_PERMS && hasAllAudioRecorderPermissions()) {
            toggleAfterPermissionRequest(requestCode);
            return;
        }
@@ -349,10 +350,14 @@ public class RecorderActivity extends AppCompatActivity implements
        return Settings.canDrawOverlays(this);
    }

    private boolean hasAllPermissions() {
    private boolean hasAllAudioRecorderPermissions() {
        return hasStoragePermission() && hasAudioPermission() && hasPhoneReaderPermission();
    }

    private boolean hasAllScreenRecorderPermissions() {
        return hasStoragePermission();
    }

    private boolean checkSoundRecPermissions() {
        ArrayList<String> permissions = new ArrayList<>();

@@ -420,7 +425,7 @@ public class RecorderActivity extends AppCompatActivity implements
    }

    private void bindSoundRecService() {
        if (mSoundService == null && hasAllPermissions()) {
        if (mSoundService == null && hasAllAudioRecorderPermissions()) {
            setupConnection();
            bindService(new Intent(this, SoundRecorderService.class),
                    mConnection, BIND_AUTO_CREATE);