Add BluetoothConnectionCallback to Companion App
Tag: #refactor Fixes: 180729821 Test: atest BluetoothInstrumentationTests Merged-In: Id24a4b3a3510781d9105763b1722f44583a7fd7c Change-Id: I598428052191e4a23e4d7cd0b265c84a088431c7
This commit is contained in:
@@ -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;
|
||||
@@ -665,6 +667,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"
|
||||
@@ -709,4 +717,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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user