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

Commit 2541c562 authored by Xin Li's avatar Xin Li
Browse files

Merge Android 12

Bug: 202323961
Merged-In: I702e1df9c772e506ecf4f386deff9657db4b5dc8
Change-Id: Ib56e3964affb5cdba309082a92827d17eee2258c
parents c28a51d5 a547fa90
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ rule android.os.RegistrantList* com.android.internal.telephony.RegistrantList@1
rule android.os.Registrant* com.android.internal.telephony.Registrant@1
rule android.hidl.** android.internal.hidl.@1
rule android.sysprop.** android.internal.telephony.sysprop.@1
rule android.util.IndentingPrintWriter* com.android.internal.telephony.AndroidUtilIndentingPrintWriter@1
rule android.util.LocalLog* com.android.internal.telephony.LocalLog@1
rule android.util.TimeUtils* com.android.internal.telephony.TimeUtils@1
rule com.android.internal.os.SomeArgs* com.android.internal.telephony.SomeArgs@1
+48 −0
Original line number Diff line number Diff line
@@ -53,6 +53,9 @@ message TelephonyLog {

  // The last active subscription info for each slot.
  repeated ActiveSubscriptionInfo last_active_subscription_info = 10;

  // Bandwidth estimator stats
  optional BandwidthEstimatorStats bandwidth_estimator_stats = 11;
}

// The time information
@@ -418,6 +421,20 @@ enum RadioAccessTechnology {
  RAT_NR = 20;
}

// NR (5G) operation mode
enum NrMode {
  // The device is not in a NR network.
  NR_NONE = 1;
  // The device is in a NR non-standalone network at non-MMWAVE frequencies.
  NR_NSA = 2;
  // The device is in a NR non-standalone network at MMWAVE frequencies.
  NR_NSA_MMWAVE = 3;
  // The device is in a NR standalone network at non-MMWAVE frequencies.
  NR_SA = 4;
  // The device is in a NR standalone network at MMWAVE frequencies.
  NR_SA_MMWAVE = 5;
}

// The information about IMS errors
// https://cs.corp.google.com/#android/frameworks/base/telephony/java/com/android/ims/ImsReasonInfo.java
message ImsReasonInfo {
@@ -2700,3 +2717,34 @@ message ModemPowerStats {
  // Actual monitored rail energy consumed by modem (mAh)
  optional double monitored_rail_energy_consumed_mah = 15;
}

// Bandwidth estimator stats
message BandwidthEstimatorStats {
  // Bandwidth stats of each level
  message PerLevel {
    optional uint32 signal_level = 1;
    // Accumulated bandwidth sample count
    optional uint32 count = 2;
    // Average end-to-end bandwidth in kbps
    optional uint32 avg_bw_kbps = 3;
    // Normalized error of static BW values in percent
    optional uint32 static_bw_error_percent = 4;
    // Normalized error of end-to-end BW estimation in percent
    optional uint32 bw_est_error_percent = 5;
  }

  // Bandwidth stats of each RAT
  message PerRat {
    // radio access technology
    optional RadioAccessTechnology rat = 1;
    // NR (5g) operation mode
    optional NrMode nr_mode = 2;
    // bandwidth stats of signal levels
    repeated PerLevel per_level = 3;
  }

  // Tx Stats of visited RATs
  repeated PerRat per_rat_tx = 1;
  // Rx Stats of visited RATs
  repeated PerRat per_rat_rx = 2;
}
+6 −10
Original line number Diff line number Diff line
@@ -18,7 +18,9 @@
package com.android.internal.telephony;

import android.app.PendingIntent;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothMapClient;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
import android.net.Uri;
@@ -40,10 +42,6 @@ public class BtSmsInterfaceManager {
     */
    public void sendText(Context context, String destAddr, String text, PendingIntent sentIntent,
            PendingIntent deliveryIntent, SubscriptionInfo info) {
        /*
        This is to remove the usage of hidden constant MAP_CLIENT and hidden API
        BluetoothMapClient.sendMessage(). This code is currently not functional anyway; it will be
        re-enabled in a later release.
        BluetoothAdapter btAdapter = BluetoothAdapter.getDefaultAdapter();
        if (btAdapter == null) {
            // No bluetooth service on this platform?
@@ -56,10 +54,11 @@ public class BtSmsInterfaceManager {
            sendErrorInPendingIntent(sentIntent, SmsManager.RESULT_INVALID_BLUETOOTH_ADDRESS);
            return;
        }
        btAdapter.getProfileProxy(context.getApplicationContext(),
        if (btAdapter.getProfileProxy(context.getApplicationContext(),
                new MapMessageSender(destAddr, text, device, sentIntent, deliveryIntent),
                BluetoothProfile.MAP_CLIENT);
        */
                BluetoothProfile.MAP_CLIENT)) {
            return;
        }
        throw new RuntimeException("Can't send message through BluetoothMapClient");
    }

