hubconnection: store initial mag bias

Bug: 29357438
Change-Id: I58358ad14e5877d27dc40565dbce0c2dd63d8672
diff --git a/sensorhal/hubconnection.cpp b/sensorhal/hubconnection.cpp
index c411577..5704e3a 100644
--- a/sensorhal/hubconnection.cpp
+++ b/sensorhal/hubconnection.cpp
@@ -927,8 +927,14 @@
     if (settings->getFloat("light", &light))
         queueDataInternal(COMMS_SENSOR_LIGHT, &light, sizeof(light));
 
-    if (getCalibrationFloat(saved_settings, "mag", mag))
+    if (getCalibrationFloat(saved_settings, "mag", mag)) {
+        // Store SW bias so we can remove bias for uncal data
+        mMagBias[0] = mag[0];
+        mMagBias[1] = mag[1];
+        mMagBias[2] = mag[2];
+
         queueDataInternal(COMMS_SENSOR_MAG, mag, sizeof(mag));
+    }
 }
 
 bool HubConnection::threadLoop() {