Skip to content

Commit 0e430cc

Browse files
Jean-Baptiste QueruAndroid Code Review
authored andcommitted
Merge "Telephony: Fix radio state printing"
2 parents fb1e552 + 9a8e567 commit 0e430cc

File tree

1 file changed

+21
-16
lines changed
  • telephony/java/com/android/internal/telephony

1 file changed

+21
-16
lines changed

telephony/java/com/android/internal/telephony/RIL.java

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,26 +1961,30 @@ private void sendScreenState(boolean on) {
19611961
sendScreenState(true);
19621962
}
19631963

1964-
private void setRadioStateFromRILInt(int state) {
1965-
RadioState newState;
1964+
private RadioState getRadioStateFromInt(int stateInt) {
1965+
RadioState state;
19661966

19671967
/* RIL_RadioState ril.h */
1968-
switch(state) {
1969-
case 0: newState = RadioState.RADIO_OFF; break;
1970-
case 1: newState = RadioState.RADIO_UNAVAILABLE; break;
1971-
case 2: newState = RadioState.SIM_NOT_READY; break;
1972-
case 3: newState = RadioState.SIM_LOCKED_OR_ABSENT; break;
1973-
case 4: newState = RadioState.SIM_READY; break;
1974-
case 5: newState = RadioState.RUIM_NOT_READY; break;
1975-
case 6: newState = RadioState.RUIM_READY; break;
1976-
case 7: newState = RadioState.RUIM_LOCKED_OR_ABSENT; break;
1977-
case 8: newState = RadioState.NV_NOT_READY; break;
1978-
case 9: newState = RadioState.NV_READY; break;
1968+
switch(stateInt) {
1969+
case 0: state = RadioState.RADIO_OFF; break;
1970+
case 1: state = RadioState.RADIO_UNAVAILABLE; break;
1971+
case 2: state = RadioState.SIM_NOT_READY; break;
1972+
case 3: state = RadioState.SIM_LOCKED_OR_ABSENT; break;
1973+
case 4: state = RadioState.SIM_READY; break;
1974+
case 5: state = RadioState.RUIM_NOT_READY; break;
1975+
case 6: state = RadioState.RUIM_READY; break;
1976+
case 7: state = RadioState.RUIM_LOCKED_OR_ABSENT; break;
1977+
case 8: state = RadioState.NV_NOT_READY; break;
1978+
case 9: state = RadioState.NV_READY; break;
19791979

19801980
default:
19811981
throw new RuntimeException(
1982-
"Unrecognized RIL_RadioState: " +state);
1982+
"Unrecognized RIL_RadioState: " + stateInt);
19831983
}
1984+
return state;
1985+
}
1986+
1987+
private void switchToRadioState(RadioState newState) {
19841988

19851989
if (mInitialRadioStateChange) {
19861990
if (newState.isOn()) {
@@ -2361,9 +2365,10 @@ private RILRequest findAndRemoveRequestFromList(int serial) {
23612365
switch(response) {
23622366
case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED:
23632367
/* has bonus radio state int */
2364-
setRadioStateFromRILInt(p.readInt());
2368+
RadioState newState = getRadioStateFromInt(p.readInt());
2369+
if (RILJ_LOGD) unsljLogMore(response, newState.toString());
23652370

2366-
if (RILJ_LOGD) unsljLogMore(response, mState.toString());
2371+
switchToRadioState(newState);
23672372
break;
23682373
case RIL_UNSOL_RESPONSE_CALL_STATE_CHANGED:
23692374
if (RILJ_LOGD) unsljLog(response);

0 commit comments

Comments
 (0)