Add test for SENSOR_TYPE_PARKING_BRAKE

Bug:120674903
Test: run cts
Change-Id: Iea1180c61717388cdfec35f7ed1a080cb71fa1c7
(cherry picked from commit 06e43aa3194b53a1975b1d302e817c0b10652557)
diff --git a/tests/tests/car/src/android/car/cts/CarSensorManagerTest.java b/tests/tests/car/src/android/car/cts/CarSensorManagerTest.java
index d19d04d..abd983d 100644
--- a/tests/tests/car/src/android/car/cts/CarSensorManagerTest.java
+++ b/tests/tests/car/src/android/car/cts/CarSensorManagerTest.java
@@ -56,26 +56,31 @@
     @CddTest(requirement="2.5.1")
     @Test
     public void testRequiredSensorsForDrivingState() throws Exception {
-        boolean foundSpeed = false;
-        boolean foundGear = false;
-        for (int sensor: mSupportedSensors) {
-            if (sensor == CarSensorManager.SENSOR_TYPE_CAR_SPEED) {
-                foundSpeed = true;
-            } else if ( sensor == CarSensorManager.SENSOR_TYPE_GEAR) {
-                foundGear = true;
-            }
-            if (foundGear && foundSpeed) {
-                break;
-            }
-        }
-        assertTrue(foundGear && foundSpeed);
+        boolean foundSpeed =
+            isSupportSensor(CarSensorManager.SENSOR_TYPE_CAR_SPEED);
+        boolean foundGear = isSupportSensor(CarSensorManager.SENSOR_TYPE_GEAR);
+        assertTrue("Must support SENSOR_TYPE_CAR_SPEED", foundSpeed);
+        assertTrue("Must support SENSOR_TYPE_GEAR", foundGear);
     }
 
     @CddTest(requirement="2.5.1")
     @Test
     public void testMustSupportNightSensor() {
-        assertTrue("Must support SENSOR_TYPE_NIGHT",
-                IntStream.of(mSupportedSensors)
-                        .anyMatch(x -> x == CarSensorManager.SENSOR_TYPE_NIGHT));
+        boolean foundNightSensor =
+            isSupportSensor(CarSensorManager.SENSOR_TYPE_NIGHT);
+        assertTrue("Must support SENSOR_TYPE_NIGHT", foundNightSensor);
+    }
+
+    @CddTest(requirement = "2.5.1")
+    @Test
+    public void testMustSupportParkingBrake() throws Exception {
+        boolean foundParkingBrake =
+            isSupportSensor(CarSensorManager.SENSOR_TYPE_PARKING_BRAKE);
+        assertTrue("Must support SENSOR_TYPE_PARKING_BRAKE", foundParkingBrake);
+    }
+
+    private boolean isSupportSensor(int sensorType) {
+        return IntStream.of(mSupportedSensors)
+            .anyMatch(x -> x == sensorType);
     }
 }