File tree Expand file tree Collapse file tree 4 files changed +13
-14
lines changed
telephony/java/com/android/internal/telephony Expand file tree Collapse file tree 4 files changed +13
-14
lines changed Original file line number Diff line number Diff line change @@ -1019,7 +1019,7 @@ public void cleanUpAllConnections(String cause) {
10191019 sendMessage (msg );
10201020 }
10211021
1022- public abstract boolean isAnyActiveDataConnections ();
1022+ public abstract boolean isDisconnected ();
10231023
10241024 protected void onSetUserDataEnabled (boolean enabled ) {
10251025 synchronized (mDataEnabledLock ) {
Original file line number Diff line number Diff line change @@ -403,7 +403,14 @@ public void unregisterForPsRestrictedDisabled(Handler h) {
403403 public void powerOffRadioSafely (DataConnectionTracker dcTracker ) {
404404 synchronized (this ) {
405405 if (!mPendingRadioPowerOffAfterDataOff ) {
406- if (dcTracker .isAnyActiveDataConnections ()) {
406+ // To minimize race conditions we call cleanUpAllConnections on
407+ // both if else paths instead of before this isDisconnected test.
408+ if (dcTracker .isDisconnected ()) {
409+ // To minimize race conditions we do this after isDisconnected
410+ dcTracker .cleanUpAllConnections (Phone .REASON_RADIO_TURNED_OFF );
411+ if (DBG ) log ("Data disconnected, turn off radio right away." );
412+ hangupAndPowerOff ();
413+ } else {
407414 dcTracker .cleanUpAllConnections (Phone .REASON_RADIO_TURNED_OFF );
408415 Message msg = Message .obtain (this );
409416 msg .what = EVENT_SET_RADIO_POWER_OFF ;
@@ -415,10 +422,6 @@ public void powerOffRadioSafely(DataConnectionTracker dcTracker) {
415422 log ("Cannot send delayed Msg, turn off radio right away." );
416423 hangupAndPowerOff ();
417424 }
418- } else {
419- dcTracker .cleanUpAllConnections (Phone .REASON_RADIO_TURNED_OFF );
420- if (DBG ) log ("Data disconnected, turn off radio right away." );
421- hangupAndPowerOff ();
422425 }
423426 }
424427 }
Original file line number Diff line number Diff line change @@ -946,8 +946,8 @@ public void handleMessage (Message msg) {
946946 }
947947
948948 @ Override
949- public boolean isAnyActiveDataConnections () {
950- return (mState != State .IDLE );
949+ public boolean isDisconnected () {
950+ return (( mState == State .IDLE ) || ( mState == State . FAILED ) );
951951 }
952952
953953 @ Override
Original file line number Diff line number Diff line change @@ -1961,7 +1961,8 @@ protected boolean isConnected() {
19611961 return false ;
19621962 }
19631963
1964- protected boolean isDisconnected () {
1964+ @ Override
1965+ public boolean isDisconnected () {
19651966 for (ApnContext apnContext : mApnContexts .values ()) {
19661967 if (!apnContext .isDisconnected ()) {
19671968 // At least one context was not disconnected return false
@@ -2347,11 +2348,6 @@ private int getCellLocationId() {
23472348 return cid ;
23482349 }
23492350
2350- @ Override
2351- public boolean isAnyActiveDataConnections () {
2352- return isConnected ();
2353- }
2354-
23552351 @ Override
23562352 protected void log (String s ) {
23572353 Log .d (LOG_TAG , "[GsmDCT] " + s );
You can’t perform that action at this time.
0 commit comments