Loading android/app/Android.bp +3 −0 Original line number Diff line number Diff line Loading @@ -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", Loading android/app/src/com/android/bluetooth/btservice/AdapterApp.java +0 −18 Original line number Diff line number Diff line Loading @@ -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() { Loading @@ -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); } } } android/app/src/com/android/bluetooth/btservice/storage/DatabaseManager.java +2 −0 Original line number Diff line number Diff line Loading @@ -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"); Loading Loading @@ -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) { Loading android/app/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java +9 −9 Original line number Diff line number Diff line Loading @@ -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(); Loading Loading @@ -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; Loading @@ -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 Loading Loading @@ -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>(); Loading Loading @@ -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(); Loading Loading @@ -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(); Loading android/app/src/com/android/bluetooth/le_audio/LeAudioService.java +3 −3 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 Loading
android/app/Android.bp +3 −0 Original line number Diff line number Diff line Loading @@ -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", Loading
android/app/src/com/android/bluetooth/btservice/AdapterApp.java +0 −18 Original line number Diff line number Diff line Loading @@ -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() { Loading @@ -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); } } }
android/app/src/com/android/bluetooth/btservice/storage/DatabaseManager.java +2 −0 Original line number Diff line number Diff line Loading @@ -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"); Loading Loading @@ -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) { Loading
android/app/src/com/android/bluetooth/hfpclient/HeadsetClientStateMachine.java +9 −9 Original line number Diff line number Diff line Loading @@ -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(); Loading Loading @@ -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; Loading @@ -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 Loading Loading @@ -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>(); Loading Loading @@ -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(); Loading Loading @@ -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(); Loading
android/app/src/com/android/bluetooth/le_audio/LeAudioService.java +3 −3 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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