[DO NOT MERGE] Support ImuCal hinge-angle integration

- These changes provide support for using hinge-angle to detect foldable
  physical state changes and respond with changes to calibration values.

Bug: 197029853
Test: Compiled and tested on device.

PiperOrigin-RevId: 396038420
Change-Id: I9a3324f6074f87dbfdc475f737a0484d5c539a5d
diff --git a/firmware/os/algos/calibration/online_calibration/common_data/calibration_quality.h b/firmware/os/algos/calibration/online_calibration/common_data/calibration_quality.h
index d6475c7..6b146f4 100644
--- a/firmware/os/algos/calibration/online_calibration/common_data/calibration_quality.h
+++ b/firmware/os/algos/calibration/online_calibration/common_data/calibration_quality.h
@@ -65,7 +65,7 @@
 // Sets the calibration quality value when this metric is either not
 // implemented, or has not yet been determined (e.g., a calibration hasn't
 // occurred).
-constexpr float kUndeterminedCalibrationQuality = -1.0f;
+constexpr float kUndeterminedCalibrationQuality = FLT_MAX;
 
 /*
  * Calibration quality structure that contains a quantitative (float) and
diff --git a/firmware/os/algos/calibration/online_calibration/common_data/online_calibration.h b/firmware/os/algos/calibration/online_calibration/common_data/online_calibration.h
index 8c95f9b..710c442 100644
--- a/firmware/os/algos/calibration/online_calibration/common_data/online_calibration.h
+++ b/firmware/os/algos/calibration/online_calibration/common_data/online_calibration.h
@@ -26,6 +26,14 @@
 
 namespace online_calibration {
 
+// Device physical state change types.
+enum class PhysicalStateType : uint8_t {
+  kUnknownPhysicalState = 0,
+  kFoldableOpen,
+  kFoldableClosed,
+  kNumPhysicalStateTypes,
+};
+
 /*
  * This abstract base class provides a set of general interface functions for
  * calibration algorithms. The data structures used are intended to be lean and
@@ -130,6 +138,13 @@
   // Returns the sensor-type this calibration algorithm provides updates for.
   virtual SensorType get_sensor_type() const = 0;
 
+  // Tells the calibrator that the device's physical state has changed. This is
+  // useful, for example, if there is a need for the calibration algorithm to be
+  // aware of and take some sort of internal action in response to a physical
+  // state change (e.g., for foldable devices, MagCal may adjust internal states
+  // to implement specific transition behavior between open/closed states).
+  virtual void UpdatePhysicalState(PhysicalStateType physical_state) {}
+
  protected:
   // Helper function that activates the registered callback.
   void OnNotifyCalibrationUpdate(CalibrationTypeFlags cal_update_flags) const {
diff --git a/firmware/os/algos/calibration/online_calibration/common_data/sensor_data.h b/firmware/os/algos/calibration/online_calibration/common_data/sensor_data.h
index 23b63c9..b6d6eb3 100644
--- a/firmware/os/algos/calibration/online_calibration/common_data/sensor_data.h
+++ b/firmware/os/algos/calibration/online_calibration/common_data/sensor_data.h
@@ -48,6 +48,8 @@
   kBarometerHpa = 5,        // 1-axis sensor (units = hecto-Pascal).
   kWifiM = 6,               // 3-axis sensor (units = meter).
   kProximity = 7,           // 1-axis sensor (units = ?).
+  kHallEffect = 8,          // 1-axis sensor (units = ?).
+  kHingeAngle = 9,          // 1-axis sensor (units = degrees).
 };
 
 // Helper function for determining if a sensor type is 3-axis, otherwise it's