1 /*
2  * Copyright (C) 2019 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.cdnr;
18 
19 import android.text.TextUtils;
20 
21 import com.android.internal.telephony.uicc.IccRecords;
22 import com.android.internal.telephony.uicc.RuimRecords;
23 
24 /** Ef data from Ruim. */
25 public final class RuimEfData implements EfData {
26     // No spn on roaming, no plmn on home.
27     private static final int DEFAULT_CARRIER_NAME_DISPLAY_CONDITION_BITMASK = 0;
28     private final RuimRecords mRuim;
29 
RuimEfData(RuimRecords ruim)30     public RuimEfData(RuimRecords ruim) {
31         mRuim = ruim;
32     }
33 
34     @Override
getServiceProviderName()35     public String getServiceProviderName() {
36         String spn = mRuim.getServiceProviderName();
37         return TextUtils.isEmpty(spn) ? null : spn;
38     }
39 
40     @Override
getServiceProviderNameDisplayCondition(boolean isRoaming)41     public int getServiceProviderNameDisplayCondition(boolean isRoaming) {
42         return mRuim.getCsimSpnDisplayCondition()
43                 ? IccRecords.CARRIER_NAME_DISPLAY_CONDITION_BITMASK_SPN :
44                 DEFAULT_CARRIER_NAME_DISPLAY_CONDITION_BITMASK;
45     }
46 }
47