summaryrefslogtreecommitdiffstats
path: root/services/core
diff options
context:
space:
mode:
authordestradaa <destradaa@google.com>2015-07-27 17:14:03 -0700
committerdestradaa <destradaa@google.com>2015-08-27 18:12:04 -0700
commita1c8a6b0e312419cc82cb32b35e68d38e576b610 (patch)
tree5768a4b0c08900b88ab1ae952f2c96a80613fdfe /services/core
parent6ad123156e762a62616de63617ee11afb3cde334 (diff)
downloadframeworks_base-a1c8a6b0e312419cc82cb32b35e68d38e576b610.zip
frameworks_base-a1c8a6b0e312419cc82cb32b35e68d38e576b610.tar.gz
frameworks_base-a1c8a6b0e312419cc82cb32b35e68d38e576b610.tar.bz2
Fix NPE in AR hardware binding sequence.
b/22772433 To keep the old Watcher binding sequence backwards compatible, it is required to ensure that the callback is only invoked if the feature is supported by the platform, and an instance is available. Change-Id: I0a6335f10647184abdad3ee1583b505160a3308f
Diffstat (limited to 'services/core')
-rw-r--r--services/core/java/com/android/server/location/ActivityRecognitionProxy.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/services/core/java/com/android/server/location/ActivityRecognitionProxy.java b/services/core/java/com/android/server/location/ActivityRecognitionProxy.java
index 2eb58bf..55222dc 100644
--- a/services/core/java/com/android/server/location/ActivityRecognitionProxy.java
+++ b/services/core/java/com/android/server/location/ActivityRecognitionProxy.java
@@ -123,6 +123,12 @@ public class ActivityRecognitionProxy {
Log.e(TAG, "No watcher found on connection.");
return;
}
+ if (mInstance == null) {
+ // to keep backwards compatibility do not update the watcher when there is no
+ // instance available, or it will cause an NPE
+ Log.d(TAG, "AR HW instance not available, binding will be a no-op.");
+ return;
+ }
try {
watcher.onInstanceChanged(mInstance);
} catch (RemoteException e) {