Skip to content

Commit

Permalink
ANDROID: Match versions when checking for plugins.
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzie committed Oct 25, 2011
1 parent 80e55c5 commit 764ffff
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
10 changes: 10 additions & 0 deletions backends/platform/android/org/scummvm/scummvm/PluginProvider.java
Expand Up @@ -5,6 +5,7 @@
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;
Expand All @@ -25,15 +26,24 @@ public void onReceive(Context context, Intent intent) {
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 =
Expand Down
Expand Up @@ -7,6 +7,7 @@
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;

Expand Down
10 changes: 10 additions & 0 deletions backends/platform/android/org/scummvm/scummvm/Unpacker.java
Expand Up @@ -10,6 +10,7 @@
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;
Expand Down Expand Up @@ -275,6 +276,15 @@ private void initPlugins() {
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
Expand Down

0 comments on commit 764ffff

Please sign in to comment.