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

Commit 972b0f87 authored by Andrew Cheng's avatar Andrew Cheng Committed by Automerger Merge Worker
Browse files

Add BluetoothConnectionCallback to Companion App am: af705d26 am: a0dd9676

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1596076

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ib5629fe35816bf368571435cc7d4956ab9bf66c8
parents 7d898bc6 a0dd9676
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ import android.annotation.CheckResult;
import android.annotation.Nullable;
import android.app.AppOpsManager;
import android.app.PendingIntent;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.companion.Association;
import android.companion.AssociationRequest;
import android.companion.CompanionDeviceManager;
@@ -667,6 +669,12 @@ public class CompanionDeviceManagerService extends SystemService implements Bind
        }
    }

    void onDeviceConnected(String address) {
    }

    void onDeviceDisconnected(String address) {
    }

    private class ShellCmd extends ShellCommand {
        public static final String USAGE = "help\n"
                + "list USER_ID\n"
@@ -711,4 +719,17 @@ public class CompanionDeviceManagerService extends SystemService implements Bind
        }
    }


    private class BluetoothDeviceConnectedListener
            extends BluetoothAdapter.BluetoothConnectionCallback {
        @Override
        public void onDeviceConnected(BluetoothDevice device) {
            CompanionDeviceManagerService.this.onDeviceConnected(device.getAddress());
        }

        @Override
        public void onDeviceDisconnected(BluetoothDevice device) {
            CompanionDeviceManagerService.this.onDeviceDisconnected(device.getAddress());
        }
    }
}