OSDN Git Service

ContextHubService: Avoid uninitialized handle
authorGreg Kaiser <gkaiser@google.com>
Wed, 17 Aug 2016 23:27:26 +0000 (16:27 -0700)
committerGreg Kaiser <gkaiser@google.com>
Fri, 26 Aug 2016 04:34:52 +0000 (21:34 -0700)
commit9d4d881cc5cd5e225f68c85050d99d60445edbcf
tree2fd09753c2373aa5f0ac9b250d34892ce7c35ffd
parentf8d61675ac755a5110193e796e35e2e2a364387c
ContextHubService: Avoid uninitialized handle

We avoid ever using uninitialized stack for the value of a handle
which we pass up to the Java layer.

In cleaning up this code a little, we make more explicit a failure
case which already existed: The Context Hub properly loading a
nanoapp, but our Service code failing to set up the infrastructure
to track it.  We chose to tell the Java layer we failed in this
case, and more importantly, provide a consistent handle value.

Note that the INVALID_APP_ID is not known by the Java layer, but
it is consistent so future Java code could react to it.  At
the very least we will now always have consistent behavior when
this situation happens.

Bug:30795236
Change-Id: Id4eada529aa1b223867a47985ef1d5c1ba346ea3
core/jni/android_hardware_location_ContextHubService.cpp