Merge "Fixed service state changed event" am: 372b449bbb
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2034524 Change-Id: Iaa102c18662c7592c9346ef5b7c393ed1d1c8814
This commit is contained in:
@@ -1205,7 +1205,15 @@ public class ServiceState implements Parcelable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
/**
|
||||||
|
* Initialize the service state. Set everything to the default value.
|
||||||
|
*
|
||||||
|
* @param legacyMode {@code true} if the device is on IWLAN legacy mode, where IWLAN is
|
||||||
|
* considered as a RAT on WWAN {@link NetworkRegistrationInfo}. {@code false} if the device
|
||||||
|
* is on AP-assisted mode, where IWLAN should be reported through WLAN.
|
||||||
|
* {@link NetworkRegistrationInfo}.
|
||||||
|
*/
|
||||||
|
private void init(boolean legacyMode) {
|
||||||
if (DBG) Rlog.d(LOG_TAG, "init");
|
if (DBG) Rlog.d(LOG_TAG, "init");
|
||||||
mVoiceRegState = STATE_OUT_OF_SERVICE;
|
mVoiceRegState = STATE_OUT_OF_SERVICE;
|
||||||
mDataRegState = STATE_OUT_OF_SERVICE;
|
mDataRegState = STATE_OUT_OF_SERVICE;
|
||||||
@@ -1237,6 +1245,13 @@ public class ServiceState implements Parcelable {
|
|||||||
.setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
|
.setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WWAN)
|
||||||
.setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN)
|
.setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN)
|
||||||
.build());
|
.build());
|
||||||
|
if (!legacyMode) {
|
||||||
|
addNetworkRegistrationInfo(new NetworkRegistrationInfo.Builder()
|
||||||
|
.setDomain(NetworkRegistrationInfo.DOMAIN_PS)
|
||||||
|
.setTransportType(AccessNetworkConstants.TRANSPORT_TYPE_WLAN)
|
||||||
|
.setRegistrationState(NetworkRegistrationInfo.REGISTRATION_STATE_UNKNOWN)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mOperatorAlphaLongRaw = null;
|
mOperatorAlphaLongRaw = null;
|
||||||
mOperatorAlphaShortRaw = null;
|
mOperatorAlphaShortRaw = null;
|
||||||
@@ -1245,15 +1260,32 @@ public class ServiceState implements Parcelable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setStateOutOfService() {
|
public void setStateOutOfService() {
|
||||||
init();
|
init(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStateOff() {
|
public void setStateOff() {
|
||||||
init();
|
init(true);
|
||||||
mVoiceRegState = STATE_POWER_OFF;
|
mVoiceRegState = STATE_POWER_OFF;
|
||||||
mDataRegState = STATE_POWER_OFF;
|
mDataRegState = STATE_POWER_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the service state to out-of-service
|
||||||
|
*
|
||||||
|
* @param legacyMode {@code true} if the device is on IWLAN legacy mode, where IWLAN is
|
||||||
|
* considered as a RAT on WWAN {@link NetworkRegistrationInfo}. {@code false} if the device
|
||||||
|
* is on AP-assisted mode, where IWLAN should be reported through WLAN.
|
||||||
|
* @param powerOff {@code true} if this is a power off case (i.e. Airplane mode on).
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void setOutOfService(boolean legacyMode, boolean powerOff) {
|
||||||
|
init(legacyMode);
|
||||||
|
if (powerOff) {
|
||||||
|
mVoiceRegState = STATE_POWER_OFF;
|
||||||
|
mDataRegState = STATE_POWER_OFF;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setState(int state) {
|
public void setState(int state) {
|
||||||
setVoiceRegState(state);
|
setVoiceRegState(state);
|
||||||
if (DBG) Rlog.e(LOG_TAG, "[ServiceState] setState deprecated use setVoiceRegState()");
|
if (DBG) Rlog.e(LOG_TAG, "[ServiceState] setState deprecated use setVoiceRegState()");
|
||||||
|
|||||||
Reference in New Issue
Block a user