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

Commit 19d98f02 authored by Bill Rassieur's avatar Bill Rassieur
Browse files

Merge master@5428150 into git_qt-dev-plus-aosp.

Change-Id: I791df77503b543c762a71f6ae319f6409ddfbc60
BUG: 129345239
parents 7420e0e1 947bc288
Loading
Loading
Loading
Loading
+149 −0
Original line number Diff line number Diff line
@@ -279,6 +279,9 @@ message TelephonyServiceState {

  // Current data radio technology
  optional RadioAccessTechnology data_rat = 6 [default = UNKNOWN];

  // Current Channel Number
  optional int32 channel_number = 7;
}

// Radio access families
@@ -1775,6 +1778,9 @@ message TelephonyCallSession {

      // Change of audio codec
      AUDIO_CODEC = 22;

      // Notification that the call quality has changed
      CALL_QUALITY_CHANGED = 23;
    }

    enum RilRequest {
@@ -1942,6 +1948,10 @@ message TelephonyCallSession {

      // This field is true for Conference Calls
      optional bool is_multiparty = 5;

      // Detailed cause code for CS Call failures
      // frameworks/base/telephony/java/android/telephony/PreciseDisconnectCause.java
      optional int32 precise_disconnect_cause = 6;
    }

    // Single Radio Voice Call Continuity(SRVCC) progress state
@@ -1959,6 +1969,135 @@ message TelephonyCallSession {
      HANDOVER_CANCELED = 4;
    }

    message SignalStrength {

      // signal to noise ratio for LTE signal strength
      optional int32 lte_snr = 1;

      // in the future we may include more measures of signal strength, or
      // measurements for other RATs
    }

    // CallQuality information. (This proto class corresponds to
    // android.telephony.CallQuality)
    message CallQuality {

      enum CallQualityLevel {

        // leaving the first value explicitly as unspecified avoids breaking
        // clients if the desired default behavior changes
        UNDEFINED = 0;

        EXCELLENT = 1;

        GOOD = 2;

        FAIR = 3;

        POOR = 4;

        BAD = 5;

        // this typically indicates a failure in the modem
        NOT_AVAILABLE = 6;
      }

      // the downlink CallQualityLevel for a given ongoing call
      optional CallQualityLevel downlink_level = 1;

      // the uplink CallQualityLevel for a given ongoing call
      optional CallQualityLevel uplink_level = 2;

      // the duration of the call, in seconds
      optional int32 duration_in_seconds = 3;

      // the total number of RTP packets transmitted by this device for an
      // ongoing call
      optional int32 rtp_packets_transmitted = 4;

      // the total number of RTP packets received by this device for an ongoing
      // call
      optional int32 rtp_packets_received = 5;

      // the number of RTP packets which were sent by this device but were lost
      // in the network before reaching the other party
      optional int32 rtp_packets_transmitted_lost = 6;

      // the number of RTP packets which were sent by the other party but were
      // lost in the network before reaching this device
      optional int32 rtp_packets_not_received = 7;

      // the average relative jitter in milliseconds. Jitter represents the
      // amount of variance in interarrival time of packets, for example, if two
      // packets are sent 2 milliseconds apart but received 3 milliseconds
      // apart, the relative jitter between those packets is 1 millisecond.
      //
      // See RFC 3550 for more information on jitter calculations
      optional int32 average_relative_jitter_millis = 8;

      // the maximum relative jitter for a given ongoing call. Jitter represents
      // the amount of variance in interarrival time of packets, for example, if
      // two packets are sent 2 milliseconds apart but received 3 milliseconds
      // apart, the relative jitter between those packets is 1 millisecond.
      //
      // See RFC 3550 for more information on jitter calculations.
      optional int32 max_relative_jitter_millis = 9;

      // the average round trip time of RTP packets in an ongoing call, in milliseconds
      optional int32 average_round_trip_time = 10;

      // the codec type of an ongoing call
      optional AudioCodec codec_type = 11;
    }

    message CallQualitySummary {

      // Total duration of good call quality reported at the end of a call
      optional int32 total_good_quality_duration_in_seconds = 1;

      // Total duration of bad call quality reported at the end of a call
      optional int32 total_bad_quality_duration_in_seconds = 2;

      // Total duration of the call for which we have call quality
      // information, reported at the end of a call. For example, if an IMS call
      // is converted to a CS call, which doesn't report call quality information,
      // this value is the duration of the IMS component.
      optional int32 total_duration_with_quality_information_in_seconds = 3;

      // Snapshot of the CallQuality when signal strength is worst within good
      // quality section
      optional CallQuality snapshot_of_worst_ss_with_good_quality = 4;

      // Snapshot of the CallQuality when signal strength is best within good
      // quality section
      optional CallQuality snapshot_of_best_ss_with_good_quality = 5;

      // Snapshot of the CallQuality when signal strength is worst within bad
      // quality section
      optional CallQuality snapshot_of_worst_ss_with_bad_quality = 6;

      // Snapshot of the CallQuality when signal strength is best within bad
      // quality section
      optional CallQuality snapshot_of_best_ss_with_bad_quality = 7;

      // The worst SignalStrength in any good quality section
      optional SignalStrength worst_ss_with_good_quality = 8;

      // The best SignalStrength in any good quality section
      optional SignalStrength best_ss_with_good_quality = 9;

      // The worst SignalStrength in any bad quality section
      optional SignalStrength worst_ss_with_bad_quality = 10;

      // The best SignalStrength in any bad quality section
      optional SignalStrength best_ss_with_bad_quality = 11;

      // Snapshot of the CallQuality at the end of a call. This includes
      // cumulative statistics like total duration and total RTP packets.
      optional CallQuality snapshot_of_end = 12;

    }

    // Event type
    optional Type type = 1;

@@ -2024,6 +2163,16 @@ message TelephonyCallSession {

    // Audio codec at the beginning of the session or when changed
    optional AudioCodec audio_codec = 22;

    // Call quality when changed
    optional CallQuality call_quality = 23;

    // Downlink call quality summary at the end of a call
    optional CallQualitySummary call_quality_summary_dl = 24;

    // Uplink call quality summary at the end of a call
    optional CallQualitySummary call_quality_summary_ul = 25;

  }

  // Time when call has started, in minutes since epoch,
+121 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


package com.android.internal.telephony;

import android.app.ActivityThread;
import android.app.PendingIntent;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothMapClient;
import android.bluetooth.BluetoothProfile;
import android.net.Uri;
import android.telecom.PhoneAccount;
import android.telephony.SmsManager;
import android.telephony.SubscriptionInfo;
import android.util.Log;


/**
 * BtSmsInterfaceManager to provide a mechanism for sending SMS over Bluetooth
 */
public class BtSmsInterfaceManager {

    private static final String LOG_TAG = "BtSmsInterfaceManager";

    /**
     * Sends text through connected Bluetooth device
     */
    public void sendText(String destAddr, String text, PendingIntent sentIntent,
            PendingIntent deliveryIntent, SubscriptionInfo info) {
        BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
        if (btAdapter == null) {
            // No bluetooth service on this platform?
            sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_ERROR_NO_SERVICE);
            return;
        }
        BluetoothDevice device = btAdapter.getRemoteDevice(info.getIccId());
        if (device == null) {
            Log.d(LOG_TAG, "Bluetooth device addr invalid: " + info.getIccId());
            sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_ERROR_NO_SERVICE);
            return;
        }
        btAdapter.getProfileProxy(ActivityThread.currentApplication().getApplicationContext(),
                new MapMessageSender(destAddr, text, device, sentIntent, deliveryIntent),
                BluetoothProfile.MAP_CLIENT);
    }

    private void sendErrorInPendingIntent(PendingIntent intent, int errorCode) {
        if (intent == null) {
            return;
        }
        try {
            intent.send(errorCode);
        } catch (PendingIntent.CanceledException e) {
            // PendingIntent is cancelled. ignore sending this error code back to
            // caller.
            Log.d(LOG_TAG, "PendingIntent.CanceledException: " + e.getMessage());
        }
    }

    private class MapMessageSender implements BluetoothProfile.ServiceListener {

        final Uri[] mDestAddr;
        private String mMessage;
        final BluetoothDevice mDevice;
        final PendingIntent mSentIntent;
        final PendingIntent mDeliveryIntent;

        MapMessageSender(final String destAddr, final String message, final BluetoothDevice device,
                final PendingIntent sentIntent, final PendingIntent deliveryIntent) {
            super();
            mDestAddr = new Uri[]{new Uri.Builder()
                    .appendPath(destAddr)
                    .scheme(PhoneAccount.SCHEME_TEL)
                    .build()};
            mMessage = message;
            mDevice = device;
            mSentIntent = sentIntent;
            mDeliveryIntent = deliveryIntent;
        }

        @Override
        public void onServiceConnected(int profile, BluetoothProfile proxy) {
            Log.d(LOG_TAG, "Service connected");
            if (profile != BluetoothProfile.MAP_CLIENT) {
                return;
            }
            BluetoothMapClient mapProfile = (BluetoothMapClient) proxy;
            if (mMessage != null) {
                Log.d(LOG_TAG, "Sending message thru bluetooth");
                mapProfile.sendMessage(mDevice, mDestAddr, mMessage, mSentIntent, mDeliveryIntent);
                mMessage = null;
            }
            BluetoothAdapter.getDefaultAdapter()
                    .closeProfileProxy(BluetoothProfile.MAP_CLIENT, mapProfile);
        }

        @Override
        public void onServiceDisconnected(int profile) {
            if (mMessage != null) {
                Log.d(LOG_TAG, "Bluetooth disconnected before sending the message");
                sendErrorInPendingIntent(mSentIntent, SmsManager.RESULT_ERROR_NO_SERVICE);
                mMessage = null;
            }
        }
    }
}
+7 −4
Original line number Diff line number Diff line
@@ -439,12 +439,15 @@ public class CarrierResolver extends Handler {
            cv.put(CarrierId.CARRIER_NAME, mCarrierName);
            mContext.getContentResolver().update(
                    Telephony.CarrierId.getUriForSubscriptionId(mPhone.getSubId()), cv, null, null);
        }
        // during esim profile switch, there is no sim absent thus carrier id will persist and
        // might not trigger an update if switch profiles for the same carrier. thus always update
        // subscriptioninfo db to make sure we have correct carrier id set.
        if (SubscriptionManager.isValidSubscriptionId(mPhone.getSubId())) {
            // only persist carrier id to simInfo db when subId is valid.
            SubscriptionController.getInstance().setCarrierId(mCarrierId, mPhone.getSubId());
        }
    }
    }

    private static CarrierMatchingRule makeCarrierMatchingRule(Cursor cursor) {
        String certs = cursor.getString(
+6 −1
Original line number Diff line number Diff line
@@ -238,6 +238,7 @@ public class CarrierServicesSmsFilter {
        @Override
        protected void onServiceReady(ICarrierMessagingService carrierMessagingService) {
            try {
                log("onServiceReady: calling filterSms");
                carrierMessagingService.filterSms(
                        new MessagePdu(Arrays.asList(mPdus)), mSmsFormat, mDestPort,
                        mPhone.getSubId(), mSmsFilterCallback);
@@ -270,6 +271,7 @@ public class CarrierServicesSmsFilter {
         */
        @Override
        public void onFilterComplete(int result) {
            log("onFilterComplete called with result: " + result);
            // in the case that timeout has already passed and triggered, but the initial callback
            // is run afterwards, we should not follow through
            if (!mIsOnFilterCompleteCalled) {
@@ -328,8 +330,10 @@ public class CarrierServicesSmsFilter {
                    }
                    //all onFilterCompletes called before timeout has triggered
                    //remove the pending message
                    log("onFilterComplete called successfully with result = " + result);
                    log("onFilterComplete: called successfully with result = " + result);
                    mCallbackTimeoutHandler.removeMessages(EVENT_ON_FILTER_COMPLETE_NOT_CALLED);
                } else {
                    log("onFilterComplete: waiting for pending filters " + mNumPendingFilters);
                }
            }
        }
@@ -365,6 +369,7 @@ public class CarrierServicesSmsFilter {

        private void handleFilterCallbacksTimeout() {
            for (CarrierSmsFilterCallback callback : mFilterAggregator.mCallbacks) {
                log("handleFilterCallbacksTimeout: calling onFilterComplete");
                callback.onFilterComplete(CarrierMessagingService.RECEIVE_OPTIONS_DEFAULT);
            }
        }
+6 −1
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.internal.telephony;

import android.hardware.radio.V1_0.CellInfoType;
import android.hardware.radio.V1_0.RegState;
import android.hardware.radio.V1_4.DataRegStateResult.VopsInfo.hidl_discriminator;
import android.os.AsyncResult;
import android.os.Handler;
import android.os.HandlerThread;
@@ -317,7 +318,11 @@ public class CellularNetworkService extends NetworkService {
                CellIdentity cellIdentity =
                        convertHalCellIdentityToCellIdentity(dataRegState.base.cellIdentity);
                android.hardware.radio.V1_4.NrIndicators nrIndicators = dataRegState.nrIndicators;
                if (AccessNetworkType.EUTRAN == accessNetworkTechnology) {

                // Check for lteVopsInfo only if its initialized and RAT is EUTRAN
                if (dataRegState.vopsInfo.getDiscriminator() == hidl_discriminator.lteVopsInfo
                        && ServiceState.rilRadioTechnologyToAccessNetworkType(dataRegState.base.rat)
                            == AccessNetworkType.EUTRAN) {
                    android.hardware.radio.V1_4.LteVopsInfo vopsSupport =
                            dataRegState.vopsInfo.lteVopsInfo();
                    lteVopsSupportInfo = convertHalLteVopsSupportInfo(vopsSupport.isVopsSupported,
Loading