Skip to content

Commit

Permalink
OboeTester: Fix foreground service permissions for tests not recordin…
Browse files Browse the repository at this point in the history
…g audio (#2100)
  • Loading branch information
robertwu1 authored Sep 5, 2024
1 parent c11d4c1 commit ec66d0a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis
/**
* If needed, request recording permission before running test.
*/
protected void launchTestThatDoesRecording(Class clazz) {
protected void launchTestThatRequiresRecordingPermissions(Class clazz) {
mTestClass = clazz;
if (isRecordPermissionGranted()) {
beginTestThatRequiresRecording();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void onLaunchMainActivity(View view) {
}

public void onLaunchExternalTapTest(View view) {
launchTestThatDoesRecording(ExternalTapToToneActivity.class);
launchTestThatRequiresRecordingPermissions(ExternalTapToToneActivity.class);
}

public void onLaunchPlugLatencyTest(View view) {
Expand All @@ -28,7 +28,7 @@ public void onLaunchErrorCallbackTest(View view) {
}

public void onLaunchRouteDuringCallbackTest(View view) {
launchTestThatDoesRecording(TestRouteDuringCallbackActivity.class);
launchTestThatRequiresRecordingPermissions(TestRouteDuringCallbackActivity.class);
}

public void onLaunchDynamicWorkloadTest(View view) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,49 +206,61 @@ private void updateNativeAudioUI() {
}

public void onLaunchTestOutput(View view) {
launchTestActivity(TestOutputActivity.class);
if (mForegroundServiceCheckBox.isChecked()) {
launchTestThatRequiresRecordingPermissions(TestOutputActivity.class);
} else {
launchTestActivity(TestOutputActivity.class);
}
}

public void onLaunchTestInput(View view) {
launchTestThatDoesRecording(TestInputActivity.class);
launchTestThatRequiresRecordingPermissions(TestInputActivity.class);
}

public void onLaunchTapToTone(View view) {
launchTestThatDoesRecording(TapToToneActivity.class);
launchTestThatRequiresRecordingPermissions(TapToToneActivity.class);
}

public void onLaunchRecorder(View view) {
launchTestThatDoesRecording(RecorderActivity.class);
launchTestThatRequiresRecordingPermissions(RecorderActivity.class);
}

public void onLaunchEcho(View view) {
launchTestThatDoesRecording(EchoActivity.class);
launchTestThatRequiresRecordingPermissions(EchoActivity.class);
}

public void onLaunchRoundTripLatency(View view) {
launchTestThatDoesRecording(RoundTripLatencyActivity.class);
launchTestThatRequiresRecordingPermissions(RoundTripLatencyActivity.class);
}

public void onLaunchManualGlitchTest(View view) {
launchTestThatDoesRecording(ManualGlitchActivity.class);
launchTestThatRequiresRecordingPermissions(ManualGlitchActivity.class);
}

public void onLaunchAutoGlitchTest(View view) { launchTestThatDoesRecording(AutomatedGlitchActivity.class); }
public void onLaunchAutoGlitchTest(View view) { launchTestThatRequiresRecordingPermissions(AutomatedGlitchActivity.class); }

public void onLaunchTestDisconnect(View view) {
launchTestThatDoesRecording(TestDisconnectActivity.class);
launchTestThatRequiresRecordingPermissions(TestDisconnectActivity.class);
}

public void onLaunchTestDataPaths(View view) {
launchTestThatDoesRecording(TestDataPathsActivity.class);
launchTestThatRequiresRecordingPermissions(TestDataPathsActivity.class);
}

public void onLaunchTestDeviceReport(View view) {
launchTestActivity(DeviceReportActivity.class);
if (mForegroundServiceCheckBox.isChecked()) {
launchTestThatRequiresRecordingPermissions(DeviceReportActivity.class);
} else {
launchTestActivity(DeviceReportActivity.class);
}
}

public void onLaunchExtratests(View view) {
launchTestActivity(ExtraTestsActivity.class);
if (mForegroundServiceCheckBox.isChecked()) {
launchTestThatRequiresRecordingPermissions(ExtraTestsActivity.class);
} else {
launchTestActivity(ExtraTestsActivity.class);
}
}

private void applyUserOptions() {
Expand Down

0 comments on commit ec66d0a

Please sign in to comment.