Android, OpenSlDemo: moved to webrtc/examples/android/opensl_loopback

BUG=N/A
R=andrew@webrtc.org, fischman@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/7269004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5400 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/OWNERS b/OWNERS
index acedc54..36d9928 100644
--- a/OWNERS
+++ b/OWNERS
@@ -9,3 +9,4 @@
 per-file AUTHORS=*

 per-file DEPS=*

 per-file WATCHLISTS=*

+per-file webrtc_examples.gyp=*

diff --git a/webrtc/examples/OWNERS b/webrtc/examples/OWNERS
new file mode 100644
index 0000000..5c2e168
--- /dev/null
+++ b/webrtc/examples/OWNERS
@@ -0,0 +1,2 @@
+fischman@webrtc.org
+henrike@webrtc.org
\ No newline at end of file
diff --git a/webrtc/modules/audio_device/android/test/AndroidManifest.xml b/webrtc/examples/android/opensl_loopback/AndroidManifest.xml
similarity index 100%
rename from webrtc/modules/audio_device/android/test/AndroidManifest.xml
rename to webrtc/examples/android/opensl_loopback/AndroidManifest.xml
diff --git a/webrtc/modules/audio_device/android/test/README b/webrtc/examples/android/opensl_loopback/README
similarity index 100%
rename from webrtc/modules/audio_device/android/test/README
rename to webrtc/examples/android/opensl_loopback/README
diff --git a/webrtc/modules/audio_device/android/test/build.xml b/webrtc/examples/android/opensl_loopback/build.xml
similarity index 100%
rename from webrtc/modules/audio_device/android/test/build.xml
rename to webrtc/examples/android/opensl_loopback/build.xml
diff --git a/webrtc/modules/audio_device/android/test/fake_audio_device_buffer.cc b/webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.cc
similarity index 97%
rename from webrtc/modules/audio_device/android/test/fake_audio_device_buffer.cc
rename to webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.cc
index c12849c..81adc8f 100644
--- a/webrtc/modules/audio_device/android/test/fake_audio_device_buffer.cc
+++ b/webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "webrtc/modules/audio_device/android/test/fake_audio_device_buffer.h"
+#include "webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.h"
 
 #include <assert.h>
 
diff --git a/webrtc/modules/audio_device/android/test/fake_audio_device_buffer.h b/webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.h
similarity index 90%
rename from webrtc/modules/audio_device/android/test/fake_audio_device_buffer.h
rename to webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.h
index 9372e29..b98ee1e 100644
--- a/webrtc/modules/audio_device/android/test/fake_audio_device_buffer.h
+++ b/webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_FAKE_AUDIO_DEVICE_BUFFER_H_
-#define WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_FAKE_AUDIO_DEVICE_BUFFER_H_
+#ifndef WEBRTC_EXAMPLES_ANDROID_OPENSL_LOOPBACK_FAKE_AUDIO_DEVICE_BUFFER_H_
+#define WEBRTC_EXAMPLES_ANDROID_OPENSL_LOOPBACK_FAKE_AUDIO_DEVICE_BUFFER_H_
 
 #include "webrtc/modules/audio_device/android/audio_manager_jni.h"
 #include "webrtc/modules/audio_device/android/single_rw_fifo.h"
@@ -64,4 +64,4 @@
 
 }  // namespace webrtc
 
-#endif  // WEBRTC_MODULES_AUDIO_DEVICE_ANDROID_FAKE_AUDIO_DEVICE_BUFFER_H_
+#endif  // WEBRTC_EXAMPLES_ANDROID_OPENSL_LOOPBACK_FAKE_AUDIO_DEVICE_BUFFER_H_
diff --git a/webrtc/modules/audio_device/android/test/jni/opensl_runner.cc b/webrtc/examples/android/opensl_loopback/jni/opensl_runner.cc
similarity index 94%
rename from webrtc/modules/audio_device/android/test/jni/opensl_runner.cc
rename to webrtc/examples/android/opensl_loopback/jni/opensl_runner.cc
index 9d01330..5b7c092 100644
--- a/webrtc/modules/audio_device/android/test/jni/opensl_runner.cc
+++ b/webrtc/examples/android/opensl_loopback/jni/opensl_runner.cc
@@ -11,12 +11,12 @@
 #include <assert.h>
 #include <jni.h>
 
+#include "webrtc/examples/android/opensl_loopback/fake_audio_device_buffer.h"
 #include "webrtc/modules/audio_device/android/audio_device_template.h"
 #include "webrtc/modules/audio_device/android/audio_record_jni.h"
 #include "webrtc/modules/audio_device/android/audio_track_jni.h"
 #include "webrtc/modules/audio_device/android/opensles_input.h"
 #include "webrtc/modules/audio_device/android/opensles_output.h"
-#include "webrtc/modules/audio_device/android/test/fake_audio_device_buffer.h"
 #include "webrtc/system_wrappers/interface/scoped_ptr.h"
 
 // Java globals
