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

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

Merge "HidHost: Remove quiet mode dead code" into main

parents bc996361 b965bbd5
Loading
Loading
Loading
Loading
+1 −21
Original line number Diff line number Diff line
@@ -109,7 +109,6 @@ public class HidHostService extends ProfileService {
    private final HidHostNativeInterface mNativeInterface;

    private boolean mNativeAvailable;
    private BluetoothDevice mTargetDevice = null;

    private static final int MESSAGE_CONNECT = 1;
    private static final int MESSAGE_DISCONNECT = 2;
@@ -698,7 +697,6 @@ public class HidHostService extends ProfileService {
        if (Flags.allowSwitchingHidAndHogp() || connectionAllowed) {
            updateConnectionState(device, transport, reportedState);
        }
        updateQuietMode(device, reportedState);
    }

    private void handleMessageDisconnect(Message msg) {
@@ -781,23 +779,6 @@ public class HidHostService extends ProfileService {
        return true;
    }

    /**
     * Disables the quiet mode if target device gets connected
     *
     * @param device remote device
     * @param state connection state
     */
    private void updateQuietMode(BluetoothDevice device, int state) {
        if (state == BluetoothProfile.STATE_CONNECTED
                && mTargetDevice != null
                && mTargetDevice.equals(device)) {
            // Locally initiated connection, move out of quiet mode
            Log.i(TAG, "updateQuietMode: Move out of quiet mode. device=" + device);
            mTargetDevice = null;
            mAdapterService.enable(false);
        }
    }

    @VisibleForTesting
    static class BluetoothHidHostBinder extends IBluetoothHidHost.Stub
            implements IProfileServiceBinder {
@@ -1482,7 +1463,7 @@ public class HidHostService extends ProfileService {
    @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE)
    public boolean okToConnect(BluetoothDevice device) {
        // Check if this is an incoming connection in Quiet mode.
        if (mAdapterService.isQuietModeEnabled() && mTargetDevice == null) {
        if (mAdapterService.isQuietModeEnabled()) {
            Log.w(TAG, "okToConnect: return false because of quiet mode enabled. device=" + device);
            return false;
        }
@@ -1510,7 +1491,6 @@ public class HidHostService extends ProfileService {
    @Override
    public void dump(StringBuilder sb) {
        super.dump(sb);
        println(sb, "mTargetDevice: " + mTargetDevice);
        println(sb, "mInputDevices:");
        mInputDevices.forEach(
                (k, v) -> sb.append(" ").append(k).append(" : ").append(v).append("\n"));