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

Commit 02307b89 authored by Zoey Chen's avatar Zoey Chen
Browse files

[Telephony] Notify onDataEnabled

Bug: 147577230
Test: atest CtsTelephonyTestCases:PhoneStateListenerTest
Change-Id: I3e22ccce2317b6e1ab053a76ae1467b335d42058
parent 555d14de
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.telephony.PreciseDataConnectionState;
import android.telephony.ServiceState;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager;
import android.telephony.TelephonyManager.DataEnabledReason;
import android.telephony.TelephonyRegistryManager;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.ims.ImsReasonInfo;
@@ -243,6 +244,11 @@ public class DefaultPhoneNotifier implements PhoneNotifier {
        mTelephonyRegistryMgr.notifyPhysicalChannelConfigForSubscriber(subId, configs);
    }

    @Override
    public void notifyDataEnabled(boolean enabled, @DataEnabledReason int reason) {
        mTelephonyRegistryMgr.notifyDataEnabled(enabled, reason);
    }

    /**
     * Convert the {@link DataActivityState} enum into the TelephonyManager.DATA_* constants for the
     * public API.
+6 −0
Original line number Diff line number Diff line
@@ -2703,6 +2703,12 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        mNotifier.notifyOutgoingEmergencySms(this, emergencyNumber);
    }

    /** Notify the data enabled changes. */
    public void notifyDataEnabled(boolean enabled,
            @TelephonyManager.DataEnabledReason int reason) {
        mNotifier.notifyDataEnabled(enabled, reason);
    }

    /**
     * @return true if a mobile originating emergency call is active
     */
+4 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.telephony.PhysicalChannelConfig;
import android.telephony.PreciseDataConnectionState;
import android.telephony.ServiceState;
import android.telephony.TelephonyDisplayInfo;
import android.telephony.TelephonyManager.DataEnabledReason;
import android.telephony.emergency.EmergencyNumber;
import android.telephony.ims.ImsReasonInfo;

@@ -121,4 +122,7 @@ public interface PhoneNotifier {
    /** Notify of change to PhysicalChannelConfig. */
    void notifyPhysicalChannelConfig(Phone sender, List<PhysicalChannelConfig> configs);

    /** Notify DataEnabled has changed. */
    void notifyDataEnabled(boolean enabled, @DataEnabledReason int reason);

}
+1 −0
Original line number Diff line number Diff line
@@ -494,6 +494,7 @@ public class DataEnabledSettings {

    private void notifyDataEnabledChanged(boolean enabled, int reason) {
        mOverallDataEnabledChangedRegistrants.notifyResult(new Pair<>(enabled, reason));
        mPhone.notifyDataEnabled(enabled, reason);
    }

    public void registerForDataEnabledChanged(Handler h, int what, Object obj) {