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

Commit 42814534 authored by chen xu's avatar chen xu Committed by Chen Xu
Browse files

fix the issue that sending wrong preferred networktype to RIL

Bug: 126805258
Test: Manual
Change-Id: Ifb1fc21423a09f0d000553d4d06bafa023adc9d6
Merged-in: Ifb1fc21423a09f0d000553d4d06bafa023adc9d6
parent a982663c
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
@@ -6832,12 +6832,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) {