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

Commit 2b24ea5a authored by Hall Liu's avatar Hall Liu Committed by Automerger Merge Worker
Browse files

Merge changes from topic "telephonymanager-data-policy" am: 3a14c6bd

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1469718

Change-Id: I716a51456ab4c347294481df6cf62c7825b089c2
parents 04deccd6 3a14c6bd
Loading
Loading
Loading
Loading
+1 −81
Original line number Diff line number Diff line
@@ -12607,7 +12607,7 @@ public class TelephonyManager {
     *  1) User data is turned on, or
     *  2) APN is un-metered for this subscription, or
     *  3) APN type is whitelisted. E.g. MMS is whitelisted if
     *  {@link #setAlwaysAllowMmsData(boolean)} is turned on.
     *  {@link #MOBILE_DATA_POLICY_MMS_ALWAYS_ALLOWED} is enabled.
     *
     * @param apnType Value indicating the apn type. Apn types are defined in {@link ApnSetting}.
     * @return whether data is enabled for a apn type.
@@ -13032,86 +13032,6 @@ public class TelephonyManager {
        return false;
    }
    /**
     *
     * @param allow {@code true} if allowing using data during voice call, {@code false} if
     * disallowed.
     *
     * @return {@code true} if operation is successful. otherwise {@code false}.
     *
     * @throws SecurityException if the caller doesn't have the permission.
     *
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
    public boolean setDataAllowedDuringVoiceCall(boolean allow) {
        try {
            ITelephony service = getITelephony();
            if (service != null) {
                return service.setDataAllowedDuringVoiceCall(getSubId(), allow);
            }
        } catch (RemoteException ex) {
            // This could happen if binder process crashes.
            if (!isSystemProcess()) {
                ex.rethrowAsRuntimeException();
            }
        }
        return false;
    }
    /**
     * Check whether data is allowed during voice call. This is used for allowing data on the
     * non-default data SIM. When a voice call is placed on the non-default data SIM on DSDS
     * devices, users will not be able to use mobile data. By calling this API, data will be
     * temporarily enabled on the non-default data SIM during the life cycle of the voice call.
     *
     * @return {@code true} if data is allowed during voice call.
     *
     * @throws SecurityException if the caller doesn't have the permission.
     *
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
    public boolean isDataAllowedInVoiceCall() {
        try {
            ITelephony service = getITelephony();
            if (service != null) {
                return service.isDataAllowedInVoiceCall(getSubId());
            }
        } catch (RemoteException ex) {
            // This could happen if binder process crashes.
            if (!isSystemProcess()) {
                ex.rethrowAsRuntimeException();
            }
        }
        return false;
    }
    /**
     * Set whether the specific sim card always allows MMS connection. If true, MMS network
     * request will be accepted by telephony even if user turns "mobile data" off
     * on this specific sim card.
     *
     * @param alwaysAllow whether Mms data is always allowed.
     * @return whether operation is successful.
     *
     * @hide
     */
    @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
    public boolean setAlwaysAllowMmsData(boolean alwaysAllow) {
        try {
            ITelephony service = getITelephony();
            if (service != null) {
                return service.setAlwaysAllowMmsData(getSubId(), alwaysAllow);
            }
        } catch (RemoteException ex) {
            if (!isSystemProcess()) {
                ex.rethrowAsRuntimeException();
            }
        }
        return false;
    }
    /**
     * The IccLock state or password was changed successfully.
     * @hide
+0 −16
Original line number Diff line number Diff line
@@ -2237,22 +2237,6 @@ interface ITelephony {

    boolean isMobileDataPolicyEnabled(int subscriptionId, int policy);

    /**
     * Set allowing mobile data during voice call.
     */
    boolean setDataAllowedDuringVoiceCall(int subId, boolean allow);

    /**
     * Check whether data is allowed during voice call. Note this is for dual sim device that
     * data might be disabled on non-default data subscription but explicitly turned on by settings.
     */
    boolean isDataAllowedInVoiceCall(int subId);

    /**
     * Set whether a subscription always allows MMS connection.
     */
    boolean setAlwaysAllowMmsData(int subId, boolean allow);

    /**
     * Command line command to enable or disable handling of CEP data for test purposes.
     */