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

Commit f2a61155 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Fix errorprone warnings that should be errors"

parents 56837d69 a0864f99
Loading
Loading
Loading
Loading
+14 −17
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ import com.android.telephony.Rlog;

import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -102,26 +101,24 @@ public class CarrierSignalAgent extends Handler {
    /**
     * This is a list of supported signals from CarrierSignalAgent
     */
    private static final Set<String> VALID_CARRIER_SIGNAL_ACTIONS = new HashSet<>(Arrays.asList(
    private static final Set<String> VALID_CARRIER_SIGNAL_ACTIONS = Set.of(
            TelephonyManager.ACTION_CARRIER_SIGNAL_PCO_VALUE,
            TelephonyManager.ACTION_CARRIER_SIGNAL_REDIRECTED,
            TelephonyManager.ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED,
            TelephonyManager.ACTION_CARRIER_SIGNAL_RESET,
            TelephonyManager.ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE));

    private static final Map<String, String> NEW_ACTION_TO_COMPAT_MAP =
            new HashMap<String, String>() {{
                put(TelephonyManager.ACTION_CARRIER_SIGNAL_PCO_VALUE,
                        TelephonyIntents.ACTION_CARRIER_SIGNAL_PCO_VALUE);
                put(TelephonyManager.ACTION_CARRIER_SIGNAL_REDIRECTED,
                        TelephonyIntents.ACTION_CARRIER_SIGNAL_REDIRECTED);
                put(TelephonyManager.ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED,
                        TelephonyIntents.ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED);
                put(TelephonyManager.ACTION_CARRIER_SIGNAL_RESET,
                        TelephonyIntents.ACTION_CARRIER_SIGNAL_RESET);
                put(TelephonyManager.ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE,
            TelephonyManager.ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE);

    private static final Map<String, String> NEW_ACTION_TO_COMPAT_MAP = Map.of(
            TelephonyManager.ACTION_CARRIER_SIGNAL_PCO_VALUE,
                    TelephonyIntents.ACTION_CARRIER_SIGNAL_PCO_VALUE,
            TelephonyManager.ACTION_CARRIER_SIGNAL_REDIRECTED,
                    TelephonyIntents.ACTION_CARRIER_SIGNAL_REDIRECTED,
            TelephonyManager.ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED,
                    TelephonyIntents.ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED,
            TelephonyManager.ACTION_CARRIER_SIGNAL_RESET,
                    TelephonyIntents.ACTION_CARRIER_SIGNAL_RESET,
            TelephonyManager.ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE,
                    TelephonyIntents.ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE);
            }};

    private static final Map<String, String> COMPAT_ACTION_TO_NEW_MAP = NEW_ACTION_TO_COMPAT_MAP
            .entrySet().stream().collect(Collectors.toMap(Map.Entry::getValue, Map.Entry::getKey));
+22 −27
Original line number Diff line number Diff line
@@ -89,7 +89,6 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
@@ -116,6 +115,19 @@ public abstract class InboundSmsHandler extends StateMachine {
    protected static final boolean DBG = true;
    protected static final boolean VDBG = false; // STOPSHIP if true, logs user data

    public static final int PDU_COLUMN = 0;
    public static final int SEQUENCE_COLUMN = 1;
    public static final int DESTINATION_PORT_COLUMN = 2;
    public static final int DATE_COLUMN = 3;
    public static final int REFERENCE_NUMBER_COLUMN = 4;
    public static final int COUNT_COLUMN = 5;
    public static final int ADDRESS_COLUMN = 6;
    public static final int ID_COLUMN = 7;
    public static final int MESSAGE_BODY_COLUMN = 8;
    public static final int DISPLAY_ADDRESS_COLUMN = 9;
    public static final int DELETED_FLAG_COLUMN = 10;
    public static final int SUBID_COLUMN = 11;

    /** Query projection for checking for duplicate message segments. */
    private static final String[] PDU_DELETED_FLAG_PROJECTION = {
            "pdu",
@@ -123,11 +135,9 @@ public abstract class InboundSmsHandler extends StateMachine {
    };

    /** Mapping from DB COLUMN to PDU_SEQUENCE_PORT PROJECTION index */
    private static final Map<Integer, Integer> PDU_DELETED_FLAG_PROJECTION_INDEX_MAPPING =
            new HashMap<Integer, Integer>() {{
            put(PDU_COLUMN, 0);
            put(DELETED_FLAG_COLUMN, 1);
            }};
    private static final Map<Integer, Integer> PDU_DELETED_FLAG_PROJECTION_INDEX_MAPPING = Map.of(
            PDU_COLUMN, 0,
            DELETED_FLAG_COLUMN, 1);

    /** Query projection for combining concatenated message segments. */
    private static final String[] PDU_SEQUENCE_PORT_PROJECTION = {
@@ -139,27 +149,12 @@ public abstract class InboundSmsHandler extends StateMachine {
    };

    /** Mapping from DB COLUMN to PDU_SEQUENCE_PORT PROJECTION index */
    private static final Map<Integer, Integer> PDU_SEQUENCE_PORT_PROJECTION_INDEX_MAPPING =
            new HashMap<Integer, Integer>() {{
                put(PDU_COLUMN, 0);
                put(SEQUENCE_COLUMN, 1);
                put(DESTINATION_PORT_COLUMN, 2);
                put(DISPLAY_ADDRESS_COLUMN, 3);
                put(DATE_COLUMN, 4);
    }};

    public static final int PDU_COLUMN = 0;
    public static final int SEQUENCE_COLUMN = 1;
    public static final int DESTINATION_PORT_COLUMN = 2;
    public static final int DATE_COLUMN = 3;
    public static final int REFERENCE_NUMBER_COLUMN = 4;
    public static final int COUNT_COLUMN = 5;
    public static final int ADDRESS_COLUMN = 6;
    public static final int ID_COLUMN = 7;
    public static final int MESSAGE_BODY_COLUMN = 8;
    public static final int DISPLAY_ADDRESS_COLUMN = 9;
    public static final int DELETED_FLAG_COLUMN = 10;
    public static final int SUBID_COLUMN = 11;
    private static final Map<Integer, Integer> PDU_SEQUENCE_PORT_PROJECTION_INDEX_MAPPING = Map.of(
            PDU_COLUMN, 0,
            SEQUENCE_COLUMN, 1,
            DESTINATION_PORT_COLUMN, 2,
            DISPLAY_ADDRESS_COLUMN, 3,
            DATE_COLUMN, 4);

    public static final String SELECT_BY_ID = "_id=?";

+14 −13
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.internal.telephony;

import static java.util.Map.entry;

import android.compat.annotation.UnsupportedAppUsage;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
@@ -72,19 +74,18 @@ public class SmsBroadcastUndelivered {

    /** Mapping from DB COLUMN to PDU_PENDING_MESSAGE_PROJECTION index */
    static final Map<Integer, Integer> PDU_PENDING_MESSAGE_PROJECTION_INDEX_MAPPING =
            new HashMap<Integer, Integer>() {{
                put(InboundSmsHandler.PDU_COLUMN, 0);
                put(InboundSmsHandler.SEQUENCE_COLUMN, 1);
                put(InboundSmsHandler.DESTINATION_PORT_COLUMN, 2);
                put(InboundSmsHandler.DATE_COLUMN, 3);
                put(InboundSmsHandler.REFERENCE_NUMBER_COLUMN, 4);
                put(InboundSmsHandler.COUNT_COLUMN, 5);
                put(InboundSmsHandler.ADDRESS_COLUMN, 6);
                put(InboundSmsHandler.ID_COLUMN, 7);
                put(InboundSmsHandler.MESSAGE_BODY_COLUMN, 8);
                put(InboundSmsHandler.DISPLAY_ADDRESS_COLUMN, 9);
                put(InboundSmsHandler.SUBID_COLUMN, 10);
            }};
            Map.ofEntries(
                entry(InboundSmsHandler.PDU_COLUMN, 0),
                entry(InboundSmsHandler.SEQUENCE_COLUMN, 1),
                entry(InboundSmsHandler.DESTINATION_PORT_COLUMN, 2),
                entry(InboundSmsHandler.DATE_COLUMN, 3),
                entry(InboundSmsHandler.REFERENCE_NUMBER_COLUMN, 4),
                entry(InboundSmsHandler.COUNT_COLUMN, 5),
                entry(InboundSmsHandler.ADDRESS_COLUMN, 6),
                entry(InboundSmsHandler.ID_COLUMN, 7),
                entry(InboundSmsHandler.MESSAGE_BODY_COLUMN, 8),
                entry(InboundSmsHandler.DISPLAY_ADDRESS_COLUMN, 9),
                entry(InboundSmsHandler.SUBID_COLUMN, 10));


    private static SmsBroadcastUndelivered instance;
+1 −2
Original line number Diff line number Diff line
@@ -1175,8 +1175,7 @@ public class LinkBandwidthEstimator extends Handler {
            StringBuilder sb = new StringBuilder();
            sb.append("Plmn").append(mPlmn)
                    .append("Rat").append(mDataRat)
                    .append("Tac").append(mTac)
                    .toString();
                    .append("Tac").append(mTac);
            return sb.toString();
        }
    }
+0 −1
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ public class SimSmsTest extends TestCase {
        List<SmsRawData> records = sms.getAllMessagesFromIccEfForSubscriber(
                preferredSmsSubscription, ActivityThread.currentPackageName());
        assertNotNull(records);
        assertTrue(records.size() >= 0);

        int firstNullIndex = -1;
        int firstValidIndex = -1;
Loading