History log of /frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
f16abd98c7ea8332e413d44a0baa8cb6eaa6669c 08-Sep-2016 Greg Kaiser <gkaiser@google.com> ContextHubService: Keep handles across hub reboot

Previously, when a Context Hub rebooted, this service would reset
all of the "handles" used to identify the nanoapps on the Context
Hub. This caused many issues for Java application code trying to
track nanoapps, and these issues were exacerbated under nanohub,
which reboots every times it loads an app.

We change this so that we keep the same handle across reboot if
the same nanoapp is still running post-reboot. We accomplish
this by never "invalidating" our caches, but rather performing
a query post-reboot and removing stale entries.

Due to b/30835598, we needed to change our post-load query to
be all apps. Without that change, a race between the two
query responses we would have post nanohub app load (one for
post-load, one for post-reboot) would leave us without knowing
which response we're dealing with. Now, since both requests
are the same, we don't care which response we deal with.

This is all (hopefully) just for the Nougat release. In the
O release, we hope to remove these caches (b/30835981) and
the idea of the JNI code inventing handles (b/30810861).

Bug: 30950975
Change-Id: I85a84ba5c1a039d69c1adaaea56609e0a38cce42
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
a630b2d66783189b85da04323dc9812eff3ff569 08-Sep-2016 Greg Kaiser <gkaiser@google.com> Merge "ContextHubService: Avoid null pointer dereference" into nyc-mr1-dev
ca9c676099aafaa371abeadffcdbb96d5ed3a674 08-Sep-2016 Greg Kaiser <gkaiser@google.com> ContextHubService: Avoid null pointer dereference

We stop calling closeLoadTxn() with a nullptr, so we won't crash.

Bug: 31354170
Change-Id: Iebec9ff90a12b350811c24886917f084de88a7d5
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
b0604ecc914ade4ac9bf0ab7bcbb3b8d43de297e 07-Sep-2016 Greg Kaiser <gkaiser@google.com> 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
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
29e868071d64ebbcf6191bb5b7542875ad6fcef8 26-Aug-2016 Greg Kaiser <gkaiser@google.com> ContextHubService: Allow cancelling load/unload

As a minimal risk improvement for Android N, we allow a new
load/unload transaction request to cancel a currently pending
one if enough time has passed since starting the current
transaction.

Bug: 30111539
Change-Id: Ide958c2454b88529305443fb789b8ae5af18c642
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
6bf3424ccfc6656a8713e0b010ecfb53df8cca41 26-Aug-2016 Brian Duddie <bduddie@google.com> Merge "ContextHub: Avoid reference leaks" into nyc-mr1-dev
9d4d881cc5cd5e225f68c85050d99d60445edbcf 18-Aug-2016 Greg Kaiser <gkaiser@google.com> 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
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
18e59f29889b72035ab234d220ac0b50dd306511 26-Aug-2016 Greg Kaiser <gkaiser@google.com> Merge "ContextHubService: Maintain hub result meaning" into nyc-mr1-dev
c35104535cf60fd0bb42640c4993172a62e83671 09-Aug-2016 Andrew Rossignol <aarossig@google.com> ContextHub: Avoid reference leaks

The ContextHub HAL was leaking references in passOnOsResponse. An
example of this is when a sensor hub reset occurs. If many of these
resets happen, the local reference pool is exhausted and a crash
in the HAL occurs.

Bug: 30706325
Change-Id: Ica5328137a7033f512d7fb1ccf6fa138eab55091
(cherry picked from commit 52dda598963cefc82cfc5e55342ff631a07fd6d4)
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
6d9e7f669a6f03fa73abcae1ae36b529de1f6f3f 18-Aug-2016 Greg Kaiser <gkaiser@google.com> ContextHubService: Maintain hub result meaning

We're squeezing a 4-byte signed value to 1-byte. The naive
(implicit) cast we were using could flip this value from positive
to negative, or vice versa, and completely change the meaning
of the result.

API freeze prevents us from fixing this properly at the moment,
but we use a less naive approach to truncate this value, maintaining
its meaning and logging when we've changed the value.

Bug:30829863
Change-Id: I0e80af9b192066fdf36fee565a4587eb75a5ea7b
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
10163d0dd25d637ac91f91cb8138d7dce07503fb 19-Aug-2016 Greg Kaiser <gkaiser@google.com> ContextHubService: Fix app query

