Merge "MediaRecorder: Use new build system" into developers-dev
diff --git a/media/MediaRecorder/MediaRecorder/build.gradle b/media/MediaRecorder/MediaRecorder/build.gradle
deleted file mode 100644
index 10fb811..0000000
--- a/media/MediaRecorder/MediaRecorder/build.gradle
+++ /dev/null
@@ -1,10 +0,0 @@
-apply plugin: 'android'
-
-dependencies {
-    compile "com.android.support:support-v4:18.0.+"
-}
-
-android {
-    compileSdkVersion 18
-    buildToolsVersion "18.0.1"
-}
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/menu/main.xml b/media/MediaRecorder/MediaRecorder/src/main/res/menu/main.xml
deleted file mode 100644
index f3b10b6..0000000
--- a/media/MediaRecorder/MediaRecorder/src/main/res/menu/main.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
-    <item android:id="@+id/action_settings"
-        android:title="@string/action_settings"
-        android:orderInCategory="100"
-        android:showAsAction="never" />
-</menu>
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/values-sw600dp/dimens.xml b/media/MediaRecorder/MediaRecorder/src/main/res/values-sw600dp/dimens.xml
deleted file mode 100644
index 886b05f..0000000
--- a/media/MediaRecorder/MediaRecorder/src/main/res/values-sw600dp/dimens.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<resources>
-    <!-- Customize dimensions originally defined in res/values/dimens.xml (such as
-         screen margins) for sw600dp devices (e.g. 7" tablets) here. -->
-</resources>
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/values-sw720dp-land/dimens.xml b/media/MediaRecorder/MediaRecorder/src/main/res/values-sw720dp-land/dimens.xml
deleted file mode 100644
index 00059fc..0000000
--- a/media/MediaRecorder/MediaRecorder/src/main/res/values-sw720dp-land/dimens.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<resources>
-    <!-- Customize dimensions originally defined in res/values/dimens.xml (such as
-         screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. -->
-    <dimen name="activity_horizontal_margin">128dp</dimen>
-</resources>
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/values-v11/styles.xml b/media/MediaRecorder/MediaRecorder/src/main/res/values-v11/styles.xml
deleted file mode 100644
index 3c02242..0000000
--- a/media/MediaRecorder/MediaRecorder/src/main/res/values-v11/styles.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<resources>
-
-    <!--
-        Base application theme for API 11+. This theme completely replaces
-        AppBaseTheme from res/values/styles.xml on API 11+ devices.
-    -->
-    <style name="AppBaseTheme" parent="android:Theme.Holo.Light">
-        <!-- API 11 theme customizations can go here. -->
-    </style>
-
-</resources>
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/values-v14/styles.xml b/media/MediaRecorder/MediaRecorder/src/main/res/values-v14/styles.xml
deleted file mode 100644
index a91fd03..0000000
--- a/media/MediaRecorder/MediaRecorder/src/main/res/values-v14/styles.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<resources>
-
-    <!--
-        Base application theme for API 14+. This theme completely replaces
-        AppBaseTheme from BOTH res/values/styles.xml and
-        res/values-v11/styles.xml on API 14+ devices.
-    -->
-    <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
-        <!-- API 14 theme customizations can go here. -->
-    </style>
-
-</resources>
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/values/dimens.xml b/media/MediaRecorder/MediaRecorder/src/main/res/values/dimens.xml
deleted file mode 100644
index 47c8224..0000000
--- a/media/MediaRecorder/MediaRecorder/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<resources>
-    <!-- Default screen margins, per the Android Design guidelines. -->
-    <dimen name="activity_horizontal_margin">16dp</dimen>
-    <dimen name="activity_vertical_margin">16dp</dimen>
-</resources>
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/values/strings.xml b/media/MediaRecorder/MediaRecorder/src/main/res/values/strings.xml
deleted file mode 100644
index 91ab13a..0000000
--- a/media/MediaRecorder/MediaRecorder/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-
-    <string name="app_name">MediaRecorder</string>
-    <string name="action_settings">Settings</string>
-    <string name="hello_world">Hello world!</string>
-    <string name="btnCapture">capture</string>
-
-</resources>
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/values/styles.xml b/media/MediaRecorder/MediaRecorder/src/main/res/values/styles.xml
deleted file mode 100644
index 6ce89c7..0000000
--- a/media/MediaRecorder/MediaRecorder/src/main/res/values/styles.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<resources>
-
-    <!--
-        Base application theme, dependent on API level. This theme is replaced
-        by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-    -->
-    <style name="AppBaseTheme" parent="android:Theme.Light">
-        <!--
-            Theme customizations available in newer API levels can go in
-            res/values-vXX/styles.xml, while customizations related to
-            backward-compatibility can go here.
-        -->
-    </style>
-
-    <!-- Application theme. -->
-    <style name="AppTheme" parent="AppBaseTheme">
-        <!-- All customizations that are NOT specific to a particular API-level can go here. -->
-    </style>
-
-</resources>
diff --git a/media/MediaRecorder/MediaRecorderSample/.gitignore b/media/MediaRecorder/MediaRecorderSample/.gitignore
new file mode 100644
index 0000000..6eb878d
--- /dev/null
+++ b/media/MediaRecorder/MediaRecorderSample/.gitignore
@@ -0,0 +1,16 @@
+# Copyright 2013 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+src/template/
+src/common/
+build.gradle
diff --git a/media/MediaRecorder/MediaRecorderSample/proguard-project.txt b/media/MediaRecorder/MediaRecorderSample/proguard-project.txt
new file mode 100644
index 0000000..0d8f171
--- /dev/null
+++ b/media/MediaRecorder/MediaRecorderSample/proguard-project.txt
@@ -0,0 +1,20 @@
+ To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
diff --git a/media/MediaRecorder/MediaRecorder/src/main/AndroidManifest.xml b/media/MediaRecorder/MediaRecorderSample/src/main/AndroidManifest.xml
similarity index 67%
rename from media/MediaRecorder/MediaRecorder/src/main/AndroidManifest.xml
rename to media/MediaRecorder/MediaRecorderSample/src/main/AndroidManifest.xml
index 038b1fd..32f88f6 100644
--- a/media/MediaRecorder/MediaRecorder/src/main/AndroidManifest.xml
+++ b/media/MediaRecorder/MediaRecorderSample/src/main/AndroidManifest.xml
@@ -1,21 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
-    Copyright 2013 The Android Open Source Project
-    Licensed under the Apache License, Version 2.0 (the "License");
-    you may not use this file except in compliance with the License.
-    You may obtain a copy of the License at
+ Copyright 2013 The Android Open Source Project
 
-      http://www.apache.org/licenses/LICENSE-2.0
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
 
-    Unless required by applicable law or agreed to in writing, software
-    distributed under the License is distributed on an "AS IS" BASIS,
-    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-    See the License for the specific language governing permissions and
-    limitations under the License.
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
 -->
+
+
+
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.example.android.media.recorder"
+    package="com.example.android.mediarecorder"
     android:versionCode="1"
-    android:versionName="1.0" >
+    android:versionName="1.0">
 
     <uses-sdk
         android:minSdkVersion="14"
diff --git a/media/MediaRecorder/MediaRecorder/src/main/java/com/example/android/media/recorder/MainActivity.java b/media/MediaRecorder/MediaRecorderSample/src/main/java/com/example/android/mediarecorder/MainActivity.java
similarity index 91%
rename from media/MediaRecorder/MediaRecorder/src/main/java/com/example/android/media/recorder/MainActivity.java
rename to media/MediaRecorder/MediaRecorderSample/src/main/java/com/example/android/mediarecorder/MainActivity.java
index d50b53e..8587636 100644
--- a/media/MediaRecorder/MediaRecorder/src/main/java/com/example/android/media/recorder/MainActivity.java
+++ b/media/MediaRecorder/MediaRecorderSample/src/main/java/com/example/android/mediarecorder/MainActivity.java
@@ -14,16 +14,16 @@
  * limitations under the License.
  */
 
-package com.example.android.media.recorder;
+package com.example.android.mediarecorder;
 
 import android.annotation.TargetApi;
+import android.app.Activity;
 import android.hardware.Camera;
 import android.media.CamcorderProfile;
 import android.media.MediaRecorder;
 import android.os.AsyncTask;
 import android.os.Build;
 import android.os.Bundle;
-import android.app.Activity;
 import android.util.Log;
 import android.view.Menu;
 import android.view.TextureView;
@@ -36,8 +36,8 @@
 import java.util.List;
 
 /**
- *  This activity uses the camera/camcorder as the A/V source for the {@link MediaRecorder} API.
- *  A {@link TextureView} is used as the camera preview which limits the code to API 14+. This
+ *  This activity uses the camera/camcorder as the A/V source for the {@link android.media.MediaRecorder} API.
+ *  A {@link android.view.TextureView} is used as the camera preview which limits the code to API 14+. This
  *  can be easily replaced with a {@link android.view.SurfaceView} to run on older devices.
  */
 public class MainActivity extends Activity {
@@ -53,7 +53,7 @@
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_main);
+        setContentView(R.layout.sample_main);
 
         mPreview = (TextureView) findViewById(R.id.surface_view);
         captureButton = (Button) findViewById(R.id.button_capture);
@@ -61,8 +61,8 @@
 
     /**
      * The capture button controls all user interaction. When recording, the button click
-     * stops recording, releases {@link MediaRecorder} and {@link Camera}. When not recording,
-     * it prepares the {@link MediaRecorder} and starts recording.
+     * stops recording, releases {@link android.media.MediaRecorder} and {@link android.hardware.Camera}. When not recording,
+     * it prepares the {@link android.media.MediaRecorder} and starts recording.
      *
      * @param view the view generating the event.
      */
@@ -97,13 +97,6 @@
     }
 
     @Override
-    public boolean onCreateOptionsMenu(Menu menu) {
-        // Inflate the menu; this adds items to the action bar if it is present.
-        getMenuInflater().inflate(R.menu.main, menu);
-        return true;
-    }
-
-    @Override
     protected void onPause() {
         super.onPause();
         // if we are using MediaRecorder, release it first
@@ -201,7 +194,7 @@
     }
 
     /**
-     * Asynchronous task for preparing the {@link MediaRecorder} since it's a long blocking
+     * Asynchronous task for preparing the {@link android.media.MediaRecorder} since it's a long blocking
      * operation.
      */
     class MediaPrepareTask extends AsyncTask<Void, Void, Boolean> {
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/drawable-hdpi/ic_launcher.png b/media/MediaRecorder/MediaRecorderSample/src/main/res/drawable-hdpi/ic_launcher.png
similarity index 100%
rename from media/MediaRecorder/MediaRecorder/src/main/res/drawable-hdpi/ic_launcher.png
rename to media/MediaRecorder/MediaRecorderSample/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/drawable-mdpi/ic_launcher.png b/media/MediaRecorder/MediaRecorderSample/src/main/res/drawable-mdpi/ic_launcher.png
similarity index 100%
rename from media/MediaRecorder/MediaRecorder/src/main/res/drawable-mdpi/ic_launcher.png
rename to media/MediaRecorder/MediaRecorderSample/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/drawable-xhdpi/ic_launcher.png b/media/MediaRecorder/MediaRecorderSample/src/main/res/drawable-xhdpi/ic_launcher.png
similarity index 100%
rename from media/MediaRecorder/MediaRecorder/src/main/res/drawable-xhdpi/ic_launcher.png
rename to media/MediaRecorder/MediaRecorderSample/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/drawable-xxhdpi/ic_launcher.png b/media/MediaRecorder/MediaRecorderSample/src/main/res/drawable-xxhdpi/ic_launcher.png
similarity index 100%
rename from media/MediaRecorder/MediaRecorder/src/main/res/drawable-xxhdpi/ic_launcher.png
rename to media/MediaRecorder/MediaRecorderSample/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/media/MediaRecorder/MediaRecorder/src/main/res/layout/activity_main.xml b/media/MediaRecorder/MediaRecorderSample/src/main/res/layout/sample_main.xml
similarity index 100%
rename from media/MediaRecorder/MediaRecorder/src/main/res/layout/activity_main.xml
rename to media/MediaRecorder/MediaRecorderSample/src/main/res/layout/sample_main.xml
diff --git a/media/MediaRecorder/MediaRecorderSample/src/main/res/values-sw720dp-land/dimens.xml b/media/MediaRecorder/MediaRecorderSample/src/main/res/values-sw720dp-land/dimens.xml
new file mode 100644
index 0000000..c4aad9b
--- /dev/null
+++ b/media/MediaRecorder/MediaRecorderSample/src/main/res/values-sw720dp-land/dimens.xml
@@ -0,0 +1,21 @@
+<!--
+  Copyright (C) 2013 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<resources>
+    <!-- Customize dimensions originally defined in res/values/dimens.xml (such as
+         screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. -->
+    <dimen name="activity_horizontal_margin">128dp</dimen>
+</resources>
diff --git a/media/MediaRecorder/MediaRecorderSample/src/main/res/values/dimens.xml b/media/MediaRecorder/MediaRecorderSample/src/main/res/values/dimens.xml
new file mode 100644
index 0000000..0353ed6
--- /dev/null
+++ b/media/MediaRecorder/MediaRecorderSample/src/main/res/values/dimens.xml
@@ -0,0 +1,21 @@
+<!--
+  Copyright (C) 2013 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<resources>
+    <!-- Default screen margins, per the Android Design guidelines. -->
+    <dimen name="activity_horizontal_margin">16dp</dimen>
+    <dimen name="activity_vertical_margin">16dp</dimen>
+</resources>
diff --git a/media/MediaRecorder/MediaRecorderSample/src/main/res/values/strings.xml b/media/MediaRecorder/MediaRecorderSample/src/main/res/values/strings.xml
new file mode 100644
index 0000000..b6a2cd2
--- /dev/null
+++ b/media/MediaRecorder/MediaRecorderSample/src/main/res/values/strings.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright (C) 2013 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<resources>
+
+    <string name="action_settings">Settings</string>
+    <string name="hello_world">Hello world!</string>
+    <string name="btnCapture">capture</string>
+
+</resources>
diff --git a/media/MediaRecorder/build.gradle b/media/MediaRecorder/build.gradle
index bd6967f..c886d80 100644
--- a/media/MediaRecorder/build.gradle
+++ b/media/MediaRecorder/build.gradle
@@ -1,9 +1,11 @@
-// Top-level build file where you can add configuration options common to all sub-projects/modules.
-buildscript {
-    repositories {
-        mavenCentral()
-    }
-    dependencies {
-        classpath 'com.android.tools.build:gradle:0.5.+'
-    }
-}
\ No newline at end of file
+
+
+
+
+// BEGIN_EXCLUDE
+apply from: "../../../../build/build.gradle"
+samplegen {
+  pathToBuild "../../../../build"
+  pathToSamplesCommon "../../common"
+}
+// END_EXCLUDE
diff --git a/media/MediaRecorder/buildSrc/build.gradle b/media/MediaRecorder/buildSrc/build.gradle
new file mode 100644
index 0000000..29282af
--- /dev/null
+++ b/media/MediaRecorder/buildSrc/build.gradle
@@ -0,0 +1,18 @@
+
+
+
+repositories {
+    mavenCentral()
+}
+dependencies {
+    compile 'org.freemarker:freemarker:2.3.20'
+}
+
+sourceSets {
+    main {
+        groovy {
+            srcDir new File(rootDir, "../../../../../build/buildSrc/src/main/groovy")
+        }
+    }
+}
+
diff --git a/media/MediaRecorder/gradle/wrapper/gradle-wrapper.properties b/media/MediaRecorder/gradle/wrapper/gradle-wrapper.properties
index 5c22dec..861eddc 100644
--- a/media/MediaRecorder/gradle/wrapper/gradle-wrapper.properties
+++ b/media/MediaRecorder/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=http\://services.gradle.org/distributions/gradle-1.6-bin.zip
+distributionUrl=http\://services.gradle.org/distributions/gradle-1.8-bin.zip
diff --git a/media/MediaRecorder/settings.gradle b/media/MediaRecorder/settings.gradle
index 3fbbc54..61e4032 100644
--- a/media/MediaRecorder/settings.gradle
+++ b/media/MediaRecorder/settings.gradle
@@ -1 +1,4 @@
-include ':MediaRecorder'
+
+
+
+include 'MediaRecorderSample'
diff --git a/media/MediaRecorder/template-params.xml b/media/MediaRecorder/template-params.xml
new file mode 100644
index 0000000..6b6ddc5
--- /dev/null
+++ b/media/MediaRecorder/template-params.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+
+
+<sample>
+    <name>MediaRecorder</name>
+    <group>Media</group>
+    <package>com.example.android.mediarecorder</package>
+
+    <!-- change minSdk if needed-->
+    <minSdk>14</minSdk>
+
+    <strings>
+        <intro>
+            <![CDATA[
+            This sample uses the camera/camcorder as the A/V source for the MediaRecorder API.
+            A TextureView is used as the camera preview which limits the code to API 14+. This
+            can be easily replaced with a SurfaceView to run on older devices.
+            ]]>
+        </intro>
+    </strings>
+
+    <template src="base"/>
+    <common src="media"/>
+</sample>