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

Commit eaff5223 authored by Pengquan Meng's avatar Pengquan Meng
Browse files

[API feedback] api fixed for getSlotMapping

Bug: 126727170
Test: build
Change-Id: I45e0cb73531f4d48ea94fed1a30d5a389be43ead
parent f899e268
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6374,7 +6374,7 @@ package android.telephony {
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean getEmergencyCallbackMode();
    method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimDomain();
    method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimIst();
    method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List<android.util.Pair<java.lang.Integer,java.lang.Integer>> getLogicalToPhysicalSlotMapping();
    method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.Map<java.lang.Integer,java.lang.Integer> getLogicalToPhysicalSlotMapping();
    method public static long getMaxNumberVerificationTimeoutMillis();
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getPreferredNetworkTypeBitmap();
    method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public int getRadioPowerState();
+8 −8
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -3291,26 +3292,25 @@ public class TelephonyManager {
    }

    /**
     * Get the mapping from logical slots to physical slots. The mapping represent by a pair list.
     * The key of the piar is the logical slot id and the value of the pair is the physical
     * slots id mapped to this logical slot id.
     * Get the mapping from logical slots to physical slots. The key of the map is the logical slot
     * id and the value is the physical slots id mapped to this logical slot id.
     *
     * @return an pair list indicates the mapping from logical slots to physical slots. The size of
     * the list should be {@link #getPhoneCount()} if success, otherwise return an empty list.
     * @return a map indicates the mapping from logical slots to physical slots. The size of the map
     * should be {@link #getPhoneCount()} if success, otherwise return an empty map.
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
    @NonNull
    public List<Pair<Integer, Integer>> getLogicalToPhysicalSlotMapping() {
        List<Pair<Integer, Integer>> slotMapping = new ArrayList<>();
    public Map<Integer, Integer> getLogicalToPhysicalSlotMapping() {
        Map<Integer, Integer> slotMapping = new HashMap<>();
        try {
            ITelephony telephony = getITelephony();
            if (telephony != null) {
                int[] slotMappingArray = telephony.getSlotsMapping();
                for (int i = 0; i < slotMappingArray.length; i++) {
                    slotMapping.add(new Pair(i, slotMappingArray[i]));
                    slotMapping.put(i, slotMappingArray[i]);
                }
            }
        } catch (RemoteException e) {