Remove the VideoEditorTestImpl

Change-Id: I16302716f4aa32f69f48c9f4cc5732b421c1a675
diff --git a/media/java/android/media/videoeditor/VideoEditorFactory.java b/media/java/android/media/videoeditor/VideoEditorFactory.java
index 5c243ed..85b2666 100755
--- a/media/java/android/media/videoeditor/VideoEditorFactory.java
+++ b/media/java/android/media/videoeditor/VideoEditorFactory.java
@@ -19,8 +19,8 @@
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
+
+import android.media.videoeditor.VideoEditor.MediaProcessingProgressListener;
 
 
 /**
@@ -30,34 +30,19 @@
  * {@hide}
  */
 public class VideoEditorFactory {
-    // VideoEditor implementation classes
-    public static final String TEST_CLASS_IMPLEMENTATION
-            = "android.media.videoeditor.VideoEditorTestImpl";
-    public static final String DEFAULT_CLASS_IMPLEMENTATION
-            = "android.media.videoeditor.VideoEditorImpl";
-
     /**
      * This is the factory method for creating a new VideoEditor instance.
      *
      * @param projectPath The path where all VideoEditor internal
      *            files are stored. When a project is deleted the application is
      *            responsible for deleting the path and its contents.
-     * @param className The implementation class name
      *
      * @return The VideoEditor instance
      *
      * @throws IOException if path does not exist or if the path can
      *             not be accessed in read/write mode
-     * @throws IllegalStateException if a previous VideoEditor instance has not
-     *             been released
-     * @throws ClassNotFoundException, NoSuchMethodException,
-     *             InvocationTargetException, IllegalAccessException,
-     *             InstantiationException if the implementation class cannot
-     *             be instantiated.
      */
-    public static VideoEditor create(String projectPath, String className) throws IOException,
-            ClassNotFoundException, NoSuchMethodException, InvocationTargetException,
-            IllegalAccessException, InstantiationException {
+    public static VideoEditor create(String projectPath) throws IOException {
         // If the project path does not exist create it
         final File dir = new File(projectPath);
         if (!dir.exists()) {
@@ -72,14 +57,7 @@
             }
         }
 
-        final Class<?> cls = Class.forName(className);
-        final Class<?> partypes[] = new Class[1];
-        partypes[0] = String.class;
-        final Constructor<?> ct = cls.getConstructor(partypes);
-        final Object arglist[] = new Object[1];
-        arglist[0] = projectPath;
-
-        return (VideoEditor)ct.newInstance(arglist);
+        return new VideoEditorImpl(projectPath);
     }
 
     /**
@@ -90,30 +68,19 @@
      * @param projectPath The path where all VideoEditor internal files
      *            are stored. When a project is deleted the application is
      *            responsible for deleting the path and its contents.
-     * @param className The implementation class name
      * @param generatePreview if set to true the
-     *      {@link MediaEditor#generatePreview()} will be called internally to
-     *      generate any needed transitions.
+     *      {@link MediaEditor#generatePreview(MediaProcessingProgressListener listener)}
+     *      will be called internally to generate any needed transitions.
      *
      * @return The VideoEditor instance
      *
      * @throws IOException if path does not exist or if the path can
      *             not be accessed in read/write mode or if one of the resource
      *             media files cannot be retrieved
-     * @throws IllegalStateException if a previous VideoEditor instance has not
-     *             been released
      */
-    public static VideoEditor load(String projectPath, String className, boolean generatePreview)
-            throws IOException, ClassNotFoundException, NoSuchMethodException,
-            InvocationTargetException, IllegalAccessException, InstantiationException {
-        final Class<?> cls = Class.forName(className);
-        final Class<?> partypes[] = new Class[1];
-        partypes[0] = String.class;
-        final Constructor<?> ct = cls.getConstructor(partypes);
-        final Object arglist[] = new Object[1];
-        arglist[0] = projectPath;
-
-        final VideoEditor videoEditor = (VideoEditor)ct.newInstance(arglist);
+    public static VideoEditor load(String projectPath, boolean generatePreview)
+            throws IOException {
+        final VideoEditor videoEditor = new VideoEditorImpl(projectPath);
         if (generatePreview) {
             videoEditor.generatePreview(null);
         }
diff --git a/media/java/android/media/videoeditor/VideoEditorTestImpl.java b/media/java/android/media/videoeditor/VideoEditorImpl.java
similarity index 98%
rename from media/java/android/media/videoeditor/VideoEditorTestImpl.java
rename to media/java/android/media/videoeditor/VideoEditorImpl.java
index 50e4aaf..1a145e6 100644
--- a/media/java/android/media/videoeditor/VideoEditorTestImpl.java
+++ b/media/java/android/media/videoeditor/VideoEditorImpl.java
@@ -39,7 +39,7 @@
 /**
  * The VideoEditor implementation {@hide}
  */
-public class VideoEditorTestImpl implements VideoEditor {
+public class VideoEditorImpl implements VideoEditor {
     // Logging
     private static final String TAG = "VideoEditorImpl";
 
@@ -165,7 +165,7 @@
                 if (mPositionMs >= mToMs) {
                     if (!mLoop) {
                         if (mListener != null) {
-                            mListener.onProgress(VideoEditorTestImpl.this, mPositionMs, true);
+                            mListener.onProgress(VideoEditorImpl.this, mPositionMs, true);
                         }
                         if (Log.isLoggable(TAG, Log.DEBUG)) {
                             Log.d(TAG, "PreviewThread.run playback complete");
@@ -174,13 +174,13 @@
                     } else {
                         // Fire a notification for the end of the clip
                         if (mListener != null) {
-                            mListener.onProgress(VideoEditorTestImpl.this, mToMs, false);
+                            mListener.onProgress(VideoEditorImpl.this, mToMs, false);
                         }
 
                         // Rewind
                         mPositionMs = mFromMs;
                         if (mListener != null) {
-                            mListener.onProgress(VideoEditorTestImpl.this, mPositionMs, false);
+                            mListener.onProgress(VideoEditorImpl.this, mPositionMs, false);
                         }
                         if (Log.isLoggable(TAG, Log.DEBUG)) {
                             Log.d(TAG, "PreviewThread.run playback complete");
@@ -190,7 +190,7 @@
                 } else {
                     if (frameCount == mCallbackAfterFrameCount) {
                         if (mListener != null) {
-                            mListener.onProgress(VideoEditorTestImpl.this, mPositionMs, false);
+                            mListener.onProgress(VideoEditorImpl.this, mPositionMs, false);
                         }
                         frameCount = 0;
                     }
@@ -222,7 +222,7 @@
      *
      * @param projectPath
      */
-    public VideoEditorTestImpl(String projectPath) throws IOException {
+    public VideoEditorImpl(String projectPath) throws IOException {
         mProjectPath = projectPath;
         final File projectXml = new File(projectPath, PROJECT_FILENAME);
         if (projectXml.exists()) {