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

Commit ccb81212 authored by Nathan Harold's avatar Nathan Harold Committed by android-build-merger
Browse files

Merge "Make SignalStrength constructor system APIs"

am: e9f4fe3c

Change-Id: Iadb03832b61c78da84ab34fee29e8a7be6105a3d
parents c39334a8 e9f4fe3c
Loading
Loading
Loading
Loading
+4 −0
Original line number Original line Diff line number Diff line
@@ -9003,6 +9003,10 @@ package android.telephony {
    field public static final int ROAMING_TYPE_UNKNOWN = 1; // 0x1
    field public static final int ROAMING_TYPE_UNKNOWN = 1; // 0x1
  }
  }
  public class SignalStrength implements android.os.Parcelable {
    ctor public SignalStrength(@NonNull android.telephony.SignalStrength);
  }
  public final class SmsCbCmasInfo implements android.os.Parcelable {
  public final class SmsCbCmasInfo implements android.os.Parcelable {
    ctor public SmsCbCmasInfo(int, int, int, int, int, int);
    ctor public SmsCbCmasInfo(int, int, int, int, int, int);
    method public int describeContents();
    method public int describeContents();
+59 −20
Original line number Original line Diff line number Diff line
@@ -50,6 +50,13 @@ import android.telephony.CallQuality;
import android.telephony.CellIdentity;
import android.telephony.CellIdentity;
import android.telephony.CellInfo;
import android.telephony.CellInfo;
import android.telephony.CellLocation;
import android.telephony.CellLocation;
import android.telephony.CellSignalStrength;
import android.telephony.CellSignalStrengthCdma;
import android.telephony.CellSignalStrengthGsm;
import android.telephony.CellSignalStrengthLte;
import android.telephony.CellSignalStrengthNr;
import android.telephony.CellSignalStrengthTdscdma;
import android.telephony.CellSignalStrengthWcdma;
import android.telephony.DataFailCause;
import android.telephony.DataFailCause;
import android.telephony.DisconnectCause;
import android.telephony.DisconnectCause;
import android.telephony.LocationAccessPolicy;
import android.telephony.LocationAccessPolicy;
@@ -404,7 +411,11 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
        mVoiceActivationState = copyOf(mVoiceActivationState, mNumPhones);
        mVoiceActivationState = copyOf(mVoiceActivationState, mNumPhones);
        mDataActivationState = copyOf(mDataActivationState, mNumPhones);
        mDataActivationState = copyOf(mDataActivationState, mNumPhones);
        mUserMobileDataState = copyOf(mUserMobileDataState, mNumPhones);
        mUserMobileDataState = copyOf(mUserMobileDataState, mNumPhones);
        if (mSignalStrength != null) {
            mSignalStrength = copyOf(mSignalStrength, mNumPhones);
            mSignalStrength = copyOf(mSignalStrength, mNumPhones);
        } else {
            mSignalStrength = new SignalStrength[mNumPhones];
        }
        mMessageWaiting = copyOf(mMessageWaiting, mNumPhones);
        mMessageWaiting = copyOf(mMessageWaiting, mNumPhones);
        mCallForwarding = copyOf(mCallForwarding, mNumPhones);
        mCallForwarding = copyOf(mCallForwarding, mNumPhones);
        mCellIdentity = copyOf(mCellIdentity, mNumPhones);
        mCellIdentity = copyOf(mCellIdentity, mNumPhones);
@@ -438,7 +449,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
            mDataActivationState[i] = TelephonyManager.SIM_ACTIVATION_STATE_UNKNOWN;
            mDataActivationState[i] = TelephonyManager.SIM_ACTIVATION_STATE_UNKNOWN;
            mCallIncomingNumber[i] =  "";
            mCallIncomingNumber[i] =  "";
            mServiceState[i] =  new ServiceState();
            mServiceState[i] =  new ServiceState();
            mSignalStrength[i] =  new SignalStrength();
            mSignalStrength[i] =  null;
            mUserMobileDataState[i] = false;
            mUserMobileDataState[i] = false;
            mMessageWaiting[i] =  false;
            mMessageWaiting[i] =  false;
            mCallForwarding[i] =  false;
            mCallForwarding[i] =  false;
@@ -522,7 +533,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
            mDataActivationState[i] = TelephonyManager.SIM_ACTIVATION_STATE_UNKNOWN;
            mDataActivationState[i] = TelephonyManager.SIM_ACTIVATION_STATE_UNKNOWN;
            mCallIncomingNumber[i] =  "";
            mCallIncomingNumber[i] =  "";
            mServiceState[i] =  new ServiceState();
            mServiceState[i] =  new ServiceState();
            mSignalStrength[i] =  new SignalStrength();
            mSignalStrength[i] =  null;
            mUserMobileDataState[i] = false;
            mUserMobileDataState[i] = false;
            mMessageWaiting[i] =  false;
            mMessageWaiting[i] =  false;
            mCallForwarding[i] =  false;
            mCallForwarding[i] =  false;
@@ -799,10 +810,12 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                    }
                    }
                    if ((events & PhoneStateListener.LISTEN_SIGNAL_STRENGTH) != 0) {
                    if ((events & PhoneStateListener.LISTEN_SIGNAL_STRENGTH) != 0) {
                        try {
                        try {
                            if (mSignalStrength[phoneId] != null) {
                                int gsmSignalStrength = mSignalStrength[phoneId]
                                int gsmSignalStrength = mSignalStrength[phoneId]
                                        .getGsmSignalStrength();
                                        .getGsmSignalStrength();
                                r.callback.onSignalStrengthChanged((gsmSignalStrength == 99 ? -1
                                r.callback.onSignalStrengthChanged((gsmSignalStrength == 99 ? -1
                                        : gsmSignalStrength));
                                        : gsmSignalStrength));
                            }
                        } catch (RemoteException ex) {
                        } catch (RemoteException ex) {
                            remove(r.binder);
                            remove(r.binder);
                        }
                        }
@@ -859,7 +872,9 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                    }
                    }
                    if ((events & PhoneStateListener.LISTEN_SIGNAL_STRENGTHS) != 0) {
                    if ((events & PhoneStateListener.LISTEN_SIGNAL_STRENGTHS) != 0) {
                        try {
                        try {
                            if (mSignalStrength[phoneId] != null) {
                                r.callback.onSignalStrengthsChanged(mSignalStrength[phoneId]);
                                r.callback.onSignalStrengthsChanged(mSignalStrength[phoneId]);
                            }
                        } catch (RemoteException ex) {
                        } catch (RemoteException ex) {
                            remove(r.binder);
                            remove(r.binder);
                        }
                        }
@@ -2204,13 +2219,32 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {


        Intent intent = new Intent(TelephonyIntents.ACTION_SIGNAL_STRENGTH_CHANGED);
        Intent intent = new Intent(TelephonyIntents.ACTION_SIGNAL_STRENGTH_CHANGED);
        Bundle data = new Bundle();
        Bundle data = new Bundle();
        signalStrength.fillInNotifierBundle(data);
        fillInSignalStrengthNotifierBundle(signalStrength, data);
        intent.putExtras(data);
        intent.putExtras(data);
        intent.putExtra(PHONE_CONSTANTS_SUBSCRIPTION_KEY, subId);
        intent.putExtra(PHONE_CONSTANTS_SUBSCRIPTION_KEY, subId);
        intent.putExtra(PHONE_CONSTANTS_SLOT_KEY, phoneId);
        intent.putExtra(PHONE_CONSTANTS_SLOT_KEY, phoneId);
        mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL);
        mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL);
    }
    }


    private void fillInSignalStrengthNotifierBundle(SignalStrength signalStrength, Bundle bundle) {
        List<CellSignalStrength> cellSignalStrengths = signalStrength.getCellSignalStrengths();
        for (CellSignalStrength cellSignalStrength : cellSignalStrengths) {
            if (cellSignalStrength instanceof CellSignalStrengthLte) {
                bundle.putParcelable("Lte", (CellSignalStrengthLte) cellSignalStrength);
            } else if (cellSignalStrength instanceof CellSignalStrengthCdma) {
                bundle.putParcelable("Cdma", (CellSignalStrengthCdma) cellSignalStrength);
            } else if (cellSignalStrength instanceof CellSignalStrengthGsm) {
                bundle.putParcelable("Gsm", (CellSignalStrengthGsm) cellSignalStrength);
            } else if (cellSignalStrength instanceof CellSignalStrengthWcdma) {
                bundle.putParcelable("Wcdma", (CellSignalStrengthWcdma) cellSignalStrength);
            } else if (cellSignalStrength instanceof CellSignalStrengthTdscdma) {
                bundle.putParcelable("Tdscdma", (CellSignalStrengthTdscdma) cellSignalStrength);
            } else if (cellSignalStrength instanceof CellSignalStrengthNr) {
                bundle.putParcelable("Nr", (CellSignalStrengthNr) cellSignalStrength);
            }
        }
    }

    /**
    /**
     * Broadcasts an intent notifying apps of a phone state change. {@code subId} can be
     * Broadcasts an intent notifying apps of a phone state change. {@code subId} can be
     * a valid subId, in which case this function fires a subId-specific intent, or it
     * a valid subId, in which case this function fires a subId-specific intent, or it
@@ -2519,11 +2553,14 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {


        if ((events & PhoneStateListener.LISTEN_SIGNAL_STRENGTHS) != 0) {
        if ((events & PhoneStateListener.LISTEN_SIGNAL_STRENGTHS) != 0) {
            try {
            try {
                if (mSignalStrength[phoneId] != null) {
                    SignalStrength signalStrength = mSignalStrength[phoneId];
                    SignalStrength signalStrength = mSignalStrength[phoneId];
                    if (DBG) {
                    if (DBG) {
                    log("checkPossibleMissNotify: onSignalStrengthsChanged SS=" + signalStrength);
                        log("checkPossibleMissNotify: onSignalStrengthsChanged SS="
                                + signalStrength);
                    }
                    }
                    r.callback.onSignalStrengthsChanged(new SignalStrength(signalStrength));
                    r.callback.onSignalStrengthsChanged(new SignalStrength(signalStrength));
                }
            } catch (RemoteException ex) {
            } catch (RemoteException ex) {
                mRemoveList.add(r.binder);
                mRemoveList.add(r.binder);
            }
            }
@@ -2531,14 +2568,16 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {


        if ((events & PhoneStateListener.LISTEN_SIGNAL_STRENGTH) != 0) {
        if ((events & PhoneStateListener.LISTEN_SIGNAL_STRENGTH) != 0) {
            try {
            try {
                if (mSignalStrength[phoneId] != null) {
                    int gsmSignalStrength = mSignalStrength[phoneId]
                    int gsmSignalStrength = mSignalStrength[phoneId]
                            .getGsmSignalStrength();
                            .getGsmSignalStrength();
                    if (DBG) {
                    if (DBG) {
                    log("checkPossibleMissNotify: onSignalStrengthChanged SS=" +
                        log("checkPossibleMissNotify: onSignalStrengthChanged SS="
                            gsmSignalStrength);
                                + gsmSignalStrength);
                    }
                    }
                    r.callback.onSignalStrengthChanged((gsmSignalStrength == 99 ? -1
                    r.callback.onSignalStrengthChanged((gsmSignalStrength == 99 ? -1
                            : gsmSignalStrength));
                            : gsmSignalStrength));
                }
            } catch (RemoteException ex) {
            } catch (RemoteException ex) {
                mRemoveList.add(r.binder);
                mRemoveList.add(r.binder);
            }
            }
+3 −2
Original line number Original line Diff line number Diff line
@@ -19,6 +19,7 @@ package android.telephony;
import com.android.telephony.Rlog;
import com.android.telephony.Rlog;


import android.annotation.NonNull;
import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.compat.annotation.UnsupportedAppUsage;
import android.compat.annotation.UnsupportedAppUsage;
import android.os.Build;
import android.os.Build;
import android.os.Bundle;
import android.os.Bundle;
@@ -277,8 +278,8 @@ public class SignalStrength implements Parcelable {
     *
     *
     * @hide
     * @hide
     */
     */
    @UnsupportedAppUsage
    @SystemApi
    public SignalStrength(SignalStrength s) {
    public SignalStrength(@NonNull SignalStrength s) {
        copyFrom(s);
        copyFrom(s);
    }
    }