aboutsummaryrefslogtreecommitdiff
path: root/car-lib
diff options
context:
space:
mode:
authorEnrico Granata <egranata@google.com>2017-05-08 18:09:58 -0700
committerEnrico Granata <egranata@google.com>2017-05-10 10:50:55 -0700
commitc2393683cf3c144461fe2ba28f4fa8cd817d8cb1 (patch)
tree26df681390d43c8178f4781d5ecea6139c7548f7 /car-lib
parentfb6472fcbb10800e9ec6cfdfa8780870fd625286 (diff)
downloadCar-c2393683cf3c144461fe2ba28f4fa8cd817d8cb1.tar.gz
Add APIs to CarDiagnosticManager to check whether specific features are enabled
DiagnosticHalService has a DiagnosticCapabilities object that keeps track of whether any/all the diagnostic HAL properties are supported by the underlying implementation. This change exposes the same information up to CarDiagnosticManager for applications to use, in order to quickly check whether or not they can expect support from a car. Change-Id: I0fd05b1e24346483ea94432e428d0b0e56b7d7e4 Fixes: 38138457 Test: runtest -x packages/services/Car/tests/carservice_test/src/com/android/car/test/CarDiagnosticManagerTest.java -c com.android.car.test.CarDiagnosticManagerTest -m testIsSupportedApiCalls
Diffstat (limited to 'car-lib')
-rw-r--r--car-lib/src/android/car/hardware/CarDiagnosticManager.java66
-rw-r--r--car-lib/src/android/car/hardware/ICarDiagnostic.aidl22
2 files changed, 87 insertions, 1 deletions
diff --git a/car-lib/src/android/car/hardware/CarDiagnosticManager.java b/car-lib/src/android/car/hardware/CarDiagnosticManager.java
index 851dd878d3..0444c14389 100644
--- a/car-lib/src/android/car/hardware/CarDiagnosticManager.java
+++ b/car-lib/src/android/car/hardware/CarDiagnosticManager.java
@@ -271,6 +271,72 @@ public final class CarDiagnosticManager implements CarManagerBase {
return false;
}
+ /**
+ * Returns true if this vehicle supports sending live frame information.
+ * @return
+ * @throws CarNotConnectedException
+ */
+ public boolean isLiveFrameSupported() throws CarNotConnectedException {
+ try {
+ return mService.isLiveFrameSupported();
+ } catch (IllegalStateException e) {
+ CarApiUtil.checkCarNotConnectedExceptionFromCarService(e);
+ } catch (RemoteException e) {
+ throw new CarNotConnectedException();
+ }
+ return false;
+ }
+
+ /**
+ * Returns true if this vehicle supports sending freeze frame information.
+ * @return
+ * @throws CarNotConnectedException
+ */
+ public boolean isFreezeFrameSupported() throws CarNotConnectedException {
+ try {
+ return mService.isFreezeFrameSupported();
+ } catch (IllegalStateException e) {
+ CarApiUtil.checkCarNotConnectedExceptionFromCarService(e);
+ } catch (RemoteException e) {
+ throw new CarNotConnectedException();
+ }
+ return false;
+ }
+
+ /**
+ * Returns true if this vehicle supports retrieving freeze frame timestamps.
+ * This is only meaningful if freeze frame data is also supported.
+ * @return
+ * @throws CarNotConnectedException
+ */
+ public boolean isFreezeFrameTimestampSupported() throws CarNotConnectedException {
+ try {
+ return mService.isFreezeFrameTimestampSupported();
+ } catch (IllegalStateException e) {
+ CarApiUtil.checkCarNotConnectedExceptionFromCarService(e);
+ } catch (RemoteException e) {
+ throw new CarNotConnectedException();
+ }
+ return false;
+ }
+
+ /**
+ * Returns true if this vehicle supports clearing freeze frame timestamps.
+ * This is only meaningful if freeze frame data is also supported.
+ * @return
+ * @throws CarNotConnectedException
+ */
+ public boolean isFreezeFrameClearSupported() throws CarNotConnectedException {
+ try {
+ return mService.isFreezeFrameClearSupported();
+ } catch (IllegalStateException e) {
+ CarApiUtil.checkCarNotConnectedExceptionFromCarService(e);
+ } catch (RemoteException e) {
+ throw new CarNotConnectedException();
+ }
+ return false;
+ }
+
private static class CarDiagnosticEventListenerToService
extends ICarDiagnosticEventListener.Stub {
private final WeakReference<CarDiagnosticManager> mManager;
diff --git a/car-lib/src/android/car/hardware/ICarDiagnostic.aidl b/car-lib/src/android/car/hardware/ICarDiagnostic.aidl
index 098d2d4fcb..3afffc528b 100644
--- a/car-lib/src/android/car/hardware/ICarDiagnostic.aidl
+++ b/car-lib/src/android/car/hardware/ICarDiagnostic.aidl
@@ -52,4 +52,24 @@ interface ICarDiagnostic {
*/
void unregisterDiagnosticListener(int frameType,
in ICarDiagnosticEventListener callback) = 6;
-} \ No newline at end of file
+
+ /**
+ * Returns whether the underlying HAL supports live frames.
+ */
+ boolean isLiveFrameSupported() = 7;
+
+ /**
+ * Returns whether the underlying HAL supports freeze frames.
+ */
+ boolean isFreezeFrameSupported() = 8;
+
+ /**
+ * Returns whether the underlying HAL supports retrieving freeze frame timestamps.
+ */
+ boolean isFreezeFrameTimestampSupported() = 9;
+
+ /**
+ * Returns whether the underlying HAL supports clearing freeze frames.
+ */
+ boolean isFreezeFrameClearSupported() = 10;
+}