diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/BaseAutoGlitchActivity.java b/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/BaseAutoGlitchActivity.java index e19b5eff4..0c462a68c 100644 --- a/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/BaseAutoGlitchActivity.java +++ b/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/BaseAutoGlitchActivity.java @@ -80,6 +80,7 @@ private static class TestStreamOptions { public final int mmapUsed; public final int performanceMode; public final int sharingMode; + public final int sessionId; public TestStreamOptions(StreamConfiguration configuration, int channelUsed) { this.channelUsed = channelUsed; @@ -89,6 +90,7 @@ public TestStreamOptions(StreamConfiguration configuration, int channelUsed) { mmapUsed = configuration.isMMap() ? 1 : 0; performanceMode = configuration.getPerformanceMode(); sharingMode = configuration.getSharingMode(); + sessionId = configuration.getSessionId(); } int countDifferences(TestStreamOptions other) { @@ -100,6 +102,7 @@ int countDifferences(TestStreamOptions other) { count += (mmapUsed != other.mmapUsed) ? 1 : 0; count += (performanceMode != other.performanceMode) ? 1 : 0; count += (sharingMode != other.sharingMode) ? 1 : 0; + count += (sessionId != other.sessionId) ? 1 : 0; return count; } @@ -112,6 +115,7 @@ public String comparePassedDirection(String prefix, TestStreamOptions passed) { text.append(TestDataPathsActivity.comparePassedField(prefix,this, passed, "mmapUsed")); text.append(TestDataPathsActivity.comparePassedField(prefix,this, passed, "performanceMode")); text.append(TestDataPathsActivity.comparePassedField(prefix,this, passed, "sharingMode")); + text.append(TestDataPathsActivity.comparePassedField(prefix,this, passed, "sessionId")); return text.toString(); } @Override @@ -236,6 +240,7 @@ protected String getConfigText(StreamConfiguration config) { + ", ID = " + String.format(Locale.getDefault(), "%2d", config.getDeviceId()) + ", Perf = " + StreamConfiguration.convertPerformanceModeToText( config.getPerformanceMode()) + + ((config.getSessionId() > 0) ? (", sessionId = " + config.getSessionId()) : "") + ",\n ch = " + channelText(channel, config.getChannelCount()) + ", cm = " + convertChannelMaskToText(config.getChannelMask()); } diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/TestDataPathsActivity.java b/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/TestDataPathsActivity.java index bfe4b83df..f0936ecad 100644 --- a/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/TestDataPathsActivity.java +++ b/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/TestDataPathsActivity.java @@ -17,6 +17,7 @@ package com.mobileer.oboetester; import static com.mobileer.oboetester.IntentBasedTestSupport.configureStreamsFromBundle; +import static com.mobileer.oboetester.StreamConfiguration.UNSPECIFIED; import static com.mobileer.oboetester.StreamConfiguration.convertChannelMaskToText; import android.app.Instrumentation; @@ -37,6 +38,8 @@ import java.lang.reflect.Field; import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; import java.util.Locale; /** @@ -572,6 +575,8 @@ private void testDeviceOutputInfo(AudioDeviceInfo outputDeviceInfo) throws Inte requestedOutConfig.setDeviceId(outputDeviceInfo.getId()); resetChannelConfigurations(requestedInConfig, requestedOutConfig); + testBug_270535408(inputDeviceInfo, outputDeviceInfo); + if (mCheckBoxAllChannels.isChecked()) { runOnUiThread(() -> mCheckBoxAllChannels.setEnabled(false)); testOutputChannelCounts(inputDeviceInfo, outputDeviceInfo); @@ -695,7 +700,7 @@ public static int findLargestInt(int[] arr) { private void testOutputChannelCounts(AudioDeviceInfo inputDeviceInfo, AudioDeviceInfo outputDeviceInfo) throws InterruptedException { logSection("Output Channel Counts"); - ArrayList channelCountsTested =new ArrayList(); + ArrayList channelCountsTested = new ArrayList(); StreamConfiguration requestedInConfig = mAudioInputTester.requestedConfiguration; StreamConfiguration requestedOutConfig = mAudioOutTester.requestedConfiguration; @@ -767,6 +772,26 @@ private void testMatchingChannels(int numChannels) throws InterruptedException { } } + // b/270535408 | no input when channels=3 and sessionId is allocated + private void testBug_270535408(AudioDeviceInfo inputDeviceInfo, + AudioDeviceInfo outputDeviceInfo) throws InterruptedException { + int[] inputChannelCounts = inputDeviceInfo.getChannelCounts(); + if (findLargestChannelCount(inputChannelCounts) >= 3) { + logSection("Bug 270535408, 3ch + SessionId"); + StreamConfiguration requestedInConfig = mAudioInputTester.requestedConfiguration; + StreamConfiguration requestedOutConfig = mAudioOutTester.requestedConfiguration; + requestedInConfig.setChannelCount(3); + requestedInConfig.setSessionId(AudioManager.AUDIO_SESSION_ID_GENERATE); + requestedInConfig.setPerformanceMode(StreamConfiguration.PERFORMANCE_MODE_LOW_LATENCY); + requestedOutConfig.setPerformanceMode(StreamConfiguration.PERFORMANCE_MODE_LOW_LATENCY); + testCurrentConfigurations(); + // Now test without a sessionId so we have a passing test to compare with. + requestedInConfig.setSessionId(-1); // AAUDIO_SESSION_ID_NONE + testCurrentConfigurations(); + requestedInConfig.setChannelCount(UNSPECIFIED); + } + } + private void testPerformancePaths() throws InterruptedException { StreamConfiguration requestedInConfig = mAudioInputTester.requestedConfiguration; StreamConfiguration requestedOutConfig = mAudioOutTester.requestedConfiguration;