Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27b15ba4 authored by Vipin Sapra's avatar Vipin Sapra Committed by Robert Greenwalt
Browse files

Set reason code when disconnecting

Possible fix for https://code.google.com/p/android/issues/detail?id=152085

There is a bug identified in Android NetworkInfo API
(http://developer.android.com/reference/android/net/NetworkInfo.html)
since Android Lollipop 5.0.0 release. On Android 4.4 and prior, the
NetworkInfo API was correctly reporting disconnection reason. In
Android 5.0+, this NetworkInfo API does not correctly report the
reason of disconnection.

The submitted framework modification appears to fix this issue
and report the reason.

Change-Id: I4b43cf99983b2b369503c9484302972e3d0b2330
parent 448a71b6
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1744,8 +1744,14 @@ public final class DataConnection extends StateMachine {
        @Override
        public void exit() {
            if (DBG) log("DcActiveState: exit dc=" + this);
            String reason = mNetworkInfo.getReason();
            if (mDisconnectParams != null && mDisconnectParams.mReason != null) {
                reason = mDisconnectParams.mReason;
            } else if (mDcFailCause != null) {
                reason = mDcFailCause.toString();
            }
            mNetworkInfo.setDetailedState(NetworkInfo.DetailedState.DISCONNECTED,
                    mNetworkInfo.getReason(), mNetworkInfo.getExtraInfo());
                    reason, mNetworkInfo.getExtraInfo());
            mNetworkAgent.sendNetworkInfo(mNetworkInfo);
            mNetworkAgent = null;
        }