Add BluetoothConnectionCallback to Companion App am: af705d2676

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3c881b415939f1bfa6f60ee5e1f2ced030b9a5ba
This commit is contained in:
Andrew Cheng
2021-02-23 23:44:08 +00:00
committed by Automerger Merge Worker

View File

@@ -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());
}
}
}