@@ -84,8 +84,6 @@
       jobject obj,
       jobject context) {
     assert(!g_runner);  // Should only be called once.
-    // Register the application context in the superclass to avoid having to
-    // qualify the template instantiation again.
     OpenSlesInput::SetAndroidAudioDeviceObjects(g_vm, env, context);
     OpenSlesOutput::SetAndroidAudioDeviceObjects(g_vm, env, context);
     g_runner = new OpenSlRunner();
diff --git a/webrtc/modules/audio_device/android/test/project.properties b/webrtc/examples/android/opensl_loopback/project.properties
similarity index 100%
rename from webrtc/modules/audio_device/android/test/project.properties
rename to webrtc/examples/android/opensl_loopback/project.properties
diff --git a/webrtc/modules/audio_device/android/test/res/drawable/logo.png b/webrtc/examples/android/opensl_loopback/res/drawable/logo.png
similarity index 100%
rename from webrtc/modules/audio_device/android/test/res/drawable/logo.png
rename to webrtc/examples/android/opensl_loopback/res/drawable/logo.png
Binary files differ
diff --git a/webrtc/modules/audio_device/android/test/res/layout/open_sl_demo.xml b/webrtc/examples/android/opensl_loopback/res/layout/open_sl_demo.xml
similarity index 100%
rename from webrtc/modules/audio_device/android/test/res/layout/open_sl_demo.xml
rename to webrtc/examples/android/opensl_loopback/res/layout/open_sl_demo.xml
diff --git a/webrtc/modules/audio_device/android/test/res/values/strings.xml b/webrtc/examples/android/opensl_loopback/res/values/strings.xml
similarity index 100%
rename from webrtc/modules/audio_device/android/test/res/values/strings.xml
rename to webrtc/examples/android/opensl_loopback/res/values/strings.xml
diff --git a/webrtc/modules/audio_device/android/test/src/org/webrtc/app/OpenSlDemo.java b/webrtc/examples/android/opensl_loopback/src/org/webrtc/app/OpenSlDemo.java
similarity index 100%
rename from webrtc/modules/audio_device/android/test/src/org/webrtc/app/OpenSlDemo.java
rename to webrtc/examples/android/opensl_loopback/src/org/webrtc/app/OpenSlDemo.java
diff --git a/webrtc/modules/audio_device/android/test/src/org/webrtc/app/OpenSlRunner.java b/webrtc/examples/android/opensl_loopback/src/org/webrtc/app/OpenSlRunner.java
similarity index 100%
rename from webrtc/modules/audio_device/android/test/src/org/webrtc/app/OpenSlRunner.java
rename to webrtc/examples/android/opensl_loopback/src/org/webrtc/app/OpenSlRunner.java
diff --git a/webrtc/modules/audio_device/audio_device.gypi b/webrtc/modules/audio_device/audio_device.gypi
index de008e8..944f422 100644
--- a/webrtc/modules/audio_device/audio_device.gypi
+++ b/webrtc/modules/audio_device/audio_device.gypi
@@ -246,70 +246,6 @@
             },
           ],
         }],
