Merge "Added defensive code to prevent system crash" into nyc-dev

am: a381455

* commit 'a381455472a814c8dbd98fcb4312f46ed1373c88':
  Added defensive code to prevent system crash

Change-Id: I97dd4a994c86bf9bc845de08a8ff9c303bb86240
This commit is contained in:
Lifu Tang
2016-04-20 22:30:55 +00:00
committed by android-build-merger

View File

@@ -661,6 +661,16 @@ static void GeofenceMonitorStatusCallback(
TranslateToObject(lastLocation, locationObject);
}
// sCallbacksObject is created when FlpHardwareProvider on Java side is
// initialized. Sometimes the hardware may call this function before the Java
// side is ready. In order to prevent the system crash, check whether
// sCallbacksObj has been created. If not, simply ignore this event from
// hardware.
if (sCallbacksObj == NULL) {
ALOGE("FlpHardwareProvider hasn't been initialized.");
return;
}
sCallbackEnv->CallVoidMethod(
sCallbacksObj,
sOnGeofenceMonitorStatus,