mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-20 23:56:20 +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 (runAsync) {
|
||||
if (cr == null) {
|
||||
cr = new PluginResult(PluginResult.Status.CLASS_NOT_FOUND_EXCEPTION);
|
||||
}
|
||||
ctx.sendJavascript(cr.toErrorCallbackString(callbackId));
|
||||
}
|
||||
if (cr != null) {
|
||||
@ -128,15 +131,16 @@ public final class PluginManager {
|
||||
* @return Boolean indicating if the class implements com.phonegap.api.Plugin
|
||||
*/
|
||||
private boolean isPhoneGapPlugin(Class c) {
|
||||
boolean isPlugin = false;
|
||||
if (c.getSuperclass().getName().equals("com.phonegap.api.Plugin")) {
|
||||
return true;
|
||||
}
|
||||
Class[] interfaces = c.getInterfaces();
|
||||
for (int j=0; j<interfaces.length; j++) {
|
||||
if (interfaces[j].getName().equals("com.phonegap.api.Plugin")) {
|
||||
isPlugin = true;
|
||||
break;
|
||||
if (interfaces[j].getName().equals("com.phonegap.api.IPlugin")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return isPlugin;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user