We now ask for the appId the user requested, instead of asking
for no apps (asking for NANOAPP_VENDOR_ALL_APPS without pairing
it with any vendors results in no apps).

Bug: 30829899
Change-Id: I896af60814d55c7f8cb298c9142212bac5b06995
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
fe6d4f518a34aa620eda9fe36365c2f750e6c67f 19-Aug-2016 Greg Kaiser <gkaiser@google.com> ContextHubService: Don't double report app loads

Our logs would show us loading apps twice, when in reality we
load them once, and then update our caches with the app
version later.

There are other issues around how this code works (for example,
b/30970527), but this is an appropriate approach at this
stage of the release.

Bug: 30836667
Change-Id: I2e2a65bc8a2ef4d1703df0a0586a8ed251607af7
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
f8210797adeb6527fe44dff6f8902d4744ad9540 19-Aug-2016 Greg Kaiser <gkaiser@google.com> ContextHubService: Make app handle size match Java

Our code was sometimes using 'uint32_t' and mostly using 'int'
to represent these custom handles. It was also passing this
value, as a byte stream, to the Java layer.

In the Java layer, this is an 'int', and thus we change all
of our usages to be 'jint' here. However, we still pass it
as a byte stream, since we're too late in the release cycle
to change the API. But now this is at least a consistent
size for the code.

This code still suffers from hub handles being inconsistent
with their types, but we leave that for another bug (b/30958512).

Bug: 30806218
Change-Id: I8d9ae8b9519f399d6723cf96293d84a2f5bd9cce
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
0d052c95088190b37011f045a8443aaea28cd23b 19-Aug-2016 Greg Kaiser <gkaiser@google.com> ContextHubService: Update caches on nanoapp unload

When we unloaded a nanoapp, we weren't updating the cache of
nanoapp information at the ContextHubServer java layer. Also,
we were leaking the handle.

We fix both of these by invoking the shared delete_app_instance()
function which properly handles all of this.

Furthermore, we allow delete_app_instance() to accept a nullptr
for the JNIEnv, and fix invalidateNanoApps() so that it won't
crash if it's unable to connect to the JVM.

Note that our Java communication in general here should be
cleaned up, but we're too late in the release cycle for
that, and leave that for b/30961119.

Bug: 30951974, 30968860
Change-Id: Ibb07666a8d54618bddaa3eaf36f9578926eb2b0f
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
118644056f3c442f0aa9451aaeac8e8b35dde3f8 15-Jul-2016 Ashutosh Joshi <ashutoshj@google.com> Loading NanoApps now works.

Fixing transaction handling for loading/unloading nanoApps.

Bug: 30165105
Change-Id: I540243d730040e70b2d104ccd9ea5a0baaa0d97d
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
54787a5f9ffe7a15784049b00f664fac37c53b95 27-Apr-2016 Ashutosh Joshi <ashutoshj@google.com> Add state for loading/unloading apps

Add state for loading/unloading nanoApps.
Pass on OS response to ContextHubService clients.
Fix Build Breakage due to uninitalized variables.

Bug: 29193948
Change-Id: Ibebecf704bb3ad2583e110f1fcf05400a53b1b4c
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
848c8c4c43c42da11cf62a964989c1912500e302 06-Jul-2016 Ashutosh Joshi <ashutoshj@google.com> Make ContextHubService compliant with new context hub interface.

Context Hub HAL added messages with definition for all distinguished
messages. Fixing the ContextHubService to be compliant.

Bug: 29835220
Change-Id: I70751d0f5b06cd3c8a4ce93003bdaa86b7317a2c
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
bece5990c7ad14fff494204e68ca251f4c9c626b 09-May-2016 Greg Kaiser <gkaiser@google.com> ContextHub: Avoid reference leaks

We were leaking references in each call to onMessageReceipt(),
leading us to eventually run out of references and crash. We
now delete our local references prior to leaving the function.
Also, since especially our message size can be quite large,
we put in logic to gracefully fail if the system is out of
memory.

In addition, we fix up reference leaks within
constructJContextHubInfo(). These were one-time leaks at
initialization, so not the root cause of our crash, but still
unnecessary leaks which are easily fixed.

Bug: 28655628
Change-Id: I3a3dc8e069c6c1810f3152872d8d8410e8ad0683
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
3cd7305f99c798a6a3735145b8cbcbb92bee7802 29-Apr-2016 destradaa <destradaa@google.com> Fix build break due to 32/64 bit compilation.

