Merge "[Settings] Code refactor"

This commit is contained in:
Bonian Chen
2020-01-07 16:08:14 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 8 deletions

View File

@@ -68,9 +68,7 @@ public class NetworkOperatorPreference extends Preference {
public NetworkOperatorPreference(Context context, CellIdentity connectedCellId,
List<String> forbiddenPlmns, boolean show4GForLTE) {
this(context, forbiddenPlmns, show4GForLTE);
mCellInfo = null;
mCellId = connectedCellId;
refresh();
updateCell(null, connectedCellId);
}
private NetworkOperatorPreference(
@@ -86,8 +84,12 @@ public class NetworkOperatorPreference extends Preference {
* Change cell information
*/
public void updateCell(CellInfo cellinfo) {
updateCell(cellinfo, CellInfoUtil.getCellIdentity(cellinfo));
}
private void updateCell(CellInfo cellinfo, CellIdentity cellId) {
mCellInfo = cellinfo;
mCellId = CellInfoUtil.getCellIdentity(cellinfo);
mCellId = cellId;
refresh();
}

View File

@@ -85,7 +85,6 @@ public class NetworkSelectSettings extends DashboardFragment {
private boolean mUseNewApi;
private long mRequestIdManualNetworkSelect;
private long mRequestIdManualNetworkScan;
private boolean mScreenIsOn;
private long mWaitingForNumberOfScanResults;
private static final int MIN_NUMBER_OF_SCAN_REQUIRED = 2;
@@ -138,7 +137,6 @@ public class NetworkSelectSettings extends DashboardFragment {
if (isProgressBarVisible()) {
return;
}
mScreenIsOn = true;
if (mWaitingForNumberOfScanResults <= 0) {
startNetworkQuery();
}
@@ -158,7 +156,6 @@ public class NetworkSelectSettings extends DashboardFragment {
@Override
public void onStop() {
super.onStop();
mScreenIsOn = false;
if (mWaitingForNumberOfScanResults <= 0) {
stopNetworkQuery();
}
@@ -241,7 +238,7 @@ public class NetworkSelectSettings extends DashboardFragment {
break;
}
mWaitingForNumberOfScanResults--;
if ((!mScreenIsOn) && (mWaitingForNumberOfScanResults <= 0)) {
if ((mWaitingForNumberOfScanResults <= 0) && (!isResumed())) {
stopNetworkQuery();
}