RESTART_REQUIRED status removed from OpenCV Manager API;
authorAlexander Smorkalov <alexander.smorkalov@itseez.com>
Mon, 8 Oct 2012 11:31:56 +0000 (15:31 +0400)
committerAlexander Smorkalov <alexander.smorkalov@itseez.com>
Tue, 9 Oct 2012 06:34:40 +0000 (10:34 +0400)
OpenCV info library name fixed;
Minimum API level for OpenCV library project increased up to 3 for using message dialogs.

modules/java/android_lib/AndroidManifest.xml
modules/java/generator/src/java/android+AsyncServiceHelper.java
modules/java/generator/src/java/android+BaseLoaderCallback.java
modules/java/generator/src/java/android+LoaderCallbackInterface.java
modules/java/generator/src/java/android+StaticHelper.java
modules/java/generator/src/java/android+Utils.java

index 6f7b335..86008bf 100644 (file)
@@ -3,4 +3,6 @@
       package="org.opencv"
       android:versionCode="242"
       android:versionName="2.4.2">
-</manifest> 
+
+    <uses-sdk android:minSdkVersion="8" />
+</manifest>
index b024095..80d8131 100644 (file)
@@ -85,10 +85,8 @@ class AsyncServiceHelper
                     if (result)
                     {
                         mServiceInstallationProgress = true;
-                        int Status = LoaderCallbackInterface.RESTART_REQUIRED;
-                        Log.d(TAG, "Init finished with status " + Status);
-                        Log.d(TAG, "Calling using callback");
-                        mUserAppCallback.onManagerConnected(Status);
+                        Log.d(TAG, "Package installation started");
+
                     }
                     else
                     {
@@ -195,28 +193,34 @@ class AsyncServiceHelper
                                 }
                                 public void install() {
                                     Log.d(TAG, "Trying to install OpenCV lib via Google Play");
+                                    boolean result;
                                     try
                                     {
                                         if (mEngineService.installVersion(mOpenCVersion))
                                         {
                                             mLibraryInstallationProgress = true;
-                                            mStatus = LoaderCallbackInterface.RESTART_REQUIRED;
+                                            result = true;
+                                            Log.d(TAG, "Package installation statred");
                                         }
                                         else
                                         {
+                                            result = false;
                                             Log.d(TAG, "OpenCV package was not installed!");
                                             mStatus = LoaderCallbackInterface.MARKET_ERROR;
                                         }
                                     } catch (RemoteException e) {
                                         e.printStackTrace();
+                                        result = false;
                                         mStatus = LoaderCallbackInterface.INIT_FAILED;
                                     }
-
-                                    Log.d(TAG, "Init finished with status " + mStatus);
-                                    Log.d(TAG, "Unbind from service");
-                                    mAppContext.unbindService(mServiceConnection);
-                                    Log.d(TAG, "Calling using callback");
-                                    mUserAppCallback.onManagerConnected(mStatus);
+                                    if (!result)
+                                    {
+                                        Log.d(TAG, "Init finished with status " + mStatus);
+                                        Log.d(TAG, "Unbind from service");
+                                        mAppContext.unbindService(mServiceConnection);
+                                        Log.d(TAG, "Calling using callback");
+                                        mUserAppCallback.onManagerConnected(mStatus);
+                                    }
                                 }
                                 public void cancel() {
                                     Log.d(TAG, "OpenCV library installation was canceled");
@@ -260,11 +264,7 @@ class AsyncServiceHelper
                                     Log.d(TAG, "Waiting for current installation");
                                     try
                                     {
-                                        if (mEngineService.installVersion(mOpenCVersion))
-                                        {
-                                            mStatus = LoaderCallbackInterface.RESTART_REQUIRED;
-                                        }
-                                        else
+                                        if (!mEngineService.installVersion(mOpenCVersion))
                                         {
                                             Log.d(TAG, "OpenCV package was not installed!");
                                             mStatus = LoaderCallbackInterface.MARKET_ERROR;
index 40f1d6c..bbb1230 100644 (file)
@@ -24,11 +24,6 @@ public abstract class BaseLoaderCallback implements LoaderCallbackInterface {
             {
                 /** Application must override this method to handle successful library initialization. **/
             } break;
-            /** OpenCV Manager or library package installation is in progress. Restart the application. **/
-            case LoaderCallbackInterface.RESTART_REQUIRED:
-            {
-            Log.d(TAG, "OpenCV downloading. App restart is needed!");
-            } break;
             /** OpenCV loader can not start Google Play Market. **/
             case LoaderCallbackInterface.MARKET_ERROR:
             {
index aca80a8..a941e83 100644 (file)
@@ -10,10 +10,6 @@ public interface LoaderCallbackInterface
      */
     static final int SUCCESS = 0;
     /**
-     * OpenCV library installation via Google Play service has been initialized. Restart the application.
-     */
-    static final int RESTART_REQUIRED = 1;
-    /**
      * Google Play Market cannot be invoked.
      */
     static final int MARKET_ERROR = 2;
index 3082d22..7d7b64d 100644 (file)
@@ -15,7 +15,7 @@ class StaticHelper {
 
         try
         {
-            System.loadLibrary("opencvinfo");
+            System.loadLibrary("opencv_info");
             libs = getLibraryList();
         }
         catch(UnsatisfiedLinkError e)
index e40630b..9c46108 100644 (file)
@@ -99,10 +99,10 @@ public class Utils {
      * @param mat is a valid output Mat object, it will be reallocated if needed, so Mat may be empty.
      */
     public static void bitmapToMat(Bitmap bmp, Mat mat) {
-       bitmapToMat(bmp, mat, false);
+        bitmapToMat(bmp, mat, false);
     }
 
-    
+
     /**
      * Converts OpenCV Mat to Android Bitmap.
      * <p>
@@ -129,10 +129,10 @@ public class Utils {
      * @param bmp is a valid Bitmap object of the same size as the Mat and of type 'ARGB_8888' or 'RGB_565'.
      */
     public static void matToBitmap(Mat mat, Bitmap bmp) {
-       matToBitmap(mat, bmp, false);
+        matToBitmap(mat, bmp, false);
     }
-    
-    
+
+
     private static native void nBitmapToMat2(Bitmap b, long m_addr, boolean unPremultiplyAlpha);
 
     private static native void nMatToBitmap2(long m_addr, Bitmap b, boolean premultiplyAlpha);