Merge "Loading NanoApps now works." into nyc-mr1-dev

This commit is contained in:
Ashutosh Joshi
2016-07-15 22:12:41 +00:00
committed by Android (Google) Code Review
2 changed files with 8 additions and 2 deletions

View File

@@ -166,9 +166,12 @@ public class ContextHubService extends IContextHubService.Stub {
msgHeader[HEADER_FIELD_LOAD_APP_ID_LO] = (int)(appId & 0xFFFFFFFF);
msgHeader[HEADER_FIELD_LOAD_APP_ID_HI] = (int)((appId >> 32) & 0xFFFFFFFF);
if (nativeSendMessage(msgHeader, app.getAppBinary()) != 0) {
int errVal = nativeSendMessage(msgHeader, app.getAppBinary());
if (errVal != 0) {
Log.e(TAG, "Send Message returns error" + contextHubHandle);
return -1;
}
// Do not add an entry to mNanoAppInstance Hash yet. The HAL may reject the app
return 0;
}

View File

@@ -423,7 +423,7 @@ static int startLoadAppTxn(uint64_t appId, int hubHandle) {
txnInfo->appInfo.num_mem_ranges = 0;
txnInfo->appInfo.version = -1; // Awaited
if (!addTxn(CONTEXT_HUB_LOAD_APP, txnInfo)) {
if (addTxn(CONTEXT_HUB_LOAD_APP, txnInfo) != 0) {
return_id(instanceId);
free(txnInfo);
return -1;
@@ -726,6 +726,7 @@ static int handle_os_message(uint32_t msgType, uint32_t hubHandle,
if (isValidOsStatus(msg, msgLen, &rsp)) {
rsp.result = 0;
ALOGW("Context Hub handle %d restarted", hubHandle);
closeTxn();
passOnOsResponse(hubHandle, msgType, &rsp, nullptr, 0);
invalidateNanoApps(hubHandle);
query_hub_for_apps(ALL_APPS, hubHandle);
@@ -1012,10 +1013,12 @@ static jint nativeSendMessage(JNIEnv *env, jobject instance, jintArray header_,
if (msgType == CONTEXT_HUB_LOAD_APP) {
if (startLoadAppTxn(appId, hubHandle) != 0) {
ALOGW("Cannot Start Load Transaction");
return -1;
}
} else if (msgType == CONTEXT_HUB_UNLOAD_APP) {
if (startUnloadAppTxn(appInstanceHandle) != 0) {
ALOGW("Cannot Start UnLoad Transaction");
return -1;
}
}