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

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

Add BluetoothConnectionCallback to Companion App am: af705d26

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

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I3c881b415939f1bfa6f60ee5e1f2ced030b9a5ba
parents c12293f7 af705d26
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());
        }
    }
}