am 34c08828: Merge "Fix NPE in AR hardware binding sequence. b/22772433" into mnc-dr-dev
* commit '34c0882898c3e37ea1733e4614233c8a4cb71b67':
Fix NPE in AR hardware binding sequence. b/22772433
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 @@
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) {