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 test disconnect skips #1933

Merged
merged 1 commit into from
Oct 20, 2023
Merged
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 @@ -238,11 +238,14 @@ private void testConfiguration(boolean isInput,
return;
}

updateFailSkipButton(true);

String actualConfigText = "none";
mSkipTest = false;
mTestFailed = false;

// Try to synchronize with the current headset state, IN or OUT.
while (mAutomatedTestRunner.isThreadEnabled() && !mSkipTest) {
while (mAutomatedTestRunner.isThreadEnabled() && !mSkipTest && !mTestFailed) {
if (requestPlugin != (mPlugState == 0)) {
String message = "SYNC: " + (requestPlugin ? "UNplug" : "Plug IN") + " headset now!";
setInstructionsText(message);
Expand Down Expand Up @@ -337,7 +340,6 @@ private void testConfiguration(boolean isInput,
int oldPlugCount = mPlugCount;
if (!openFailed && valid) {
mTestFailed = false;
updateFailSkipButton(true);
// poll until stream started
while (!mTestFailed && mAutomatedTestRunner.isThreadEnabled() && !mSkipTest &&
stream.getState() == StreamConfiguration.STREAM_STATE_STARTING) {
Expand Down Expand Up @@ -371,22 +373,25 @@ private void testConfiguration(boolean isInput,
}
}

if (mTestFailed) {
// Check whether the peripheral has a microphone.
// Sometimes the microphones does not appear on the first HEADSET_PLUG event.
if (isInput && (mPlugMicrophone == 0)) {
hasMicFailed = true;
}
if (mSkipTest) {
setStatusText("Skipped");
} else {
int error = stream.getLastErrorCallbackResult();
if (error != StreamConfiguration.ERROR_DISCONNECTED) {
log("onErrorCallback error = " + error
+ ", expected " + StreamConfiguration.ERROR_DISCONNECTED);
mTestFailed = true;
if (mTestFailed) {
// Check whether the peripheral has a microphone.
// Sometimes the microphones does not appear on the first HEADSET_PLUG event.
if (isInput && (mPlugMicrophone == 0)) {
hasMicFailed = true;
}
} else {
int error = stream.getLastErrorCallbackResult();
if (error != StreamConfiguration.ERROR_DISCONNECTED) {
log("onErrorCallback error = " + error
+ ", expected " + StreamConfiguration.ERROR_DISCONNECTED);
mTestFailed = true;
}
}
setStatusText(mTestFailed ? "Failed" : "Passed - detected");
}

setStatusText(mTestFailed ? "Failed" : "Passed - detected");
}
updateFailSkipButton(false);
setInstructionsText("Wait...");
Expand Down