Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OboeTester: Fix foreground service permissions for tests not recording audio #2100

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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