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

Commit 695bbd18 authored by Chen Xu's avatar Chen Xu Committed by Gerrit Code Review
Browse files

Merge "fix the issue that sending wrong preferred networktype to RIL"

parents fd46a0aa 42814534
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.hardware.radio.V1_4.CellInfo.Info;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import android.telephony.TelephonyManager.PrefNetworkMode;

import com.android.internal.telephony.RILConstants;

@@ -170,7 +171,8 @@ public class RadioAccessFamily implements Parcelable {
    };

    @UnsupportedAppUsage
    public static int getRafFromNetworkType(int type) {
    @TelephonyManager.NetworkTypeBitMask
    public static int getRafFromNetworkType(@PrefNetworkMode int type) {
        switch (type) {
            case RILConstants.NETWORK_MODE_WCDMA_PREF:
                return GSM | WCDMA;
@@ -279,6 +281,7 @@ public class RadioAccessFamily implements Parcelable {
    }

    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023)
    @PrefNetworkMode
    public static int getNetworkTypeFromRaf(int raf) {
        raf = getAdjustedRaf(raf);

+2 −2
Original line number Diff line number Diff line
@@ -6837,12 +6837,12 @@ public class TelephonyManager {
     * app has carrier privileges (see {@link #hasCarrierPrivileges}).
     *
     * @param subId the id of the subscription to set the preferred network type for.
     * @param networkType the preferred network type, defined in RILConstants.java.
     * @param networkType the preferred network type
     * @return true on success; false on any failure.
     * @hide
     */
    @UnsupportedAppUsage
    public boolean setPreferredNetworkType(int subId, int networkType) {
    public boolean setPreferredNetworkType(int subId, @PrefNetworkMode int networkType) {
        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {