ANDROID: Match versions when checking for plugins.
(cherry picked from commit 764ffff578
)
This commit is contained in:
parent
5628bb6cd4
commit
d57a2fc5fb
3 changed files with 21 additions and 0 deletions
|
@ -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 =
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue