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

Commit 0d7a5dc2 authored by Meng Wang's avatar Meng Wang Committed by Gerrit Code Review
Browse files

Merge "Remove PhoneStateLister#onOtaspChanged"

parents fc72e795 66972daf
Loading
Loading
Loading
Loading
+0 −39
Original line number Original line Diff line number Diff line
@@ -168,14 +168,6 @@ public class PhoneStateListener {
     */
     */
    public static final int LISTEN_SIGNAL_STRENGTHS                         = 0x00000100;
    public static final int LISTEN_SIGNAL_STRENGTHS                         = 0x00000100;


    /**
     * Listen for changes to OTASP mode.
     *
     * @see #onOtaspChanged
     * @hide
     */
    public static final int LISTEN_OTASP_CHANGED                            = 0x00000200;

    /**
    /**
     * Listen for changes to observed cell info.
     * Listen for changes to observed cell info.
     *
     *
@@ -624,29 +616,6 @@ public class PhoneStateListener {
        // default implementation empty
        // default implementation empty
    }
    }



    /**
     * The Over The Air Service Provisioning (OTASP) has changed on the registered subscription.
     * Note, the registration subId comes from {@link TelephonyManager} object which registers
     * PhoneStateListener by {@link TelephonyManager#listen(PhoneStateListener, int)}.
     * If this TelephonyManager object was created with
     * {@link TelephonyManager#createForSubscriptionId(int)}, then the callback applies to the
     * subId. Otherwise, this callback applies to
     * {@link SubscriptionManager#getDefaultSubscriptionId()}.
     *
     * Requires the READ_PHONE_STATE permission.
     * @param otaspMode is integer <code>OTASP_UNKNOWN=1<code>
     *   means the value is currently unknown and the system should wait until
     *   <code>OTASP_NEEDED=2<code> or <code>OTASP_NOT_NEEDED=3<code> is received before
     *   making the decision to perform OTASP or not.
     *
     * @hide
     */
    @UnsupportedAppUsage
    public void onOtaspChanged(int otaspMode) {
        // default implementation empty
    }

    /**
    /**
     * Callback invoked when a observed cell info has changed or new cells have been added
     * Callback invoked when a observed cell info has changed or new cells have been added
     * or removed on the registered subscription.
     * or removed on the registered subscription.
@@ -1065,14 +1034,6 @@ public class PhoneStateListener {
                    () -> mExecutor.execute(() -> psl.onSignalStrengthsChanged(signalStrength)));
                    () -> mExecutor.execute(() -> psl.onSignalStrengthsChanged(signalStrength)));
        }
        }


        public void onOtaspChanged(int otaspMode) {
            PhoneStateListener psl = mPhoneStateListenerWeakRef.get();
            if (psl == null) return;

            Binder.withCleanCallingIdentity(
                    () -> mExecutor.execute(() -> psl.onOtaspChanged(otaspMode)));
        }

        public void onCellInfoChanged(List<CellInfo> cellInfo) {
        public void onCellInfoChanged(List<CellInfo> cellInfo) {
            PhoneStateListener psl = mPhoneStateListenerWeakRef.get();
            PhoneStateListener psl = mPhoneStateListenerWeakRef.get();
            if (psl == null) return;
            if (psl == null) return;
+0 −16
Original line number Original line Diff line number Diff line
@@ -605,22 +605,6 @@ public class TelephonyRegistryManager {
        }
        }
    }
    }


    /**
     * Notify over the air sim provisioning(OTASP) mode changed on certain subscription.
     *
     * @param subId for which otasp mode changed.
     * @param otaspMode latest mode for OTASP e.g, OTASP needed.
     *
     * @hide
     */
    public void notifyOtaspChanged(int subId, int otaspMode) {
        try {
            sRegistry.notifyOtaspChanged(subId, otaspMode);
        } catch (RemoteException ex) {
            // system process is dead
        }
    }

    /**
    /**
     * Notify precise call state changed on certain subscription, including foreground, background
     * Notify precise call state changed on certain subscription, including foreground, background
     * and ringcall states.
     * and ringcall states.
+0 −1
Original line number Original line Diff line number Diff line
@@ -43,7 +43,6 @@ oneway interface IPhoneStateListener {
    void onDataConnectionStateChanged(int state, int networkType);
    void onDataConnectionStateChanged(int state, int networkType);
    void onDataActivity(int direction);
    void onDataActivity(int direction);
    void onSignalStrengthsChanged(in SignalStrength signalStrength);
    void onSignalStrengthsChanged(in SignalStrength signalStrength);
    void onOtaspChanged(in int otaspMode);
    void onCellInfoChanged(in List<CellInfo> cellInfo);
    void onCellInfoChanged(in List<CellInfo> cellInfo);
    void onPreciseCallStateChanged(in PreciseCallState callState);
    void onPreciseCallStateChanged(in PreciseCallState callState);
    void onPreciseDataConnectionStateChanged(in PreciseDataConnectionState dataConnectionState);
    void onPreciseDataConnectionStateChanged(in PreciseDataConnectionState dataConnectionState);
+0 −2
Original line number Original line Diff line number Diff line
@@ -67,8 +67,6 @@ interface ITelephonyRegistry {
    @UnsupportedAppUsage(maxTargetSdk = 28)
    @UnsupportedAppUsage(maxTargetSdk = 28)
    void notifyCellLocation(in Bundle cellLocation);
    void notifyCellLocation(in Bundle cellLocation);
    void notifyCellLocationForSubscriber(in int subId, in Bundle cellLocation);
    void notifyCellLocationForSubscriber(in int subId, in Bundle cellLocation);
    @UnsupportedAppUsage(maxTargetSdk = 28)
    void notifyOtaspChanged(in int subId, in int otaspMode);
    @UnsupportedAppUsage
    @UnsupportedAppUsage
    void notifyCellInfo(in List<CellInfo> cellInfo);
    void notifyCellInfo(in List<CellInfo> cellInfo);
    void notifyPreciseCallState(int phoneId, int subId, int ringingCallState,
    void notifyPreciseCallState(int phoneId, int subId, int ringingCallState,
+0 −37
Original line number Original line Diff line number Diff line
@@ -208,8 +208,6 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {


    private int[] mDataConnectionNetworkType;
    private int[] mDataConnectionNetworkType;


    private int[] mOtaspMode;

    private ArrayList<List<CellInfo>> mCellInfo = null;
    private ArrayList<List<CellInfo>> mCellInfo = null;


    private Map<Integer, List<EmergencyNumber>> mEmergencyNumberList;
    private Map<Integer, List<EmergencyNumber>> mEmergencyNumberList;
@@ -403,7 +401,6 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
        mCallForwarding = copyOf(mCallForwarding, mNumPhones);
        mCallForwarding = copyOf(mCallForwarding, mNumPhones);
        mCellLocation = copyOf(mCellLocation, mNumPhones);
        mCellLocation = copyOf(mCellLocation, mNumPhones);
        mSrvccState = copyOf(mSrvccState, mNumPhones);
        mSrvccState = copyOf(mSrvccState, mNumPhones);
        mOtaspMode = copyOf(mOtaspMode, mNumPhones);
        mPreciseCallState = copyOf(mPreciseCallState, mNumPhones);
        mPreciseCallState = copyOf(mPreciseCallState, mNumPhones);
        mForegroundCallState = copyOf(mForegroundCallState, mNumPhones);
        mForegroundCallState = copyOf(mForegroundCallState, mNumPhones);
        mBackgroundCallState = copyOf(mBackgroundCallState, mNumPhones);
        mBackgroundCallState = copyOf(mBackgroundCallState, mNumPhones);
@@ -441,7 +438,6 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
            mCellInfo.add(i, null);
            mCellInfo.add(i, null);
            mImsReasonInfo.add(i, null);
            mImsReasonInfo.add(i, null);
            mSrvccState[i] = TelephonyManager.SRVCC_STATE_HANDOVER_NONE;
            mSrvccState[i] = TelephonyManager.SRVCC_STATE_HANDOVER_NONE;
            mOtaspMode[i] = TelephonyManager.OTASP_UNKNOWN;
            mCallDisconnectCause[i] = DisconnectCause.NOT_VALID;
            mCallDisconnectCause[i] = DisconnectCause.NOT_VALID;
            mCallPreciseDisconnectCause[i] = PreciseDisconnectCause.NOT_VALID;
            mCallPreciseDisconnectCause[i] = PreciseDisconnectCause.NOT_VALID;
            mCallQuality[i] = createCallQuality();
            mCallQuality[i] = createCallQuality();
@@ -504,7 +500,6 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
        mCallForwarding = new boolean[numPhones];
        mCallForwarding = new boolean[numPhones];
        mCellLocation = new Bundle[numPhones];
        mCellLocation = new Bundle[numPhones];
        mSrvccState = new int[numPhones];
        mSrvccState = new int[numPhones];
        mOtaspMode = new int[numPhones];
        mPreciseCallState = new PreciseCallState[numPhones];
        mPreciseCallState = new PreciseCallState[numPhones];
        mForegroundCallState = new int[numPhones];
        mForegroundCallState = new int[numPhones];
        mBackgroundCallState = new int[numPhones];
        mBackgroundCallState = new int[numPhones];
@@ -536,7 +531,6 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
            mCellInfo.add(i, null);
            mCellInfo.add(i, null);
            mImsReasonInfo.add(i, null);
            mImsReasonInfo.add(i, null);
            mSrvccState[i] = TelephonyManager.SRVCC_STATE_HANDOVER_NONE;
            mSrvccState[i] = TelephonyManager.SRVCC_STATE_HANDOVER_NONE;
            mOtaspMode[i] = TelephonyManager.OTASP_UNKNOWN;
            mCallDisconnectCause[i] = DisconnectCause.NOT_VALID;
            mCallDisconnectCause[i] = DisconnectCause.NOT_VALID;
            mCallPreciseDisconnectCause[i] = PreciseDisconnectCause.NOT_VALID;
            mCallPreciseDisconnectCause[i] = PreciseDisconnectCause.NOT_VALID;
            mCallQuality[i] = createCallQuality();
            mCallQuality[i] = createCallQuality();
@@ -867,13 +861,6 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                            remove(r.binder);
                            remove(r.binder);
                        }
                        }
                    }
                    }
                    if ((events & PhoneStateListener.LISTEN_OTASP_CHANGED) != 0) {
                        try {
                            r.callback.onOtaspChanged(mOtaspMode[phoneId]);
                        } catch (RemoteException ex) {
                            remove(r.binder);
                        }
                    }
                    if (validateEventsAndUserLocked(r, PhoneStateListener.LISTEN_CELL_INFO)) {
                    if (validateEventsAndUserLocked(r, PhoneStateListener.LISTEN_CELL_INFO)) {
                        try {
                        try {
                            if (DBG_LOC) log("listen: mCellInfo[" + phoneId + "] = "
                            if (DBG_LOC) log("listen: mCellInfo[" + phoneId + "] = "
@@ -1637,29 +1624,6 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
        }
        }
    }
    }


    public void notifyOtaspChanged(int subId, int otaspMode) {
        if (!checkNotifyPermission("notifyOtaspChanged()" )) {
            return;
        }
        int phoneId = SubscriptionManager.getPhoneId(subId);
        synchronized (mRecords) {
            if (validatePhoneId(phoneId)) {
                mOtaspMode[phoneId] = otaspMode;
                for (Record r : mRecords) {
                    if (r.matchPhoneStateListenerEvent(PhoneStateListener.LISTEN_OTASP_CHANGED)
                            && idMatch(r.subId, subId, phoneId)) {
                        try {
                            r.callback.onOtaspChanged(otaspMode);
                        } catch (RemoteException ex) {
                            mRemoveList.add(r.binder);
                        }
                    }
                }
            }
            handleRemoveListLocked();
        }
    }

    public void notifyPreciseCallState(int phoneId, int subId, int ringingCallState,
    public void notifyPreciseCallState(int phoneId, int subId, int ringingCallState,
                                       int foregroundCallState, int backgroundCallState) {
                                       int foregroundCallState, int backgroundCallState) {
        if (!checkNotifyPermission("notifyPreciseCallState()")) {
        if (!checkNotifyPermission("notifyPreciseCallState()")) {
@@ -2084,7 +2048,6 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
                pw.println("mCellInfo=" + mCellInfo.get(i));
                pw.println("mCellInfo=" + mCellInfo.get(i));
                pw.println("mImsCallDisconnectCause=" + mImsReasonInfo.get(i));
                pw.println("mImsCallDisconnectCause=" + mImsReasonInfo.get(i));
                pw.println("mSrvccState=" + mSrvccState[i]);
                pw.println("mSrvccState=" + mSrvccState[i]);
                pw.println("mOtaspMode=" + mOtaspMode[i]);
                pw.println("mCallPreciseDisconnectCause=" + mCallPreciseDisconnectCause[i]);
                pw.println("mCallPreciseDisconnectCause=" + mCallPreciseDisconnectCause[i]);
                pw.println("mCallQuality=" + mCallQuality[i]);
                pw.println("mCallQuality=" + mCallQuality[i]);
                pw.println("mCallAttributes=" + mCallAttributes[i]);
                pw.println("mCallAttributes=" + mCallAttributes[i]);