Internal version of OpenCV inside OpenCV Manager added to the list of installed packages.

pull/204/head
Alexander Smorkalov 12 years ago
parent a0c504aabc
commit 9823b7cd08
  1. 16
      android/service/engine/src/org/opencv/engine/MarketConnector.java
  2. 37
      android/service/engine/src/org/opencv/engine/manager/ManagerActivity.java

@ -20,8 +20,6 @@ public class MarketConnector
private static final String TAG = "OpenCVEngine/MarketConnector";
protected Context mContext;
public boolean mIncludeManager = true;
public MarketConnector(Context context)
{
mContext = context;
@ -100,15 +98,13 @@ public class MarketConnector
{
List<PackageInfo> AllPackages = mContext.getPackageManager().getInstalledPackages(PackageManager.GET_CONFIGURATIONS);
List<PackageInfo> OpenCVPackages = new ArrayList<PackageInfo>();
if (mIncludeManager)
{
try {
OpenCVPackages.add(mContext.getPackageManager().getPackageInfo("org.opencv.engine", PackageManager.GET_CONFIGURATIONS));
} catch (NameNotFoundException e) {
Log.e(TAG, "OpenCV Manager package info was not found!");
e.printStackTrace();
}
try {
OpenCVPackages.add(mContext.getPackageManager().getPackageInfo("org.opencv.engine", PackageManager.GET_CONFIGURATIONS));
} catch (NameNotFoundException e) {
Log.e(TAG, "OpenCV Manager package info was not found!");
e.printStackTrace();
}
Iterator<PackageInfo> it = AllPackages.iterator();
while(it.hasNext())
{

@ -7,7 +7,9 @@ import java.util.StringTokenizer;
import org.opencv.engine.HardwareDetector;
import org.opencv.engine.MarketConnector;
import org.opencv.engine.OpenCVEngineInterface;
import org.opencv.engine.OpenCVLibraryInfo;
import org.opencv.engine.R;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
@ -266,10 +268,10 @@ public class ManagerActivity extends Activity
}
};
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
synchronized protected void FillPackageList()
{
synchronized (mListViewItems) {
mMarket.mIncludeManager = false;
mInstalledPackageInfo = mMarket.GetInstalledOpenCVPackages();
mListViewItems.clear();
@ -277,12 +279,36 @@ public class ManagerActivity extends Activity
{
// Convert to Items for package list view
HashMap<String,String> temp = new HashMap<String,String>();
String PublicName = mMarket.GetApplicationName(mInstalledPackageInfo[i].applicationInfo);
int idx = 0;
String PackageName = "";
String PublicName = "";
String OpenCVersion = "unknown";
String HardwareName = "";
StringTokenizer tokenizer = new StringTokenizer(mInstalledPackageInfo[i].packageName, "_");
String NativeLibDir = "";
String VersionName = "";
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD)
NativeLibDir = mInstalledPackageInfo[i].applicationInfo.nativeLibraryDir;
else
NativeLibDir = "/data/data/" + mInstalledPackageInfo[i].packageName + "/lib";
OpenCVLibraryInfo nativeInfo = new OpenCVLibraryInfo(NativeLibDir);
if (nativeInfo.status())
{
PublicName = nativeInfo.publicName();
PackageName = nativeInfo.packageName();
VersionName = nativeInfo.versionName();
}
else
{
PublicName = mMarket.GetApplicationName(mInstalledPackageInfo[i].applicationInfo);
PackageName = mInstalledPackageInfo[i].packageName;
VersionName = mInstalledPackageInfo[i].versionName;
}
int idx = 0;
StringTokenizer tokenizer = new StringTokenizer(PackageName, "_");
while (tokenizer.hasMoreTokens())
{
if (idx == 1)
@ -326,8 +352,9 @@ public class ManagerActivity extends Activity
}
temp.put("Name", PublicName);
temp.put("Version", NormalizeVersion(OpenCVersion, mInstalledPackageInfo[i].versionName));
temp.put("Version", NormalizeVersion(OpenCVersion, VersionName));
temp.put("Hardware", HardwareName);
mListViewItems.add(temp);
}

Loading…
Cancel
Save