Merge "Update show4GForLTE config"

This commit is contained in:
TreeHugger Robot
2018-11-03 07:10:34 +00:00
committed by Android (Google) Code Review
4 changed files with 17 additions and 80 deletions

View File

@@ -1,57 +0,0 @@
/*
* Copyright (C) 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.settings.network.telephony;
import androidx.preference.Preference;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
/**
* List of Phone-specific settings screens.
*/
public class CdmaOptions {
private static final String LOG_TAG = "CdmaOptions";
private static final String BUTTON_CDMA_SYSTEM_SELECT_KEY = "cdma_system_select_key";
private static final String BUTTON_CDMA_SUBSCRIPTION_KEY = "cdma_subscription_key";
private PreferenceFragmentCompat mPrefFragment;
public CdmaOptions(PreferenceFragmentCompat prefFragment, PreferenceScreen prefScreen,
int subId) {
mPrefFragment = prefFragment;
}
public boolean preferenceTreeClick(Preference preference) {
//TODO(b/114749736): handle it in preferenceController and remove this file
if (preference.getKey().equals(BUTTON_CDMA_SYSTEM_SELECT_KEY)) {
log("preferenceTreeClick: return BUTTON_CDMA_ROAMING_KEY true");
return true;
}
if (preference.getKey().equals(BUTTON_CDMA_SUBSCRIPTION_KEY)) {
log("preferenceTreeClick: return CDMA_SUBSCRIPTION_KEY true");
return true;
}
return false;
}
protected void log(String s) {
android.util.Log.d(LOG_TAG, s);
}
}

View File

@@ -45,7 +45,8 @@ public class EnabledNetworkModePreferenceController extends BasePreferenceContro
private PersistableBundle mPersistableBundle;
private int mSubId;
private boolean mIsGlobalCdma;
private boolean mShow4GForLTE;
@VisibleForTesting
boolean mShow4GForLTE;
public EnabledNetworkModePreferenceController(Context context, String key) {
super(context, key);
@@ -111,12 +112,10 @@ public class EnabledNetworkModePreferenceController extends BasePreferenceContro
mTelephonyManager.getLteOnCdmaMode() == PhoneConstants.LTE_ON_CDMA_TRUE;
mIsGlobalCdma = isLteOnCdma
&& mPersistableBundle.getBoolean(CarrierConfigManager.KEY_SHOW_CDMA_CHOICES_BOOL);
initShow4GForLTE();
}
@VisibleForTesting
void initShow4GForLTE() {
mShow4GForLTE = MobileNetworkUtils.isShow4GForLTE(mContext);
mShow4GForLTE = mPersistableBundle != null
? mPersistableBundle.getBoolean(
CarrierConfigManager.KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL)
: false;
}
private int getPreferredNetworkMode() {

View File

@@ -386,19 +386,6 @@ public class MobileNetworkUtils {
return false;
}
public static boolean isShow4GForLTE(Context context) {
//TODO(b/117882862): move this to framework
try {
Context con = context.createPackageContext("com.android.systemui", 0);
int id = con.getResources().getIdentifier("config_show4GForLTE",
"bool", "com.android.systemui");
return con.getResources().getBoolean(id);
} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "NameNotFoundException for show4GFotLTE");
return false;
}
}
/**
* Return {@code true} if Tdscdma is supported in current subscription
*/