Disable icon for NetworkOperatorPreference

When using old api, disable icon because data in CellInfo is wrong.

Fixes: 128393160
Test: RunSettingsRoboTests
Change-Id: Ide5b424e86d2f0a19cf1e0e6bf22edb270822690
This commit is contained in:
Lei Yu
2019-04-11 10:21:47 -07:00
parent fd3cf32ad8
commit e9226c4bba
2 changed files with 76 additions and 1 deletions

View File

@@ -50,6 +50,7 @@ public class NetworkOperatorPreference extends Preference {
private List<String> mForbiddenPlmns;
private int mLevel = LEVEL_NONE;
private boolean mShow4GForLTE;
private boolean mUseNewApi;
// The following constants are used to draw signal icon.
private static final Drawable EMPTY_DRAWABLE = new ColorDrawable(Color.TRANSPARENT);
@@ -61,6 +62,8 @@ public class NetworkOperatorPreference extends Preference {
mCellInfo = cellinfo;
mForbiddenPlmns = forbiddenPlmns;
mShow4GForLTE = show4GForLTE;
mUseNewApi = context.getResources().getBoolean(
com.android.internal.R.bool.config_enableNewAutoSelectNetworkUI);
refresh();
}
@@ -114,7 +117,9 @@ public class NetworkOperatorPreference extends Preference {
}
private void updateIcon(int level) {
if (level < 0 || level >= NUMBER_OF_LEVELS) return;
if (!mUseNewApi || level < 0 || level >= NUMBER_OF_LEVELS) {
return;
}
Context context = getContext();
SignalDrawable signalDrawable = new SignalDrawable(getContext());
signalDrawable.setLevel(