@@ -100,7 +99,6 @@ public class BtSmsInterfaceManager {
        @Override
        public void onServiceConnected(int profile, BluetoothProfile proxy) {
            Log.d(LOG_TAG, "Service connected");
            /*
            if (profile != BluetoothProfile.MAP_CLIENT) {
                return;
            }
@@ -112,8 +110,6 @@ public class BtSmsInterfaceManager {
            }
            BluetoothAdapter.getDefaultAdapter()
                    .closeProfileProxy(BluetoothProfile.MAP_CLIENT, mapProfile);
            */
            throw new RuntimeException("Can't send message through BluetoothMapClient");
        }

        @Override
+11 −5
Original line number Diff line number Diff line
@@ -254,7 +254,13 @@ public class CarrierInfoManager {
            return;
        }
        mLastAccessResetCarrierKey = now;
        deleteCarrierInfoForImsiEncryption(context);
        int[] subIds = context.getSystemService(SubscriptionManager.class)
                .getSubscriptionIds(mPhoneId);
        if (subIds == null || subIds.length < 1) {
            Log.e(LOG_TAG, "Could not reset carrier keys, subscription for mPhoneId=" + mPhoneId);
            return;
        }
        deleteCarrierInfoForImsiEncryption(context, subIds[0]);
        Intent resetIntent = new Intent(TelephonyIntents.ACTION_CARRIER_CERTIFICATE_DOWNLOAD);
        SubscriptionManager.putPhoneIdAndSubIdExtra(resetIntent, mPhoneId);
        context.sendBroadcastAsUser(resetIntent, UserHandle.ALL);
@@ -264,12 +270,12 @@ public class CarrierInfoManager {
     * Deletes all the keys for a given Carrier from the device keystore.
     * @param context Context
     */
    public static void deleteCarrierInfoForImsiEncryption(Context context) {
        Log.i(LOG_TAG, "deleting carrier key from db");
    public static void deleteCarrierInfoForImsiEncryption(Context context, int subId) {
        Log.i(LOG_TAG, "deleting carrier key from db for subId=" + subId);
        String mcc = "";
        String mnc = "";
        final TelephonyManager telephonyManager =
                (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        final TelephonyManager telephonyManager = context.getSystemService(TelephonyManager.class)
                .createForSubscriptionId(subId);
        String simOperator = telephonyManager.getSimOperator();
        if (!TextUtils.isEmpty(simOperator)) {
            mcc = simOperator.substring(0, 3);
+17 −13
Original line number Diff line number Diff line
@@ -81,8 +81,6 @@ public class CarrierKeyDownloadManager extends Handler {
    // This will define the end date of the window.
    private static final int END_RENEWAL_WINDOW_DAYS = 7;



    /* Intent for downloading the public key */
    private static final String INTENT_KEY_RENEWAL_ALARM_PREFIX =
            "com.android.internal.telephony.carrier_key_download_alarm";
@@ -121,7 +119,7 @@ public class CarrierKeyDownloadManager extends Handler {
        mContext = phone.getContext();
        IntentFilter filter = new IntentFilter();
        filter.addAction(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
        filter.addAction(INTENT_KEY_RENEWAL_ALARM_PREFIX + mPhone.getPhoneId());
        filter.addAction(INTENT_KEY_RENEWAL_ALARM_PREFIX);
        filter.addAction(TelephonyIntents.ACTION_CARRIER_CERTIFICATE_DOWNLOAD);
        mContext.registerReceiver(mBroadcastReceiver, filter, null, phone);
        mDownloadManager = (DownloadManager) mContext.getSystemService(Context.DOWNLOAD_SERVICE);
@@ -143,18 +141,22 @@ public class CarrierKeyDownloadManager extends Handler {
        @Override
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();
            int slotId = mPhone.getPhoneId();
            if (action.equals(INTENT_KEY_RENEWAL_ALARM_PREFIX + slotId)) {
            int slotIndex = SubscriptionManager.getSlotIndex(mPhone.getSubId());
            int phoneId = mPhone.getPhoneId();
            if (action.equals(INTENT_KEY_RENEWAL_ALARM_PREFIX)) {
                int slotIndexExtra = intent.getIntExtra(SubscriptionManager.EXTRA_SLOT_INDEX, -1);
                if (slotIndexExtra == slotIndex) {
                    Log.d(LOG_TAG, "Handling key renewal alarm: " + action);
                    sendEmptyMessage(EVENT_ALARM_OR_CONFIG_CHANGE);
                }
            } else if (action.equals(TelephonyIntents.ACTION_CARRIER_CERTIFICATE_DOWNLOAD)) {
                if (slotId == intent.getIntExtra(PhoneConstants.PHONE_KEY,
                if (phoneId == intent.getIntExtra(PhoneConstants.PHONE_KEY,
                        SubscriptionManager.INVALID_SIM_SLOT_INDEX)) {
                    Log.d(LOG_TAG, "Handling reset intent: " + action);
                    sendEmptyMessage(EVENT_ALARM_OR_CONFIG_CHANGE);
                }
            } else if (action.equals(CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED)) {
                if (slotId == intent.getIntExtra(PhoneConstants.PHONE_KEY,
                if (phoneId == intent.getIntExtra(PhoneConstants.PHONE_KEY,
                        SubscriptionManager.INVALID_SIM_SLOT_INDEX)) {
                    Log.d(LOG_TAG, "Carrier Config changed: " + action);
                    sendEmptyMessage(EVENT_ALARM_OR_CONFIG_CHANGE);
@@ -217,8 +219,9 @@ public class CarrierKeyDownloadManager extends Handler {

    private void cleanupRenewalAlarms() {
        Log.d(LOG_TAG, "Cleaning up existing renewal alarms");
        int slotId = mPhone.getPhoneId();
        Intent intent = new Intent(INTENT_KEY_RENEWAL_ALARM_PREFIX + slotId);
        int slotIndex = SubscriptionManager.getSlotIndex(mPhone.getSubId());
        Intent intent = new Intent(INTENT_KEY_RENEWAL_ALARM_PREFIX);
        intent.putExtra(SubscriptionManager.EXTRA_SLOT_INDEX, slotIndex);
        PendingIntent carrierKeyDownloadIntent = PendingIntent.getBroadcast(mContext, 0, intent,
                PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
        AlarmManager alarmManager =
@@ -273,12 +276,13 @@ public class CarrierKeyDownloadManager extends Handler {
    @VisibleForTesting
    public void resetRenewalAlarm() {
        cleanupRenewalAlarms();
        int slotId = mPhone.getPhoneId();
        int slotIndex = SubscriptionManager.getSlotIndex(mPhone.getSubId());
        long minExpirationDate = getExpirationDate();
        Log.d(LOG_TAG, "minExpirationDate: " + new Date(minExpirationDate));
        final AlarmManager alarmManager = (AlarmManager) mContext.getSystemService(
                Context.ALARM_SERVICE);
        Intent intent = new Intent(INTENT_KEY_RENEWAL_ALARM_PREFIX + slotId);
        Intent intent = new Intent(INTENT_KEY_RENEWAL_ALARM_PREFIX);
        intent.putExtra(SubscriptionManager.EXTRA_SLOT_INDEX, slotIndex);
        PendingIntent carrierKeyDownloadIntent = PendingIntent.getBroadcast(mContext, 0, intent,
                PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
        alarmManager.set(AlarmManager.RTC_WAKEUP, minExpirationDate, carrierKeyDownloadIntent);
Loading