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

Commit 9d7925e6 authored by Sarah Chin's avatar Sarah Chin Committed by Jack Yu
Browse files

Create new DataEnabledReasons for for DataSettingsManager

DataEnabledSettings used an internal DataEnabledChangedReason when
notifying data enabled was changed. For DataSettingsManager, sync the
reasons with TelephonyManager#DataEnabledReasons and remove the internal
reaons.

Test: atest FrameworksTelephonyTests
Bug: 204309297
Merged-In: I8d6fd13e319ce165e25f2afd93bf9884fbf22667
Change-Id: I8d6fd13e319ce165e25f2afd93bf9884fbf22667
parent 7c8bca86
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -41759,8 +41759,10 @@ package android.telephony {
    field public static final int DATA_DISCONNECTED = 0; // 0x0
    field public static final int DATA_DISCONNECTING = 4; // 0x4
    field public static final int DATA_ENABLED_REASON_CARRIER = 2; // 0x2
    field public static final int DATA_ENABLED_REASON_OVERRIDE = 4; // 0x4
    field public static final int DATA_ENABLED_REASON_POLICY = 1; // 0x1
    field public static final int DATA_ENABLED_REASON_THERMAL = 3; // 0x3
    field public static final int DATA_ENABLED_REASON_UNKNOWN = -1; // 0xffffffff
    field public static final int DATA_ENABLED_REASON_USER = 0; // 0x0
    field public static final int DATA_HANDOVER_IN_PROGRESS = 5; // 0x5
    field public static final int DATA_SUSPENDED = 3; // 0x3
+3 −2
Original line number Diff line number Diff line
@@ -1409,10 +1409,11 @@ public class TelephonyCallback {
         *
         * @param enabled {@code true} if data is enabled, otherwise disabled.
         * @param reason  Reason for data enabled/disabled.
         *                See {@link TelephonyManager.DataEnabledReason}.
         *                See {@link TelephonyManager.DataEnabledChangedReason}.
         */
        @RequiresPermission(Manifest.permission.READ_PRECISE_PHONE_STATE)
        void onDataEnabledChanged(boolean enabled, @TelephonyManager.DataEnabledReason int reason);
        void onDataEnabledChanged(boolean enabled,
                @TelephonyManager.DataEnabledChangedReason int reason);
    }

    /**
+26 −0
Original line number Diff line number Diff line
@@ -12542,6 +12542,25 @@ public class TelephonyManager {
    @Retention(RetentionPolicy.SOURCE)
    public @interface DataEnabledReason{}
    /** @hide */
    @IntDef({
            DATA_ENABLED_REASON_UNKNOWN,
            DATA_ENABLED_REASON_USER,
            DATA_ENABLED_REASON_POLICY,
            DATA_ENABLED_REASON_CARRIER,
            DATA_ENABLED_REASON_THERMAL,
            DATA_ENABLED_REASON_OVERRIDE
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface DataEnabledChangedReason{}
    /**
     * To indicate that data was enabled or disabled due to an unknown reason.
     * Note that this is not a valid reason for {@link #setDataEnabledForReason(int, boolean)} and
     * is only used to indicate that data enabled was changed.
     */
    public static final int DATA_ENABLED_REASON_UNKNOWN = -1;
    /**
     * To indicate that user enabled or disabled data.
     */
@@ -12568,6 +12587,13 @@ public class TelephonyManager {
     */
    public static final int DATA_ENABLED_REASON_THERMAL = 3;
    /**
     * To indicate data was enabled or disabled due to {@link MobileDataPolicy} overrides.
     * Note that this is not a valid reason for {@link #setDataEnabledForReason(int, boolean)} and
     * is only used to indicate that data enabled was changed due to an override.
     */
    public static final int DATA_ENABLED_REASON_OVERRIDE = 4;
    /**
     * Control of data connection and provide the reason triggering the data connection control.
     * This can be called for following reasons