[Settings] Code refactor
1. Replace the detection of screen on 2. Refactor updateCell method Bug: 147263514 Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=NetworkSelectSettingsTest Test: make RunSettingsRoboTests -j ROBOTEST_FILTER=NetworkOperatorPreferenceTest Change-Id: I1ae3ee4d1b62b488aeb2163f42878697b770be65
This commit is contained in:
@@ -68,9 +68,7 @@ public class NetworkOperatorPreference extends Preference {
|
|||||||
public NetworkOperatorPreference(Context context, CellIdentity connectedCellId,
|
public NetworkOperatorPreference(Context context, CellIdentity connectedCellId,
|
||||||
List<String> forbiddenPlmns, boolean show4GForLTE) {
|
List<String> forbiddenPlmns, boolean show4GForLTE) {
|
||||||
this(context, forbiddenPlmns, show4GForLTE);
|
this(context, forbiddenPlmns, show4GForLTE);
|
||||||
mCellInfo = null;
|
updateCell(null, connectedCellId);
|
||||||
mCellId = connectedCellId;
|
|
||||||
refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private NetworkOperatorPreference(
|
private NetworkOperatorPreference(
|
||||||
@@ -86,8 +84,12 @@ public class NetworkOperatorPreference extends Preference {
|
|||||||
* Change cell information
|
* Change cell information
|
||||||
*/
|
*/
|
||||||
public void updateCell(CellInfo cellinfo) {
|
public void updateCell(CellInfo cellinfo) {
|
||||||
|
updateCell(cellinfo, CellInfoUtil.getCellIdentity(cellinfo));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateCell(CellInfo cellinfo, CellIdentity cellId) {
|
||||||
mCellInfo = cellinfo;
|
mCellInfo = cellinfo;
|
||||||
mCellId = CellInfoUtil.getCellIdentity(cellinfo);
|
mCellId = cellId;
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ public class NetworkSelectSettings extends DashboardFragment {
|
|||||||
private boolean mUseNewApi;
|
private boolean mUseNewApi;
|
||||||
private long mRequestIdManualNetworkSelect;
|
private long mRequestIdManualNetworkSelect;
|
||||||
private long mRequestIdManualNetworkScan;
|
private long mRequestIdManualNetworkScan;
|
||||||
private boolean mScreenIsOn;
|
|
||||||
private long mWaitingForNumberOfScanResults;
|
private long mWaitingForNumberOfScanResults;
|
||||||
|
|
||||||
private static final int MIN_NUMBER_OF_SCAN_REQUIRED = 2;
|
private static final int MIN_NUMBER_OF_SCAN_REQUIRED = 2;
|
||||||
@@ -138,7 +137,6 @@ public class NetworkSelectSettings extends DashboardFragment {
|
|||||||
if (isProgressBarVisible()) {
|
if (isProgressBarVisible()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mScreenIsOn = true;
|
|
||||||
if (mWaitingForNumberOfScanResults <= 0) {
|
if (mWaitingForNumberOfScanResults <= 0) {
|
||||||
startNetworkQuery();
|
startNetworkQuery();
|
||||||
}
|
}
|
||||||
@@ -158,7 +156,6 @@ public class NetworkSelectSettings extends DashboardFragment {
|
|||||||
@Override
|
@Override
|
||||||
public void onStop() {
|
public void onStop() {
|
||||||
super.onStop();
|
super.onStop();
|
||||||
mScreenIsOn = false;
|
|
||||||
if (mWaitingForNumberOfScanResults <= 0) {
|
if (mWaitingForNumberOfScanResults <= 0) {
|
||||||
stopNetworkQuery();
|
stopNetworkQuery();
|
||||||
}
|
}
|
||||||
@@ -241,7 +238,7 @@ public class NetworkSelectSettings extends DashboardFragment {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mWaitingForNumberOfScanResults--;
|
mWaitingForNumberOfScanResults--;
|
||||||
if ((!mScreenIsOn) && (mWaitingForNumberOfScanResults <= 0)) {
|
if ((mWaitingForNumberOfScanResults <= 0) && (!isResumed())) {
|
||||||
stopNetworkQuery();
|
stopNetworkQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user