• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2024 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.internal.telephony.uicc;
18 
19 import android.annotation.IntDef;
20 
21 import java.lang.annotation.Retention;
22 import java.lang.annotation.RetentionPolicy;
23 
24 /**
25  * This class contains the sim type information of active physical slot ids.
26  */
27 public class SimTypeInfo {
28 
29     /**
30      * SimType (bit mask)
31      */
32     @Retention(RetentionPolicy.SOURCE)
33     @IntDef({
34             SimType.SIM_TYPE_UNKNOWN,
35             SimType.SIM_TYPE_PHYSICAL,
36             SimType.SIM_TYPE_ESIM,
37     })
38     public @interface SimType {
39         /** Unknown SIM */
40         int SIM_TYPE_UNKNOWN = 0;
41         /** Physical SIM (Can have eUICC capabilities) */
42         int SIM_TYPE_PHYSICAL = 1 << 0;
43         /** Embedded SIM*/
44         int SIM_TYPE_ESIM = 1 << 1;
45     }
46 
47     public @SimType int mCurrentSimType = SimType.SIM_TYPE_UNKNOWN;
48     // Bitmask of the supported {@code SimType}s
49     public int mSupportedSimTypes;
50 
51     /**
52      * Set the current SimType according to the input type.
53      */
setCurrentSimType(int simType)54     public void setCurrentSimType(int simType) {
55         switch(simType) {
56             case android.hardware.radio.config.SimType.UNKNOWN:
57                 mCurrentSimType = SimType.SIM_TYPE_UNKNOWN;
58                 break;
59             case android.hardware.radio.config.SimType.PHYSICAL:
60                 mCurrentSimType = SimType.SIM_TYPE_PHYSICAL;
61                 break;
62             case android.hardware.radio.config.SimType.ESIM:
63                 mCurrentSimType = SimType.SIM_TYPE_ESIM;
64                 break;
65             default:
66                 throw new RuntimeException("Unrecognized RIL_SimType: " + simType);
67         }
68     }
69 
70     @Override
toString()71     public String toString() {
72         StringBuilder sb = new StringBuilder();
73         sb.append("SimTypeInfo {activeSimType=").append(mCurrentSimType).append(",")
74                 .append("supportedSimType=").append(mSupportedSimTypes);
75         sb.append("}");
76         return sb.toString();
77     }
78 }
79