1 /*
2  * Copyright (C) 2022 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 package com.android.os.ext.testing;
17 
18 import java.util.Set;
19 
20 /**
21  * This class is intended to serve as a single place to define the current SDK extension versions to
22  * expect / allow in tests.
23  */
24 public class CurrentVersion {
25 
26     /**
27      * The latest train's version. Note that the value is inserted by the build pre-processing the
28      * source code.
29      */
30     public static final int CURRENT_TRAIN_VERSION = {INSERTED_BY_BUILD};
31 
32     /** The version R shipped with (0) */
33     public static final int R_BASE_VERSION = 0;
34 
35     /** The version S shipped with (1) */
36     public static final int S_BASE_VERSION = 1;
37 
38     /** The version T shipped with (3) */
39     public static final int T_BASE_VERSION = 3;
40 
41     /** The current platform's version */
42     public static final int CURRENT_BASE_VERSION = CURRENT_TRAIN_VERSION;
43 
44     /**
45      * The current SDK Extension versions to expect / allow in CTS.
46      *
47      * <p>Note: This construct exists because CTS is currently versioned together with the dessert
48      * versions, and not with the module itself. For example, Android R shipped with extension
49      * version 0, but it is allowed to preload new mainline trains with a higher extension version.
50      * When a new extension version is defined, this Set must therefore be extended to include the
51      * new version.
52      */
53     public static final Set<Integer> ALLOWED_VERSIONS_CTS =
54             CURRENT_BASE_VERSION == CURRENT_TRAIN_VERSION
55                     ? Set.of(CURRENT_BASE_VERSION)
56                     : Set.of(CURRENT_BASE_VERSION, CURRENT_TRAIN_VERSION);
57 }
58