Change-Id: I9aba08a5fd512c52c9d0c9d4853c72a3e81a22cd
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
6469c233fb9f7e617a5bc8b5d8348d7241d279c7 28-Apr-2016 destradaa <destradaa@google.com> Fixes on handling messages from apps to host.

- Ensure that app to host events are not filtered out
- Populates the app handle appropriately for clients to reference the
nano app sending the event

Bug: 28273520
Bug: 28272149

Change-Id: I7373fc84abcadc2ab17109484f2d04b02a474593
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
85202e0a6e0cf381f1a47ca9e91273da7dbf6687 11-Apr-2016 Ashutosh Joshi <ashutoshj@google.com> Remove LOAD_OS_APP message from standard context hub messages

Removing LOAD_OS_APP from the list of standard Android messages.

Change-Id: I1db1933e2c090716a1921f14e04e1f5d133ea9cd
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
ab2d44596b749f3095a262ca3dc3188238dd19d1 08-Apr-2016 Alexey Polyudov <apolyudov@google.com> contexthub: nanohub HAL redefined hub_app_name_t; keep in sync

we're now using hub_app_name_t as unique nanoapp ID throughout
all layers

Bug: 28086503
Change-Id: Ie8113de1b2bafd441d79e45137f44d74970fcd01
Signed-off-by: Alexey Polyudov <apolyudov@google.com>
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
6239cc6fe1d18ce4365c56346a09c7963dfa8f10 05-Apr-2016 Ashutosh Joshi <ashutoshj@google.com> Add dumpsys capabilities for context hub service

Add useful debug hook for context hub service.
Fix constants
Use helper functions to address OS

Change-Id: Iba5f24a9a1fd809c3d83752953389d373ff334ca
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
cafdee9a72652354c5bde0b13c86dac3d88ac2ae 05-Apr-2016 Ashutosh Joshi <ashutoshj@google.com> App upload to Context hub.

Fix constants
Use helper functions to address OS

Change-Id: I61bd1f3eff2716ead2771eda335998f2e9b73afc
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
b741e3b374e7eebf96e2104dec5caccf723b2a39 29-Mar-2016 Ashutosh Joshi <ashutoshj@google.com> Added handling apps query response from context hub

Added handling of app query reponse from context hub.
Exposed the maximum message size to clients.

Change-Id: Ie96a860774d005ad6ad72acc88dc79964835486b
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
2c697fb4a8b8f8c0a2acf1fb15027f363f74c2dc 01-Apr-2016 Ashutosh Joshi <ashutoshj@google.com> Revert "Added handling apps query response from context hub"

This reverts commit adf75e31f52a7a935a66a884fb55631c7309ee75.

Change-Id: I8391eb57c3a53e686bd817d27860fa6f785113f1
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
c75f7c20e86a8c5dd8523aee3ad390b91f3d2418 01-Apr-2016 Ashutosh Joshi <ashutoshj@google.com> Revert "Ensuring builds compile for both 32 bit and 64 bit targets."

This reverts commit 85e093bc03d747f69b3ada658c9e82f442cda334.

Change-Id: I9346929e6016e36beb3b6949ccec9fce73da91c4
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
85e093bc03d747f69b3ada658c9e82f442cda334 01-Apr-2016 Ashutosh Joshi <ashutoshj@google.com> Ensuring builds compile for both 32 bit and 64 bit targets.

Fixing print formats for pointers.
Fixing a dangerous memory free.

Change-Id: I7c53bdaeceed80845ef002ed6a8a783ecb0378dc
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
adf75e31f52a7a935a66a884fb55631c7309ee75 29-Mar-2016 Ashutosh Joshi <ashutoshj@google.com> Added handling apps query response from context hub

Added handling of app query reponse from context hub.
Exposed the maximum message size to clients.

Change-Id: I8d8ecaa2e75f6ef86ee65a3a050538cbbadc32eb
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp
9ff7d2235427b211344fa58b608424805a21aa24 11-Feb-2016 Peng Xu <pengxu@google.com> Exposing Context Hub service.

Adding the Context hub service. This is the service that exposes
the context hub HAL to the system. The API exposed is a System API.

Change-Id: I854141714ecd21f6386e6b15b7bc9a997483ccf6
/frameworks/base/core/jni/android_hardware_location_ContextHubService.cpp