Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b0604ecc authored by Greg Kaiser's avatar Greg Kaiser
Browse files

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
parent 57e29b4b
Loading
Loading
Loading
Loading
+2 −10
Original line number Diff line number Diff line
@@ -393,16 +393,8 @@ static jint add_app_instance(const hub_app_info *appInfo, uint32_t hubHandle,
    app_instance_info_s entry;
    assert(appInfo);

    const char *action = "Updated";
    if (db.appInstances.count(appInstanceHandle) == 0) {
        action = "Added";
        appInstanceHandle = generate_id();
        if (appInstanceHandle < 0) {
            ALOGE("Cannot find resources to add app instance %" PRId32,
                  appInstanceHandle);
            return -1;
        }
    }
    const char *action =
        (db.appInstances.count(appInstanceHandle) == 0) ? "Added" : "Updated";

    entry.appInfo = *appInfo;