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

Commit 7c214d76 authored by William Escande's avatar William Escande
Browse files

Hap: re-order variable and move some to final

Bug: 311772251
Flag: Exempt refactor
Test: atest HapClientServiceTest
Change-Id: I9f6ab7bde1357fcbf9422eba762bb2f6d4896076
parent ddead331
Loading
Loading
Loading
Loading
+9 −7
Original line number Diff line number Diff line
@@ -64,22 +64,20 @@ import java.util.Map;

/** Provides Bluetooth Hearing Access profile, as a service. */
public class HapClientService extends ProfileService {
    private static final String TAG = "HapClientService";
    private static final String TAG = HapClientService.class.getSimpleName();

    // Upper limit of all HearingAccess devices: Bonded or Connected
    private static final int MAX_HEARING_ACCESS_STATE_MACHINES = 10;
    private static final int SM_THREAD_JOIN_TIMEOUT_MS = 1000;

    private static HapClientService sHapClient;
    private final Map<BluetoothDevice, HapClientStateMachine> mStateMachines = new HashMap<>();
    @VisibleForTesting HapClientNativeInterface mHapClientNativeInterface;
    private AdapterService mAdapterService;
    private DatabaseManager mDatabaseManager;
    private HandlerThread mStateMachinesThread;
    private Handler mHandler;

    private final Map<BluetoothDevice, HapClientStateMachine> mStateMachines = new HashMap<>();
    private final Map<BluetoothDevice, Integer> mDeviceCurrentPresetMap = new HashMap<>();
    private final Map<BluetoothDevice, Integer> mDeviceFeaturesMap = new HashMap<>();
    private final Map<BluetoothDevice, List<BluetoothHapPresetInfo>> mPresetsMap = new HashMap<>();
    private final AdapterService mAdapterService;
    private final HapClientNativeInterface mHapClientNativeInterface;

    @VisibleForTesting
    @GuardedBy("mCallbacks")
@@ -87,6 +85,10 @@ public class HapClientService extends ProfileService {

    @VisibleForTesting ServiceFactory mFactory = new ServiceFactory();

    private DatabaseManager mDatabaseManager;
    private HandlerThread mStateMachinesThread;
    private Handler mHandler;

    public static boolean isEnabled() {
        return BluetoothProperties.isProfileHapClientEnabled().orElse(false);
    }