SIM status page sync signal strength and service state behavior from systemUI

To make behavior consistent in the long run and refactor the code
into settingslib and call it from both Settings and SystemUI.

Bug: 110973964
Test: run testcase and do manual test - test case as below:
1. Testcase: packages/apps/Settings: -> ALL PASS
make RunSettingsRoboTests ROBOTEST_FILTER=SimStatusDialogControllerTest
2. Fake the service state's voice and data value,voice is out of service
and data is in-service,and then check service state and signal strength
at sim status page -> PASS

Change-Id: I4cc454b6b3d4242af4805e2878f9d46ce28649ad
This commit is contained in:
SongFerngWang
2018-08-22 15:55:07 +08:00
parent 48bbd85bd1
commit c6d5a0cb6a
2 changed files with 54 additions and 7 deletions

View File

@@ -50,6 +50,7 @@ import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.core.lifecycle.LifecycleObserver;
import com.android.settingslib.core.lifecycle.events.OnPause;
import com.android.settingslib.core.lifecycle.events.OnResume;
import com.android.settingslib.Utils;
import java.util.List;
@@ -253,8 +254,8 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
}
private void updateServiceState(ServiceState serviceState) {
final int state = serviceState.getState();
if (state == ServiceState.STATE_OUT_OF_SERVICE || state == ServiceState.STATE_POWER_OFF) {
final int state = Utils.getCombinedServiceState(serviceState);
if (!Utils.isInService(serviceState)) {
resetSignalStrength();
}
@@ -297,10 +298,8 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O
return;
}
final int state = getCurrentServiceState().getState();
if ((ServiceState.STATE_OUT_OF_SERVICE == state) ||
(ServiceState.STATE_POWER_OFF == state)) {
ServiceState serviceState = getCurrentServiceState();
if (serviceState == null || !Utils.isInService(serviceState)) {
return;
}