mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-22 00:32:55 +08:00
Check plugin against new Plugin and IPlugin to determine if valid plugin class.
This commit is contained in:
parent
68146329b9
commit
385be26046
@ -101,6 +101,9 @@ public final class PluginManager {
|
|||||||
}
|
}
|
||||||
// if async we have already returned at this point unless there was an error...
|
// if async we have already returned at this point unless there was an error...
|
||||||
if (runAsync) {
|
if (runAsync) {
|
||||||
|
if (cr == null) {
|
||||||
|
cr = new PluginResult(PluginResult.Status.CLASS_NOT_FOUND_EXCEPTION);
|
||||||
|
}
|
||||||
ctx.sendJavascript(cr.toErrorCallbackString(callbackId));
|
ctx.sendJavascript(cr.toErrorCallbackString(callbackId));
|
||||||
}
|
}
|
||||||
if (cr != null) {
|
if (cr != null) {
|
||||||
@ -128,15 +131,16 @@ public final class PluginManager {
|
|||||||
* @return Boolean indicating if the class implements com.phonegap.api.Plugin
|
* @return Boolean indicating if the class implements com.phonegap.api.Plugin
|
||||||
*/
|
*/
|
||||||
private boolean isPhoneGapPlugin(Class c) {
|
private boolean isPhoneGapPlugin(Class c) {
|
||||||
boolean isPlugin = false;
|
if (c.getSuperclass().getName().equals("com.phonegap.api.Plugin")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
Class[] interfaces = c.getInterfaces();
|
Class[] interfaces = c.getInterfaces();
|
||||||
for (int j=0; j<interfaces.length; j++) {
|
for (int j=0; j<interfaces.length; j++) {
|
||||||
if (interfaces[j].getName().equals("com.phonegap.api.Plugin")) {
|
if (interfaces[j].getName().equals("com.phonegap.api.IPlugin")) {
|
||||||
isPlugin = true;
|
return true;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return isPlugin;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user