-        ['OS=="android"', {
-          'targets': [
-            {
-              'target_name': 'libopensl-demo-jni',
-              'type': 'loadable_module',
-              'dependencies': [
-                'audio_device',
-              ],
-              'sources': [
-                'android/test/jni/opensl_runner.cc',
-                'android/test/fake_audio_device_buffer.cc',
-              ],
-              'link_settings': {
-                'libraries': [
-                  '-llog',
-                  '-lOpenSLES',
-                ],
-              },
-            },
-            {
-              'target_name': 'OpenSlDemo',
-              'type': 'none',
-              'dependencies': [
-                'libopensl-demo-jni',
-                '<(modules_java_gyp_path):*',
-              ],
-              'actions': [
-                {
-                  # TODO(henrik): Convert building of the demo to a proper GYP
-                  # target so this action is not needed once chromium's
-                  # apk-building machinery can be used. (crbug.com/225101)
-                  'action_name': 'build_opensldemo_apk',
-                  'variables': {
-                    'android_opensl_demo_root': '<(webrtc_root)/modules/audio_device/android/test',
-                    'ant_log': '../../../<(INTERMEDIATE_DIR)/ant.log', # ../../.. to compensate for the cd below.
-                  },
-                  'inputs' : [
-                    '<(PRODUCT_DIR)/lib.java/audio_device_module_java.jar',
-                    '<(PRODUCT_DIR)/libopensl-demo-jni.so',
-                    '<!@(find <(android_opensl_demo_root)/src -name "*.java")',
-                    '<!@(find <(android_opensl_demo_root)/res -name "*.xml")',
-                    '<!@(find <(android_opensl_demo_root)/res -name "*.png")',
-                    '<(android_opensl_demo_root)/AndroidManifest.xml',
-                    '<(android_opensl_demo_root)/build.xml',
-                    '<(android_opensl_demo_root)/project.properties',
-                  ],
-                  'outputs': ['<(PRODUCT_DIR)/OpenSlDemo-debug.apk'],
-                  'action': [
-                    'bash', '-ec',
-                    'rm -f <(_outputs) && '
-                    'mkdir -p <(android_opensl_demo_root)/libs/<(android_app_abi) && '
-                    'mkdir -p <(INTERMEDIATE_DIR) && ' # Must happen _before_ the cd below
-                    '<(android_strip) -o <(android_opensl_demo_root)/libs/<(android_app_abi)/libopensl-demo-jni.so <(PRODUCT_DIR)/libopensl-demo-jni.so && '
-                    'cp <(PRODUCT_DIR)/lib.java/audio_device_module_java.jar <(android_opensl_demo_root)/libs/ &&'
-                    'cd <(android_opensl_demo_root) && '
-                    '{ ant -q -l <(ant_log) debug || '
-                    '  { cat <(ant_log) ; exit 1; } } && '
-                    'cd - > /dev/null && '
-                    'cp <(android_opensl_demo_root)/bin/OpenSlDemo-debug.apk <(_outputs)'
-                  ],
-                },
-              ],
-            }],
-          }],
         ['OS=="android" and enable_android_opensl==1', {
           'targets': [
             {
diff --git a/webrtc/webrtc_examples.gyp b/webrtc/webrtc_examples.gyp
index 328681a..a7565ae 100644
--- a/webrtc/webrtc_examples.gyp
+++ b/webrtc/webrtc_examples.gyp
@@ -7,7 +7,6 @@
 # be found in the AUTHORS file in the root of the source tree.
 {
   'includes': ['build/common.gypi'],
-  
   'conditions': [
     ['OS=="android"', {
       'targets': [
@@ -83,6 +82,67 @@
             },
           ],
         },
+        {
+          'target_name': 'libopensl-demo-jni',
+          'type': 'loadable_module',
+          'dependencies': [
+            '<(webrtc_root)/modules/modules.gyp:audio_device',
+          ],
+          'sources': [
+            'examples/android/opensl_loopback/jni/opensl_runner.cc',
+            'examples/android/opensl_loopback/fake_audio_device_buffer.cc',
+          ],
+          'link_settings': {
+            'libraries': [
+              '-llog',
+              '-lOpenSLES',
+            ],
+          },
+        },
+        {
+          'target_name': 'OpenSlDemo',
+          'type': 'none',
+          'dependencies': [
+            'libopensl-demo-jni',
+            '<(modules_java_gyp_path):*',
+          ],
+          'actions': [
+            {
+              # TODO(henrik): Convert building of the demo to a proper GYP
+              # target so this action is not needed once chromium's
+              # apk-building machinery can be used. (crbug.com/225101)
+              'action_name': 'build_opensldemo_apk',
+              'variables': {
+                'android_opensl_demo_root': '<(webrtc_root)/examples/android/opensl_loopback',
+                'ant_log': '../../../<(INTERMEDIATE_DIR)/ant.log', # ../../.. to compensate for the cd below.
+              },
+              'inputs' : [
+                '<(PRODUCT_DIR)/lib.java/audio_device_module_java.jar',
+                '<(PRODUCT_DIR)/libopensl-demo-jni.so',
+                '<!@(find <(android_opensl_demo_root)/src -name "*.java")',
+                '<!@(find <(android_opensl_demo_root)/res -name "*.xml")',
+                '<!@(find <(android_opensl_demo_root)/res -name "*.png")',
+                '<(android_opensl_demo_root)/AndroidManifest.xml',
+                '<(android_opensl_demo_root)/build.xml',
+                '<(android_opensl_demo_root)/project.properties',
+              ],
+              'outputs': ['<(PRODUCT_DIR)/OpenSlDemo-debug.apk'],
+              'action': [
+                'bash', '-ec',
+                'rm -f <(_outputs) && '
+                'mkdir -p <(android_opensl_demo_root)/libs/<(android_app_abi) && '
+                'mkdir -p <(INTERMEDIATE_DIR) && ' # Must happen _before_ the cd below
+                '<(android_strip) -o <(android_opensl_demo_root)/libs/<(android_app_abi)/libopensl-demo-jni.so <(PRODUCT_DIR)/libopensl-demo-jni.so && '
+                'cp <(PRODUCT_DIR)/lib.java/audio_device_module_java.jar <(android_opensl_demo_root)/libs/ &&'
+                'cd <(android_opensl_demo_root) && '
+                '{ ant -q -l <(ant_log) debug || '
+                '  { cat <(ant_log) ; exit 1; } } && '
+                'cd - > /dev/null && '
+                'cp <(android_opensl_demo_root)/bin/OpenSlDemo-debug.apk <(_outputs)'
+              ],
+            },
+          ],
+        },
       ],
     }],
   ],