private static final String TAG = "OpenCVEngine/MarketConnector";
protected Context mContext;
- public boolean mIncludeManager = true;
-
public MarketConnector(Context context)
{
mContext = context;
{
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())
{
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;
}
};
+ @TargetApi(Build.VERSION_CODES.GINGERBREAD)
synchronized protected void FillPackageList()
{
synchronized (mListViewItems) {
- mMarket.mIncludeManager = false;
mInstalledPackageInfo = mMarket.GetInstalledOpenCVPackages();
mListViewItems.clear();
{
// 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)
}
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);
}