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

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

Merge changes I7a1504b7,I76bef934,I91028f28 into main

* changes:
  Errorprone: JdkObsolete
  Errorprone: Finalize
  Errorprone: LockOnNonEnclosingClassLiteral
parents decf4893 15d406f1
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -337,11 +337,14 @@ android_app {
            "-Xep:EmptyCatch:ERROR",
            "-Xep:EqualsGetClass:ERROR",
            "-Xep:FallThrough:ERROR",
            "-Xep:Finalize:ERROR",
            "-Xep:HidingField:ERROR",
            "-Xep:InlineMeInliner:ERROR",
            "-Xep:InvalidBlockTag:ERROR",
            "-Xep:InvalidParam:ERROR",
            "-Xep:JavaUtilDate:ERROR",
            "-Xep:JdkObsolete:ERROR",
            "-Xep:LockOnNonEnclosingClassLiteral:ERROR",
            "-Xep:LoopOverCharArray:ERROR",
            "-Xep:MissingCasesInEnumSwitch:ERROR",
            "-Xep:MixedMutabilityReturnType:ERROR",
+0 −18
Original line number Diff line number Diff line
@@ -20,16 +20,6 @@ import android.util.Log;

public class AdapterApp extends Application {
    private static final String TAG = "BluetoothAdapterApp";
    // For Debugging only
    private static int sRefCount = 0;

    public AdapterApp() {
        super();
        synchronized (AdapterApp.class) {
            sRefCount++;
            Log.d(TAG, "REFCOUNT: Constructed " + this + " Instance Count = " + sRefCount);
        }
    }

    @Override
    public void onCreate() {
@@ -41,12 +31,4 @@ public class AdapterApp extends Application {
            Log.e(TAG, "Migration failure: ", e);
        }
    }

    @Override
    protected void finalize() {
        synchronized (AdapterApp.class) {
            sRefCount--;
            Log.d(TAG, "REFCOUNT: Finalized: " + this + ", Instance Count = " + sRefCount);
        }
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -590,6 +590,7 @@ public class DatabaseManager {
    }

    @GuardedBy("mMetadataCache")
    @SuppressWarnings("LockOnNonEnclosingClassLiteral")
    private void setConnection(BluetoothDevice device, boolean isActiveA2dp, boolean isActiveHfp) {
        if (device == null) {
            Log.e(TAG, "setConnection: device is null");
@@ -868,6 +869,7 @@ public class DatabaseManager {
    /**
     * @param metadataList is the list of metadata
     */
    @SuppressWarnings("LockOnNonEnclosingClassLiteral")
    private void compactLastConnectionTime(List<Metadata> metadataList) {
        Log.d(TAG, "compactLastConnectionTime: Compacting metadata after load");
        synchronized (MetadataDatabase.class) {
+9 −9
Original line number Diff line number Diff line
@@ -66,15 +66,15 @@ import com.android.internal.util.StateMachine;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

public class HeadsetClientStateMachine extends StateMachine {
    private static final String TAG = HeadsetClientStateMachine.class.getSimpleName();
@@ -139,10 +139,10 @@ public class HeadsetClientStateMachine extends StateMachine {

    // Set of calls that represent the accurate state of calls that exists on AG and the calls that
    // are currently in process of being notified to the AG from HF.
    @VisibleForTesting final Hashtable<Integer, HfpClientCall> mCalls = new Hashtable<>();
    @VisibleForTesting final Map<Integer, HfpClientCall> mCalls = new ConcurrentHashMap<>();
    // Set of calls received from AG via the AT+CLCC command. We use this map to update the mCalls
    // which is eventually used to inform the telephony stack of any changes to call on HF.
    private final Hashtable<Integer, HfpClientCall> mCallsUpdate = new Hashtable<>();
    private final Map<Integer, HfpClientCall> mCallsUpdate = new ConcurrentHashMap<>();

    private int mIndicatorNetworkState;
    private int mIndicatorNetworkType;
@@ -157,7 +157,7 @@ public class HeadsetClientStateMachine extends StateMachine {
    private static int sMinAmVcVol;

    // queue of send actions (pair action, action_data)
    @VisibleForTesting Queue<Pair<Integer, Object>> mQueuedActions;
    @VisibleForTesting ArrayDeque<Pair<Integer, Object>> mQueuedActions;

    @VisibleForTesting int mAudioState;
    // Indicates whether audio can be routed to the device
@@ -432,7 +432,7 @@ public class HeadsetClientStateMachine extends StateMachine {
        // 1. If from the above procedure we get N extra calls (i.e. {3}):
        // choose the first call as the one to associate with the HF call.

        // Create set of IDs for added calls, removed calls and consitent calls.
        // Create set of IDs for added calls, removed calls and consistent calls.
        // WARN!!! Java Map -> Set has association hence changes to Set are reflected in the Map
        // itself (i.e. removing an element from Set removes it from the Map hence use copy).
        Set<Integer> currCallIdSet = new HashSet<Integer>();
@@ -930,7 +930,7 @@ public class HeadsetClientStateMachine extends StateMachine {
        mOperatorName = null;
        mSubscriberInfo = null;

        mQueuedActions = new LinkedList<Pair<Integer, Object>>();
        mQueuedActions = new ArrayDeque<>();

        mCalls.clear();
        mCallsUpdate.clear();
@@ -1066,7 +1066,7 @@ public class HeadsetClientStateMachine extends StateMachine {
            mOperatorName = null;
            mSubscriberInfo = null;

            mQueuedActions = new LinkedList<Pair<Integer, Object>>();
            mQueuedActions = new ArrayDeque<>();

            mCalls.clear();
            mCallsUpdate.clear();
+3 −3
Original line number Diff line number Diff line
@@ -97,11 +97,11 @@ import com.android.bluetooth.vc.VolumeControlService;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -193,8 +193,8 @@ public class LeAudioService extends ProfileService {
    Optional<Boolean> mQueuedInCallValue = Optional.empty();
    boolean mTmapStarted = false;
    private boolean mAwaitingBroadcastCreateResponse = false;
    private final LinkedList<BluetoothLeBroadcastSettings> mCreateBroadcastQueue =
            new LinkedList<>();
    private final ArrayDeque<BluetoothLeBroadcastSettings> mCreateBroadcastQueue =
            new ArrayDeque<>();
    boolean mIsSourceStreamMonitorModeEnabled = false;
    boolean mIsSinkStreamMonitorModeEnabled = false;
    boolean mIsBroadcastPausedFromOutside = false;
Loading