ContextHubService: Don't change app handle on load

Due to the way this logic was set up, every time we would load
a new nanoapp, add_app_instance() would change the nanoapp's
handle/"id" in manner that was invisible to closeTxnLoad(),
so our JNI cache would use a different handle than what we
passed to the Java callback.

We remove this unnecessary changing of the handle/"id".

Bug:31325144
Change-Id: I8678729f38fb804bc6a128ce9722fd35551fa1c1
This commit is contained in:
Greg Kaiser
2016-09-06 22:55:53 -07:00
parent 57e29b4b9e
commit b0604ecc91

View File

@@ -393,16 +393,8 @@ static jint add_app_instance(const hub_app_info *appInfo, uint32_t hubHandle,
app_instance_info_s entry; app_instance_info_s entry;
assert(appInfo); assert(appInfo);
const char *action = "Updated"; const char *action =
if (db.appInstances.count(appInstanceHandle) == 0) { (db.appInstances.count(appInstanceHandle) == 0) ? "Added" : "Updated";
action = "Added";
appInstanceHandle = generate_id();
if (appInstanceHandle < 0) {
ALOGE("Cannot find resources to add app instance %" PRId32,
appInstanceHandle);
return -1;
}
}
entry.appInfo = *appInfo; entry.appInfo = *appInfo;