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 airbag locations per seat. 33 * 34 * @hide 35 */ 36 @FlaggedApi(FLAG_ANDROID_VIC_VEHICLE_PROPERTIES) 37 @SystemApi 38 public final class VehicleAirbagLocation { 39 /** 40 * This state is used as an alternative for any {@code VehicleAirbagLocation} value that is not 41 * defined in the platform. Ideally, implementations of {@link 42 * android.car.VehiclePropertyIds#SEAT_AIRBAGS_DEPLOYED} should not use this state. The 43 * framework can use this field to remain backwards compatible if {@code VehicleAirbagLocation} 44 * is extended to include additional states. 45 */ 46 public static final int OTHER = 0x01; 47 /** 48 * Front airbags. This enum is for the airbags that protect the seated person from the front, 49 * particularly the seated person's torso. 50 */ 51 public static final int FRONT = 0x02; 52 /** 53 * Knee airbags. This enum is for the airbags that protect the seated person's knees. 54 */ 55 public static final int KNEE = 0x04; 56 /** 57 * Left side airbags. This enum is for the side airbags that protect the left side of the seated 58 * person. 59 */ 60 public static final int LEFT_SIDE = 0x08; 61 /** 62 * Right side airbags. This enum is for the side airbags that protect the right side of the 63 * seated person. 64 */ 65 public static final int RIGHT_SIDE = 0x10; 66 /** 67 * Curtain airbags. This enum is for the airbags lined above the windows of the vehicle. 68 */ 69 public static final int CURTAIN = 0x20; 70 VehicleAirbagLocation()71 private VehicleAirbagLocation() {} 72 73 /** 74 * Returns a user-friendly representation of {@code VehicleAirbagLocation}. 75 */ 76 @NonNull toString(@ehicleAirbagLocationInt int vehicleAirbagLocation)77 public static String toString(@VehicleAirbagLocationInt int vehicleAirbagLocation) { 78 String vehicleAirbagLocationString = ConstantDebugUtils.toName( 79 VehicleAirbagLocation.class, vehicleAirbagLocation); 80 return (vehicleAirbagLocationString != null) 81 ? vehicleAirbagLocationString 82 : "0x" + Integer.toHexString(vehicleAirbagLocation); 83 } 84 85 /** @hide */ 86 @IntDef({OTHER, FRONT, KNEE, LEFT_SIDE, RIGHT_SIDE, CURTAIN}) 87 @Retention(RetentionPolicy.SOURCE) 88 public @interface VehicleAirbagLocationInt {} 89 } 90