aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlyssa Milburn2011-10-25 23:08:29 +0200
committerAlyssa Milburn2011-10-25 23:08:29 +0200
commit764ffff578d9650621a82ddc5bd5c9530940c5ae (patch)
tree875a270c00aab68d0eb31663b56b8cb6194e3a1c
parent80e55c5e78a5161bda41b730892e1a853c872ccb (diff)
downloadscummvm-rg350-764ffff578d9650621a82ddc5bd5c9530940c5ae.tar.gz
scummvm-rg350-764ffff578d9650621a82ddc5bd5c9530940c5ae.tar.bz2
scummvm-rg350-764ffff578d9650621a82ddc5bd5c9530940c5ae.zip
ANDROID: Match versions when checking for plugins.
-rw-r--r--backends/platform/android/org/scummvm/scummvm/PluginProvider.java10
-rw-r--r--backends/platform/android/org/scummvm/scummvm/ScummVMApplication.java1
-rw-r--r--backends/platform/android/org/scummvm/scummvm/Unpacker.java10
3 files changed, 21 insertions, 0 deletions
diff --git a/backends/platform/android/org/scummvm/scummvm/PluginProvider.java b/backends/platform/android/org/scummvm/scummvm/PluginProvider.java
index 0c43529f83..e27e8d41a8 100644
--- a/backends/platform/android/org/scummvm/scummvm/PluginProvider.java
+++ b/backends/platform/android/org/scummvm/scummvm/PluginProvider.java
@@ -5,6 +5,7 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
+import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
@@ -25,15 +26,24 @@ public class PluginProvider extends BroadcastReceiver {
Bundle extras = getResultExtras(true);
final ActivityInfo info;
+ final PackageInfo pinfo;
try {
info = context.getPackageManager()
.getReceiverInfo(new ComponentName(context, this.getClass()),
PackageManager.GET_META_DATA);
+ pinfo = context.getPackageManager()
+ .getPackageInfo(context.getPackageName(), 0);
} catch (PackageManager.NameNotFoundException e) {
Log.e(LOG_TAG, "Error finding my own info?", e);
return;
}
+ String host_version = extras.getString(ScummVMApplication.EXTRA_VERSION);
+ if (!pinfo.versionName.equals(host_version)) {
+ Log.e(LOG_TAG, "Plugin version " + pinfo.versionName + " is not equal to ScummVM version " + host_version);
+ return;
+ }
+
String mylib = info.metaData.getString(META_UNPACK_LIB);
if (mylib != null) {
ArrayList<String> all_libs =
diff --git a/backends/platform/android/org/scummvm/scummvm/ScummVMApplication.java b/backends/platform/android/org/scummvm/scummvm/ScummVMApplication.java
index 9241cba918..0adc166222 100644
--- a/backends/platform/android/org/scummvm/scummvm/ScummVMApplication.java
+++ b/backends/platform/android/org/scummvm/scummvm/ScummVMApplication.java
@@ -7,6 +7,7 @@ import java.io.File;
public class ScummVMApplication extends Application {
public final static String ACTION_PLUGIN_QUERY = "org.scummvm.scummvm.action.PLUGIN_QUERY";
public final static String EXTRA_UNPACK_LIBS = "org.scummvm.scummvm.extra.UNPACK_LIBS";
+ public final static String EXTRA_VERSION = "org.scummvm.scummvm.extra.VERSION";
private static File _cache_dir;
diff --git a/backends/platform/android/org/scummvm/scummvm/Unpacker.java b/backends/platform/android/org/scummvm/scummvm/Unpacker.java
index 4564d96622..da76ceb5e5 100644
--- a/backends/platform/android/org/scummvm/scummvm/Unpacker.java
+++ b/backends/platform/android/org/scummvm/scummvm/Unpacker.java
@@ -10,6 +10,7 @@ import android.content.ContextWrapper;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.ActivityInfo;
+import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
@@ -275,6 +276,15 @@ public class Unpacker extends Activity {
extras.putStringArrayList(ScummVMApplication.EXTRA_UNPACK_LIBS,
unpack_libs);
+ final PackageInfo info;
+ try {
+ info = getPackageManager().getPackageInfo(getPackageName(), 0);
+ } catch (PackageManager.NameNotFoundException e) {
+ Log.e(LOG_TAG, "Error finding my own info?", e);
+ return;
+ }
+ extras.putString(ScummVMApplication.EXTRA_VERSION, info.versionName);
+
Intent intent = new Intent(ScummVMApplication.ACTION_PLUGIN_QUERY);
// Android 3.1 defaults to FLAG_EXCLUDE_STOPPED_PACKAGES, and since
// none of our plugins will ever be running, that is not helpful