Merge pull request #773 from google/fixcbsize

honor setFramesPerCallback()
diff --git a/apps/OboeTester/app/src/main/cpp/NativeAudioContext.cpp b/apps/OboeTester/app/src/main/cpp/NativeAudioContext.cpp
index afeb4a5..5a145d4 100644
--- a/apps/OboeTester/app/src/main/cpp/NativeAudioContext.cpp
+++ b/apps/OboeTester/app/src/main/cpp/NativeAudioContext.cpp
@@ -131,11 +131,10 @@
     return result;
 }
 
-
 void ActivityContext::configureBuilder(bool isInput, oboe::AudioStreamBuilder &builder) {
     // We needed the proxy because we did not know the channelCount when we setup the Builder.
     if (mUseCallback) {
-        LOGD("ActivityContext::open() set callback to use oboeCallbackProxy, size = %d",
+        LOGD("ActivityContext::open() set callback to use oboeCallbackProxy, callback size = %d",
              callbackSize);
         builder.setCallback(&oboeCallbackProxy);
         builder.setFramesPerCallback(callbackSize);
@@ -198,9 +197,6 @@
 
     configureBuilder(isInput, builder);
 
-    if (audioApi == oboe::AudioApi::OpenSLES) {
-        builder.setFramesPerCallback(framesPerBurst);
-    }
     builder.setAudioApi(audioApi);
 
     // Temporarily set the AAudio MMAP policy to disable MMAP or not.
diff --git a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/MainActivity.java b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/MainActivity.java
index 80f5c62..4f09599 100644
--- a/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/MainActivity.java
+++ b/apps/OboeTester/app/src/main/java/com/google/sample/oboe/manualtest/MainActivity.java
@@ -32,6 +32,7 @@
 import android.widget.CheckBox;
 import android.widget.Spinner;
 import android.widget.TextView;
+import android.widget.Toast;
 
 /**
  * Select various Audio tests.
@@ -214,10 +215,31 @@
         OboeAudioStream.setUseCallback(checkBox.isChecked());
     }
 
+    protected void showErrorToast(String message) {
+        showToast("Error: " + message);
+    }
+
+    protected void showToast(final String message) {
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                Toast.makeText(MainActivity.this,
+                        message,
+                        Toast.LENGTH_SHORT).show();
+            }
+        });
+    }
+
     private void updateCallbackSize() {
         CharSequence chars = mCallbackSizeTextView.getText();
         String text = chars.toString();
-        int callbackSize = Integer.parseInt(text);
+        int callbackSize = 0;
+        try {
+            callbackSize = Integer.parseInt(text);
+        } catch (NumberFormatException e) {
+            showErrorToast("Badly formated callback size: " + text);
+            mCallbackSizeTextView.setText("0");
+        }
         OboeAudioStream.setCallbackSize(callbackSize);
     }
 
diff --git a/tests/README.md b/tests/README.md
index 79b2f24..4408f0b 100644
--- a/tests/README.md
+++ b/tests/README.md
@@ -1,13 +1,17 @@
-## Oboe unit tests
+# Oboe Unit Tests
+
 This directory contains the Oboe unit tests. They are run using the bash script `run_tests.sh`. 
 
-### Running the tests
+The basic operation is:
 
 1. Connect an Android device or start the Android emulator
 2. Open a terminal window and execute `run_tests.sh`
 
-### Prerequisites/caveats
-Before running the tests you must define `ANDROID_NDK` as an environment variable and make sure `cmake` is on your path.
+## Prerequisites/caveats
+
+You must have compiled and executed one of the Oboe examples or OboeTester. That ensures that the NDK and cmake is installed.
+
+You must define `ANDROID_NDK` as an environment variable and make sure `cmake` is on your path.
 
 To test this on Mac or Linux enter:
 
@@ -15,15 +19,19 @@
     echo $ANDROID_NDK
     cmake --version
 
-If you need to set `ANDROID_NDK` then this may work on Mac OS:
+They may already be set. If not, then this may work on Mac OS:
 
     export ANDROID_HOME=$HOME/Library/Android/sdk
     export ANDROID_NDK=$ANDROID_HOME/ndk-bundle
     
-This may work on Linux:
+or this may work on Linux:
 
     export ANDROID_HOME=$HOME/Android/Sdk
-    export ANDROID_NDK=$ANDROID_HOME/ndk-bundle
+    ls $ANDROID_HOME/ndk
+    
+Make note of the folder name. Mine was "21.0.6113669" so I entered:
+
+    export ANDROID_NDK=$ANDROID_HOME/ndk/21.0.6113669/
 
 If you need to add `cmake` to your path then you can find it by entering:
 
@@ -34,7 +42,9 @@
     export PATH=$PATH:$ANDROID_HOME/cmake/3.6.4111459/bin
     cmake --version
     
-Then to run the tests, enter:
+## Running the Tests
+
+To run the tests, enter:
 
     cd tests
     ./run_tests.sh