Skip to content
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 @@ -31,6 +31,7 @@
import android.widget.CheckBox;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Spinner;

import com.mobileer.audio_device.CommunicationDeviceSpinner;

Expand All @@ -44,6 +45,7 @@ public class CommunicationDeviceView extends LinearLayout {
private BroadcastReceiver mScoStateReceiver;
private boolean mScoStateReceiverRegistered = false;
private CommunicationDeviceSpinner mDeviceSpinner;
private Spinner mModeSpinner;
private int mScoState;

private AudioManager.OnCommunicationDeviceChangedListener mCommDeviceListener;
Expand Down Expand Up @@ -141,6 +143,19 @@ public void onNothingSelected(AdapterView<?> parent) {
}
});

mModeSpinner = (Spinner) findViewById(R.id.spinnerAudioMode);
mModeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
Log.d("OboeTester", "CommunicationDeviceView: setting audio mode to " + l);
mAudioManager.setMode((int) l);
}

@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});

showCommDeviceStatus();
}

Expand Down Expand Up @@ -168,6 +183,7 @@ public void onStop() {
mAudioManager.removeOnCommunicationDeviceChangedListener(mCommDeviceListener);
}
}
mAudioManager.setMode(AudioManager.MODE_NORMAL);
}

public void onSetSpeakerphoneOn(View view) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class MainActivity extends BaseOboeTesterActivity {
public static final String VALUE_TEST_NAME_INPUT = "input";
public static final String VALUE_TEST_NAME_CPU_LOAD = "cpu_load";

private Spinner mModeSpinner;

private TextView mCallbackSizeEditor;
protected TextView mDeviceView;
private TextView mVersionTextView;
Expand Down Expand Up @@ -78,22 +78,6 @@ protected void onCreate(Bundle savedInstanceState) {
mDeviceView = (TextView) findViewById(R.id.deviceView);
updateNativeAudioUI();

// Set mode, eg. MODE_IN_COMMUNICATION
mModeSpinner = (Spinner) findViewById(R.id.spinnerAudioMode);
// Update AudioManager now in case user is trying to affect a different app.
mModeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
long mode = mModeSpinner.getSelectedItemId();
AudioManager myAudioMgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
myAudioMgr.setMode((int)mode);
}

@Override
public void onNothingSelected(AdapterView<?> adapterView) {
}
});

try {
PackageInfo pinfo = getPackageManager().getPackageInfo(getPackageName(), 0);
int oboeVersion = OboeAudioStream.getOboeVersionNumber();
Expand Down Expand Up @@ -271,9 +255,7 @@ public void onLaunchExtratests(View view) {
private void applyUserOptions() {
updateCallbackSize();

long mode = mModeSpinner.getSelectedItemId();
AudioManager myAudioMgr = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
myAudioMgr.setMode((int) mode);


NativeEngine.setWorkaroundsEnabled(mWorkaroundsCheckBox.isChecked());
TestAudioActivity.setBackgroundEnabled(mBackgroundCheckBox.isChecked());
Expand Down
13 changes: 0 additions & 13 deletions apps/OboeTester/app/src/main/res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -247,19 +247,6 @@
android:layout_height="wrap_content"
android:orientation="horizontal">

<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Mode:" />

<Spinner
android:id="@+id/spinnerAudioMode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:entries="@array/audio_modes"
android:prompt="@string/audio_mode_prompt" />

<TextView
android:id="@+id/deviceView"
android:layout_width="wrap_content"
Expand Down
17 changes: 17 additions & 0 deletions apps/OboeTester/app/src/main/res/layout/comm_device_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@
android:background="#FFE8E0F0"
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Audio Mode: " />

<Spinner
android:id="@+id/spinnerAudioMode"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:entries="@array/audio_modes" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
Loading