1. 程式人生 > 其它 >JNI__貫穿java層與c++層的返回值

JNI__貫穿java層與c++層的返回值

返回值型別的寫法和位置不太一樣,模仿檔案中其他位置的寫法即可,如:

frameworks/base/services/core/java/com/android/server/pm/Installer.java
/**@hide*/
public boolean createDirectory(String path) {
try {
return mInstalld.createDirectory(path); //
IBinder binder = ServiceManager.getService("installd");mInstalld = IInstalld.Stub.asInterface(binder);
} catch (Exception e) {
e.printStackTrace();
}

return false;
}
------------------------------------------------------------------------------------------

frameworks/native/cmds/installd/InstalldNativeService.h
binder::Status createDirectory(const std::string& path, bool* _aidl_return);
...
}
--------------------------------------------------------------------------------------------
frameworks/native/cmds/installd/InstalldNativeService.cp
binder::Status InstalldNativeService::
createDirectory(const std::string& dirPath, bool* _aidl_return) {
LOG(DEBUG) << "installd handling createDirectory, path: " << dirPath.c_str();
...
*_aidl_return = false;
return ok();
}