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

Commit eefea16a authored by Xiangyu/Malcolm Chen's avatar Xiangyu/Malcolm Chen Committed by android-build-merger
Browse files

Merge "Add API to set alwaysAllowMms" into qt-dev am: f447240a

am: 8306a55b

Change-Id: Ia20e26beaadc52bad26321fa866a7a9ab3ca9054
parents 09335056 8306a55b
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
@@ -293,6 +293,19 @@ public class SubscriptionManager {
    /** @hide */
    public static final String SUBSCRIPTION_TYPE = "subscription_type";

    /**
     * TelephonyProvider column name white_listed_apn_data.
     * It's a bitmask of APN types that will be allowed on this subscription even if it's metered
     * and mobile data is turned off by the user.
     * <P>Type: INTEGER (int)</P> For example, if TYPE_MMS is is true, Telephony will allow MMS
     * data connection to setup even if MMS is metered and mobile_data is turned off on that
     * subscription.
     *
     * Default value is 0.
     */
    /** @hide */
    public static final String WHITE_LISTED_APN_DATA = "white_listed_apn_data";

    /**
     * This constant is to designate a subscription as a Local-SIM Subscription.
     * <p> A Local-SIM can be a physical SIM inserted into a sim-slot in the device, or eSIM on the
@@ -3086,6 +3099,31 @@ public class SubscriptionManager {
        return subId;
    }

    /**
     * Set whether a subscription always allows MMS connection. If true, MMS network
     * request will be accepted by telephony even if user turns "mobile data" off
     * on this subscription.
     *
     * @param subId which subscription it's setting to.
     * @param alwaysAllow whether Mms data is always allowed.
     * @return whether operation is successful.
     *
     * @hide
     */
    public boolean setAlwaysAllowMmsData(int subId, boolean alwaysAllow) {
        try {
            ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
            if (iSub != null) {
                return iSub.setAlwaysAllowMmsData(subId, alwaysAllow);
            }
        } catch (RemoteException ex) {
            if (!isSystemProcess()) {
                ex.rethrowAsRuntimeException();
            }
        }
        return false;
    }

    private interface CallISubMethodHelper {
        int callMethod(ISub iSub) throws RemoteException;
    }
+29 −0
Original line number Diff line number Diff line
@@ -10984,4 +10984,33 @@ public class TelephonyManager {
        }
        return new Pair<Integer, Integer>(-1, -1);
    }


    /**
     * Return whether MMS data is enabled. This will tell if framework will accept a MMS network
     * request on a subId.
     *
     *  Mms is enabled if:
     *  1) user data is turned on, or
     *  2) MMS is un-metered for this subscription, or
     *  3) alwaysAllowMms setting {@link SubscriptionManager#setAlwaysAllowMmsData} is turned on.
     *
     * @return whether MMS data is allowed.
     *
     * @hide
     */
    public boolean isMmsDataEnabled() {
        String pkgForDebug = mContext != null ? mContext.getOpPackageName() : "<unknown>";
        try {
            ITelephony service = getITelephony();
            if (service != null) {
                return service.isMmsDataEnabled(getSubId(), pkgForDebug);
            }
        } catch (RemoteException ex) {
            if (!isSystemProcess()) {
                ex.rethrowAsRuntimeException();
            }
        }
        return false;
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ public class DctConstants {
    public static final int EVENT_ROAMING_SETTING_CHANGE = BASE + 48;
    public static final int EVENT_DATA_SERVICE_BINDING_CHANGED = BASE + 49;
    public static final int EVENT_DEVICE_PROVISIONED_CHANGE = BASE + 50;
    public static final int EVENT_APN_WHITE_LIST_CHANGE = BASE + 51;

    /***** Constants *****/

+2 −0
Original line number Diff line number Diff line
@@ -279,4 +279,6 @@ interface ISub {
    int getSimStateForSlotIndex(int slotIndex);

    boolean isActiveSubId(int subId, String callingPackage);

    boolean setAlwaysAllowMmsData(int subId, boolean alwaysAllow);
}
+2 −0
Original line number Diff line number Diff line
@@ -1966,4 +1966,6 @@ interface ITelephony {
    int getRadioHalVersion();

    boolean isModemEnabledForSlot(int slotIndex, String callingPackage);

    boolean isMmsDataEnabled(int subId, String callingPackage);
}