• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 public final class CommonConstants {
33 
34     @ExcludeFromCodeCoverageGeneratedReport(reason = BOILERPLATE_CODE)
CommonConstants()35     private CommonConstants() {
36         throw new UnsupportedOperationException("contains only static constants");
37     }
38 
39     // CarUserManagerConstants
40 
41     public static final int USER_LIFECYCLE_EVENT_TYPE_STARTING = 1;
42     public static final int USER_LIFECYCLE_EVENT_TYPE_SWITCHING = 2;
43     public static final int USER_LIFECYCLE_EVENT_TYPE_UNLOCKING = 3;
44     public static final int USER_LIFECYCLE_EVENT_TYPE_UNLOCKED = 4;
45     public static final int USER_LIFECYCLE_EVENT_TYPE_STOPPING = 5;
46     public static final int USER_LIFECYCLE_EVENT_TYPE_STOPPED = 6;
47     public static final int USER_LIFECYCLE_EVENT_TYPE_POST_UNLOCKED = 7;
48     public static final int USER_LIFECYCLE_EVENT_TYPE_CREATED = 8;
49     public static final int USER_LIFECYCLE_EVENT_TYPE_REMOVED = 9;
50     public static final int USER_LIFECYCLE_EVENT_TYPE_VISIBLE = 10;
51     public static final int USER_LIFECYCLE_EVENT_TYPE_INVISIBLE = 11;
52 
53     // CarService Constants
54     public static final String CAR_SERVICE_INTERFACE = "android.car.ICar";
55 
56     public static final int INVALID_GID = -1;
57     public static final int INVALID_PID = -1;
58 
59     // Represents an invalid user id. This must have the same value as UserHandle#USER_NULL.
60     public static final @UserIdInt int INVALID_USER_ID = -10000;
61 
62     @IntDef(prefix = { "USER_LIFECYCLE_EVENT_TYPE_" }, value = {
63             USER_LIFECYCLE_EVENT_TYPE_STARTING,
64             USER_LIFECYCLE_EVENT_TYPE_SWITCHING,
65             USER_LIFECYCLE_EVENT_TYPE_UNLOCKING,
66             USER_LIFECYCLE_EVENT_TYPE_UNLOCKED,
67             USER_LIFECYCLE_EVENT_TYPE_STOPPING,
68             USER_LIFECYCLE_EVENT_TYPE_STOPPED,
69             USER_LIFECYCLE_EVENT_TYPE_POST_UNLOCKED,
70             USER_LIFECYCLE_EVENT_TYPE_CREATED,
71             USER_LIFECYCLE_EVENT_TYPE_REMOVED,
72             USER_LIFECYCLE_EVENT_TYPE_VISIBLE,
73             USER_LIFECYCLE_EVENT_TYPE_INVISIBLE,
74     })
75     @Retention(RetentionPolicy.SOURCE)
76     public @interface UserLifecycleEventType{}
77 
78     /** Empty arrays */
79     public static final int[] EMPTY_INT_ARRAY = new int[0];
80     public static final long[] EMPTY_LONG_ARRAY = new long[0];
81     public static final float[] EMPTY_FLOAT_ARRAY = new float[0];
82     public static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
83 }
84