1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.car.hardware.property; 18 19 import static android.car.feature.Flags.FLAG_ANDROID_VIC_VEHICLE_PROPERTIES; 20 21 import android.annotation.FlaggedApi; 22 import android.annotation.IntDef; 23 import android.annotation.NonNull; 24 import android.annotation.SystemApi; 25 26 import com.android.car.internal.util.ConstantDebugUtils; 27 28 import java.lang.annotation.Retention; 29 import java.lang.annotation.RetentionPolicy; 30 31 /** 32 * Used to enumerate the various level of automation that can be expressed by the 33 * {@link android.car.VehiclePropertyIds#VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL} property. 34 * 35 * @hide 36 */ 37 @FlaggedApi(FLAG_ANDROID_VIC_VEHICLE_PROPERTIES) 38 @SystemApi 39 public final class VehicleAutonomousState { 40 /** 41 * No automation. ADAS systems are limited to providing warnings and momentary assistance. The 42 * driver is in constant supervision of all driving tasks and must steer, brake or accelerate as 43 * needed to maintain safety, and is still responsible for driving while the ADAS systems are 44 * engaged. 45 */ 46 public static final int LEVEL_0 = 0; 47 /** 48 * Driver assistance. ADAS systems can provide steering or brake/acceleration support to the 49 * driver. The driver is in constant supervision of all driving tasks and must steer, brake or 50 * accelerate as needed to maintain safety, and is still responsible for driving while the ADAS 51 * systems are engaged. 52 */ 53 public static final int LEVEL_1 = 1; 54 /** 55 * Partial automation. ADAS systems can provide both steering and brake/acceleration support to 56 * the driver at the same time. The driver is in constant supervision of all driving tasks and 57 * must steer, brake or accelerate as needed to maintain safety, and is still responsible for 58 * driving while the ADAS systems are engaged. 59 */ 60 public static final int LEVEL_2 = 2; 61 /** 62 * Conditional automation. ADAS systems can drive the vehicle under limited conditions and will 63 * not operate unless all required conditions are met. The driver is required to take over 64 * control of the vehicle when requested to do so by the ADAS systems, however is not 65 * responsible for driving while the ADAS systems are engaged. 66 */ 67 public static final int LEVEL_3 = 3; 68 /** 69 * High automation. ADAS systems can drive the vehicle under limited conditions and will not 70 * operate unless all required conditions are met. The driver is not required to take over 71 * control of the vehicle and is not responsible for driving while the ADAS systems are engaged. 72 */ 73 public static final int LEVEL_4 = 4; 74 /** 75 * Full automation. ADAS systems can drive the vehicle under all conditions. The driver is not 76 * required to take over control of the vehicle and is not responsible for driving while the 77 * ADAS systems are engaged. 78 */ 79 public static final int LEVEL_5 = 5; 80 VehicleAutonomousState()81 private VehicleAutonomousState() {} 82 83 /** 84 * Returns a user-friendly representation of {@code VehicleAutonomousState}. 85 */ 86 @NonNull toString(@ehicleAutonomousStateInt int vehicleAutonomousState)87 public static String toString(@VehicleAutonomousStateInt int vehicleAutonomousState) { 88 String vehicleAutonomousStateString = ConstantDebugUtils.toName( 89 VehicleAutonomousState.class, vehicleAutonomousState); 90 return (vehicleAutonomousStateString != null) 91 ? vehicleAutonomousStateString 92 : "0x" + Integer.toHexString(vehicleAutonomousState); 93 } 94 95 /** @hide */ 96 @IntDef({LEVEL_0, LEVEL_1, LEVEL_2, LEVEL_3, LEVEL_4, LEVEL_5}) 97 @Retention(RetentionPolicy.SOURCE) 98 public @interface VehicleAutonomousStateInt {} 99 } 100