• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 state of {@link
33  * android.car.VehiclePropertyIds#LOW_SPEED_COLLISION_WARNING_STATE}.
34  *
35  * @hide
36  */
37 @FlaggedApi(FLAG_ANDROID_VIC_VEHICLE_PROPERTIES)
38 @SystemApi
39 public final class LowSpeedCollisionWarningState {
40 
41     /**
42      * This state is used as an alternative for any {@code LowSpeedCollisionWarningState} value that
43      * is not defined in the platform. Ideally, implementations of {@link
44      * android.car.VehiclePropertyIds#LOW_SPEED_COLLISION_WARNING_STATE} should not use this state.
45      * The framework can use this field to remain backwards compatible if {@code
46      * LowSpeedCollisionWarningState} is extended to include additional states.
47      */
48     public static final int OTHER = 0;
49     /**
50      * Low Speed Collision Warning is enabled and monitoring for potential collision, but no
51      * potential collision is detected.
52      */
53     public static final int NO_WARNING = 1;
54     /**
55      * Low Speed Collision Warning is enabled, detects a potential collision, and is actively
56      * warning the user.
57      */
58     public static final int WARNING = 2;
59 
LowSpeedCollisionWarningState()60     private LowSpeedCollisionWarningState() {}
61 
62     /**
63      * Returns a user-friendly representation of {@code LowSpeedCollisionWarningState}.
64      */
65     @NonNull
toString( @owSpeedCollisionWarningStateInt int lowSpeedCollisionWarningState)66     public static String toString(
67             @LowSpeedCollisionWarningStateInt int lowSpeedCollisionWarningState) {
68         String lowSpeedCollisionWarningStateString = ConstantDebugUtils.toName(
69                 LowSpeedCollisionWarningState.class, lowSpeedCollisionWarningState);
70         return (lowSpeedCollisionWarningStateString != null)
71                 ? lowSpeedCollisionWarningStateString
72                 : "0x" + Integer.toHexString(lowSpeedCollisionWarningState);
73     }
74 
75     /** @hide */
76     @IntDef({OTHER, NO_WARNING, WARNING})
77     @Retention(RetentionPolicy.SOURCE)
78     public @interface LowSpeedCollisionWarningStateInt {}
79 }
80