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

Commit c820dd83 authored by Chen Xu's avatar Chen Xu
Browse files

add registrant for PhysicalChannelConfig change

1. remove onPhysicalChannelConfig from PhoneStateLisgtener as
only debug settings use this API today
2. instead create register/notify API in phone object to notify
physicalChannelConfig change

Bug: 140908357
Test: Manual test
Change-Id: Id1d9a03d48239b9c8493dd389013f2c5edec8436
(cherry picked from commit efb18f2b)
Merged-in: Id1d9a03d48239b9c8493dd389013f2c5edec8436
parent 65056969
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import android.telephony.CallQuality;
import android.telephony.CellInfo;
import android.telephony.CellLocation;
import android.telephony.PhoneCapability;
import android.telephony.PhysicalChannelConfig;
import android.telephony.PreciseCallState;
import android.telephony.Rlog;
import android.telephony.ServiceState;
@@ -195,20 +194,6 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
        mTelephonyRegistryMgr.notifyCellInfoChanged(subId, cellInfo);
    }

    @Override
    public void notifyPhysicalChannelConfiguration(Phone sender,
        List<PhysicalChannelConfig> configs) {
        int subId = sender.getSubId();
        int phoneId = sender.getPhoneId();
        try {
            if (mRegistry != null) {
                mRegistry.notifyPhysicalChannelConfigurationForSubscriber(phoneId, subId, configs);
            }
        } catch (RemoteException ex) {
            // system process is dead
        }
    }

    @Override
    public void notifyOtaspChanged(Phone sender, int otaspMode) {
        int subId = sender.getSubId();
+6 −0
Original line number Diff line number Diff line
@@ -64,6 +64,7 @@ import android.telephony.CellLocation;
import android.telephony.ImsiEncryptionInfo;
import android.telephony.NetworkScanRequest;
import android.telephony.PhoneNumberUtils;
import android.telephony.PhysicalChannelConfig;
import android.telephony.Rlog;
import android.telephony.ServiceState;
import android.telephony.SignalThresholdInfo;
@@ -4080,4 +4081,9 @@ public class GsmCdmaPhone extends Phone {
    public boolean canDisablePhysicalSubscription() {
        return mCi.canToggleUiccApplicationsEnablement();
    }

    @Override
    public List<PhysicalChannelConfig> getPhysicalChannelConfigList() {
        return mSST.getPhysicalChannelConfigList();
    }
}
+28 −1
Original line number Diff line number Diff line
@@ -354,6 +354,8 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {

    private final RegistrantList mRedialRegistrants = new RegistrantList();

    private final RegistrantList mPhysicalChannelConfigRegistrants = new RegistrantList();

    protected Registrant mPostDialHandler;

    protected final LocalLog mLocalLog;
@@ -2388,9 +2390,34 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        mNotifier.notifyCellInfo(this, cellInfo);
    }

    /**
     * Registration point for PhysicalChannelConfig change.
     * @param h handler to notify
     * @param what what code of message when delivered
     * @param obj placed in Message.obj.userObj
     */
    public void registerForPhysicalChannelConfig(Handler h, int what, Object obj) {
        checkCorrectThread(h);
        Registrant registrant = new Registrant(h, what, obj);
        mPhysicalChannelConfigRegistrants.add(registrant);
        // notify first
        List<PhysicalChannelConfig> physicalChannelConfigs = getPhysicalChannelConfigList();
        if (physicalChannelConfigs != null) {
            registrant.notifyRegistrant(new AsyncResult(null, physicalChannelConfigs, null));
        }
    }

    public void unregisterForPhysicalChannelConfig(Handler h) {
        mPhysicalChannelConfigRegistrants.remove(h);
    }

    /** Notify {@link PhysicalChannelConfig} changes. */
    public void notifyPhysicalChannelConfiguration(List<PhysicalChannelConfig> configs) {
        mNotifier.notifyPhysicalChannelConfiguration(this, configs);
        mPhysicalChannelConfigRegistrants.notifyRegistrants(new AsyncResult(null, configs, null));
    }

    public List<PhysicalChannelConfig> getPhysicalChannelConfigList() {
        return null;
    }

    /**
+0 −4
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.telephony.CallQuality;
import android.telephony.CellInfo;
import android.telephony.CellLocation;
import android.telephony.PhoneCapability;
import android.telephony.PhysicalChannelConfig;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.ims.ImsReasonInfo;

@@ -60,9 +59,6 @@ public interface PhoneNotifier {

    void notifyCellInfo(Phone sender, List<CellInfo> cellInfo);

    /** Notify of change to PhysicalChannelConfiguration. */
    void notifyPhysicalChannelConfiguration(Phone sender, List<PhysicalChannelConfig> configs);

    void notifyPreciseCallState(Phone sender);

    void notifyDisconnectCause(Phone sender, int cause, int preciseCause);
+4 −0
Original line number Diff line number Diff line
@@ -816,6 +816,10 @@ public class ServiceStateTracker extends Handler {
    }
    public boolean getPowerStateFromCarrier() { return !mRadioDisabledByCarrier; }

    public List<PhysicalChannelConfig> getPhysicalChannelConfigList() {
        return mLastPhysicalChannelConfigList;
    }

    private SignalStrength mLastSignalStrength = null;
    @UnsupportedAppUsage
    protected boolean notifySignalStrength() {
Loading