def parseParameters(self, params): parameters = [] for para in params: mtype = Selector.solve(para.type) var = Selector.solve(para.variable) parameters.append((mtype, var)) return parameters
def interfaceFinder(self, filePath): nativeMethodPath = "ClassDeclaration[name$=Proxy]>MethodDeclaration[throws*=RemoteException]" result = Selector.Selector(filePath).query(nativeMethodPath) if len(result) == 0: AIDLMethodPath = "ClassDeclaration[name=Stub]>ClassDeclaration[name=Proxy]>MethodDeclaration[throws*=android.os.RemoteException]" result = Selector.Selector(filePath).query(AIDLMethodPath) functions = {} for method in result: name = Selector.solve(method.name) parameters = self.parseParameters(method.parameters) functions[name] = ", ".join(i[0] + " " + i[1] for i in parameters) return functions