CB-5481 Fix for Cordova trying to get config.xml from the wrong namespace

This commit is contained in:
Håkon Nilsen 2013-12-04 21:06:15 +01:00 committed by Andrew Grieve
parent e646a0840d
commit 28c10dba09
2 changed files with 15 additions and 5 deletions

View File

@ -68,10 +68,15 @@ public class Config {
return;
}
// First checking the class namespace for config.xml
int id = action.getResources().getIdentifier("config", "xml", action.getClass().getPackage().getName());
if (id == 0) {
LOG.i("CordovaLog", "config.xml missing. Ignoring...");
return;
// If we couldn't find config.xml there, we'll look in the namespace from AndroidManifest.xml
id = action.getResources().getIdentifier("config", "xml", action.getPackageName());
if (id == 0) {
LOG.i("CordovaLog", "config.xml missing. Ignoring...");
return;
}
}
// Add implicitly allowed URLs

View File

@ -110,11 +110,16 @@ public class PluginManager {
* Load plugins from res/xml/config.xml
*/
public void loadPlugins() {
// First checking the class namespace for config.xml
int id = this.ctx.getActivity().getResources().getIdentifier("config", "xml", this.ctx.getActivity().getClass().getPackage().getName());
if (id == 0) {
this.pluginConfigurationMissing();
//We have the error, we need to exit without crashing!
return;
// If we couldn't find config.xml there, we'll look in the namespace from AndroidManifest.xml
id = this.ctx.getActivity().getResources().getIdentifier("config", "xml", this.ctx.getActivity().getPackageName());
if (id == 0) {
this.pluginConfigurationMissing();
//We have the error, we need to exit without crashing!
return;
}
}
XmlResourceParser xml = this.ctx.getActivity().getResources().getXml(id);
int eventType = -1;