1 /*
2  * Copyright (C) 2020 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 com.android.car.internal.common;
18 
19 import static com.android.car.internal.ExcludeFromCodeCoverageGeneratedReport.BOILERPLATE_CODE;
20 
21 import android.annotation.IntDef;
22 import android.annotation.UserIdInt;
23 
24 import com.android.car.internal.ExcludeFromCodeCoverageGeneratedReport;
25 
26 import java.lang.annotation.Retention;
27 import java.lang.annotation.RetentionPolicy;
28 
29 /**
30  * Provides common constants for Car library, Car Service, and System Server.
31  *
32  * @hide
33  */
34 public final class CommonConstants {
35 
36     @ExcludeFromCodeCoverageGeneratedReport(reason = BOILERPLATE_CODE)
CommonConstants()37     private CommonConstants() {
38         throw new UnsupportedOperationException("contains only static constants");
39     }
40 
41     // CarUserManagerConstants
42 
43     public static final int USER_LIFECYCLE_EVENT_TYPE_STARTING = 1;
44     public static final int USER_LIFECYCLE_EVENT_TYPE_SWITCHING = 2;
45     public static final int USER_LIFECYCLE_EVENT_TYPE_UNLOCKING = 3;
46     public static final int USER_LIFECYCLE_EVENT_TYPE_UNLOCKED = 4;
47     public static final int USER_LIFECYCLE_EVENT_TYPE_STOPPING = 5;
48     public static final int USER_LIFECYCLE_EVENT_TYPE_STOPPED = 6;
49     public static final int USER_LIFECYCLE_EVENT_TYPE_POST_UNLOCKED = 7;
50     public static final int USER_LIFECYCLE_EVENT_TYPE_CREATED = 8;
51     public static final int USER_LIFECYCLE_EVENT_TYPE_REMOVED = 9;
52     public static final int USER_LIFECYCLE_EVENT_TYPE_VISIBLE = 10;
53     public static final int USER_LIFECYCLE_EVENT_TYPE_INVISIBLE = 11;
54 
55     // CarService Constants
56     public static final String CAR_SERVICE_INTERFACE = "android.car.ICar";
57 
58     public static final int INVALID_GID = -1;
59     public static final int INVALID_PID = -1;
60 
61     // Represents an invalid user id. This must have the same value as UserHandle#USER_NULL.
62     public static final @UserIdInt int INVALID_USER_ID = -10000;
63 
64     @IntDef(prefix = { "USER_LIFECYCLE_EVENT_TYPE_" }, value = {
65             USER_LIFECYCLE_EVENT_TYPE_STARTING,
66             USER_LIFECYCLE_EVENT_TYPE_SWITCHING,
67             USER_LIFECYCLE_EVENT_TYPE_UNLOCKING,
68             USER_LIFECYCLE_EVENT_TYPE_UNLOCKED,
69             USER_LIFECYCLE_EVENT_TYPE_STOPPING,
70             USER_LIFECYCLE_EVENT_TYPE_STOPPED,
71             USER_LIFECYCLE_EVENT_TYPE_POST_UNLOCKED,
72             USER_LIFECYCLE_EVENT_TYPE_CREATED,
73             USER_LIFECYCLE_EVENT_TYPE_REMOVED,
74             USER_LIFECYCLE_EVENT_TYPE_VISIBLE,
75             USER_LIFECYCLE_EVENT_TYPE_INVISIBLE,
76     })
77     @Retention(RetentionPolicy.SOURCE)
78     public @interface UserLifecycleEventType{}
79 
80     /** Empty arrays */
81     public static final int[] EMPTY_INT_ARRAY = new int[0];
82     public static final long[] EMPTY_LONG_ARRAY = new long[0];
83     public static final float[] EMPTY_FLOAT_ARRAY = new float[0];
84     public static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
85 }
86