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.settingslib.net; 18 19 import android.content.Context; 20 import android.os.PersistableBundle; 21 import android.telephony.CarrierConfigManager; 22 23 /** 24 * Utilities for dealing with signal strength. 25 */ 26 public class SignalStrengthUtil { 27 /** 28 * @return whether we should artificially inflate the signal strength and number of levels by 1 29 * bar for the subscription with the given id 30 */ shouldInflateSignalStrength(Context context, int subscriptionId)31 public static boolean shouldInflateSignalStrength(Context context, int subscriptionId) { 32 final CarrierConfigManager carrierConfigMgr = 33 context.getSystemService(CarrierConfigManager.class); 34 PersistableBundle bundle = null; 35 if (carrierConfigMgr != null) { 36 bundle = carrierConfigMgr.getConfigForSubId(subscriptionId); 37 } 38 return (bundle != null && bundle.getBoolean( 39 CarrierConfigManager.KEY_INFLATE_SIGNAL_STRENGTH_BOOL, false)); 40 } 41 } 42