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

Commit 879e132f authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge changes from topic "null_data_call"

* changes:
  Don't send null data call list response
  Broadcast data call list changed for data stall
  Don't send null data call list response
  Fix NPE in AccessNetworksManager
parents 6855b749 e73f8be9
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -314,9 +314,10 @@ public class AccessNetworksManager extends Handler {
                                    .stream()
                                    .filter(x -> x.getSlotIndex() == mPhone.getPhoneId())
                                    .collect(Collectors.toList());

                    if (mIQualifiedNetworksService != null) {
                        mIQualifiedNetworksService.reportThrottleStatusChanged(mPhone.getPhoneId(),
                                throttleStatusesBySlot);
                    }
                } catch (Exception ex) {
                    loge("onThrottleStatusChanged", ex);
                }
@@ -453,8 +454,10 @@ public class AccessNetworksManager extends Handler {
                        public void onThrottleStatusChanged(List<ThrottleStatus> throttleStatuses) {
                            try {
                                logl("onThrottleStatusChanged: " + throttleStatuses);
                                if (mIQualifiedNetworksService != null) {
                                    mIQualifiedNetworksService.reportThrottleStatusChanged(
                                            mPhone.getPhoneId(), throttleStatuses);
                                }
                            } catch (Exception ex) {
                                loge("onThrottleStatusChanged: ", ex);
                            }
+3 −2
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
import com.android.telephony.Rlog;

import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -107,8 +108,8 @@ public class CellularDataService extends DataService {
                                    ar.exception != null
                                            ? DataServiceCallback.RESULT_ERROR_ILLEGAL_STATE
                                            : RESULT_SUCCESS,
                                    ar.exception != null
                                            ? null : (List<DataCallResponse>) ar.result
                                    ar.result != null ? (List<DataCallResponse>) ar.result
                                            : Collections.EMPTY_LIST
                                    );
                            break;
                        case DATA_CALL_LIST_CHANGED:
+34 −4
Original line number Diff line number Diff line
@@ -61,6 +61,7 @@ import com.android.internal.telephony.PhoneConfigurationManager;
import com.android.internal.telephony.util.TelephonyUtils;
import com.android.telephony.Rlog;

import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -68,6 +69,7 @@ import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.stream.Collectors;

/**
 * Data service manager manages handling data requests and responses on data services (e.g.
@@ -114,9 +116,10 @@ public class DataServiceManager extends Handler {

    private CellularDataServiceConnection mServiceConnection;

    private final UUID mAnomalyUUID = UUID.fromString("fc1956de-c080-45de-8431-a1faab687110");
    private String mLastBoundPackageName;

    private List<DataCallResponse> mLastDataCallResponseList = Collections.EMPTY_LIST;

    private final BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
@@ -140,7 +143,8 @@ public class DataServiceManager extends Handler {
            String message = "Data service " + mLastBoundPackageName +  " for transport type "
                    + AccessNetworkConstants.transportTypeToString(mTransportType) + " died.";
            loge(message);
            AnomalyReporter.reportAnomaly(mAnomalyUUID, message);
            AnomalyReporter.reportAnomaly(UUID.fromString("fc1956de-c080-45de-8431-a1faab687110"),
                    message);
        }
    }

@@ -293,13 +297,39 @@ public class DataServiceManager extends Handler {
        @Override
        public void onRequestDataCallListComplete(@DataServiceCallback.ResultCode int resultCode,
                List<DataCallResponse> dataCallList) {
            if (DBG) log("onRequestDataCallListComplete. resultCode = " + resultCode);
            if (DBG) {
                log("onRequestDataCallListComplete. resultCode = "
                        + DataServiceCallback.resultCodeToString(resultCode));
            }
            Message msg = mMessageMap.remove(asBinder());
            if (msg != null) {
                msg.getData().putParcelableList(DATA_CALL_RESPONSE, dataCallList);
            }
            sendCompleteMessage(msg, resultCode);

            // Handle data stall case on WWAN transport
            if (mTransportType == AccessNetworkConstants.TRANSPORT_TYPE_WWAN) {
                if (mLastDataCallResponseList.size() != dataCallList.size()
                        || !mLastDataCallResponseList.containsAll(dataCallList)) {
                    String message = "RIL reported mismatched data call response list for WWAN: "
                            + "mLastDataCallResponseList=" + mLastDataCallResponseList
                            + ", dataCallList=" + dataCallList;
                    loge(message);
                    if (!dataCallList.stream().map(DataCallResponse::getId)
                            .collect(Collectors.toSet()).equals(mLastDataCallResponseList.stream()
                                    .map(DataCallResponse::getId).collect(Collectors.toSet()))) {
                        AnomalyReporter.reportAnomaly(
                                UUID.fromString("150323b2-360a-446b-a158-3ce6425821f6"), message);
                    }
                }
                onDataCallListChanged(dataCallList);
            }
        }

        @Override
        public void onDataCallListChanged(List<DataCallResponse> dataCallList) {
            mLastDataCallResponseList =
                    dataCallList != null ? dataCallList : Collections.EMPTY_LIST;
            mDataCallListChangedRegistrants.notifyRegistrants(
                    new AsyncResult(null, dataCallList, null));
        }