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

Commit 27140341 authored by Hieu Dang's avatar Hieu Dang
Browse files

Change API name

Change getCreateBondCaller to getPackageNameOfBondingApplication.

Bug: 269604212
Test: atest BluetoothDeviceTest
Tag: #refactor
Change-Id: I736e250d02c3961fc6c5ce6b5a3cde7726375af9
parent 64257989
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -2648,10 +2648,10 @@ public class AdapterService extends Service {
        }

        @Override
        public void getCreateBondCaller(BluetoothDevice device,
        public void getPackageNameOfBondingApplication(BluetoothDevice device,
                SynchronousResultReceiver receiver) {
            try {
                receiver.send(getCreateBondCaller(device));
                receiver.send(getPackageNameOfBondingApplication(device));
            } catch (RuntimeException e) {
                receiver.propagateException(e);
            }
@@ -2661,7 +2661,7 @@ public class AdapterService extends Service {
                android.Manifest.permission.BLUETOOTH_CONNECT,
                android.Manifest.permission.BLUETOOTH_PRIVILEGED,
        })
        private String getCreateBondCaller(BluetoothDevice device)  {
        private String getPackageNameOfBondingApplication(BluetoothDevice device)  {
            AdapterService service = getService();

            if (service == null) {
@@ -2670,7 +2670,7 @@ public class AdapterService extends Service {

            enforceBluetoothPrivilegedPermission(service);

            return service.getCreateBondCaller(device);
            return service.getPackageNameOfBondingApplication(device);
        }

        @Override
@@ -4971,7 +4971,7 @@ public class AdapterService extends Service {
     * {@link BluetoothDevice#createBond} on the given device.
     */
    @Nullable
    public String getCreateBondCaller(BluetoothDevice device) {
    public String getPackageNameOfBondingApplication(BluetoothDevice device) {
        CallerInfo info = mBondAttemptCallerInfo.get(device.getAddress());
        if (info == null) {
            return null;
+1 −1
Original line number Diff line number Diff line
@@ -164,10 +164,10 @@ package android.bluetooth {
    method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH_PRIVILEGED) public String getAnonymizedAddress();
    method @IntRange(from=0xffffff9c, to=100) @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int getBatteryLevel();
    method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public int getConnectionHandle(int);
    method @Nullable @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public String getCreateBondCaller();
    method @Nullable @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public String getIdentityAddress();
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int getMessageAccessPermission();
    method @Nullable @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public byte[] getMetadata(int);
    method @Nullable @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public String getPackageNameOfBondingApplication();
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int getPhonebookAccessPermission();
    method @Nullable @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public android.bluetooth.BluetoothSinkAudioPolicy getRequestedAudioPolicyAsSink();
    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int getSimAccessPermission();
+4 −4
Original line number Diff line number Diff line
@@ -2122,17 +2122,17 @@ public final class BluetoothDevice implements Parcelable, Attributable {
            android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
    })
    public String getCreateBondCaller() {
        if (DBG) log("getCreateBondCaller()");
    public String getPackageNameOfBondingApplication() {
        if (DBG) log("getPackageNameOfBondingApplication()");
        final IBluetooth service = getService();
        final String defaultValue = null;
        if (service == null || !isBluetoothEnabled()) {
            Log.w(TAG, "BT not enabled, getCreateBondCaller failed");
            Log.w(TAG, "BT not enabled, getPackageNameOfBondingApplication failed");
            if (DBG) log(Log.getStackTraceString(new Throwable()));
        } else {
            try {
                final SynchronousResultReceiver<String> recv = SynchronousResultReceiver.get();
                service.getCreateBondCaller(this, recv);
                service.getPackageNameOfBondingApplication(this, recv);
                return recv.awaitResultNoInterrupt(getSyncTimeout()).getValue(defaultValue);
            } catch (RemoteException | TimeoutException e) {
                Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
+1 −1
Original line number Diff line number Diff line
@@ -258,7 +258,7 @@ interface IBluetooth
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
    oneway void canBondWithoutDialog(in BluetoothDevice device, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
    oneway void getCreateBondCaller(in BluetoothDevice device, in SynchronousResultReceiver receiver);
    oneway void getPackageNameOfBondingApplication(in BluetoothDevice device, in SynchronousResultReceiver receiver);
    @JavaPassthrough(annotation="@android.annotation.RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT,android.Manifest.permission.BLUETOOTH_PRIVILEGED})")
    oneway void generateLocalOobData(in int transport, IBluetoothOobDataCallback callback, in AttributionSource attributionSource, in SynchronousResultReceiver receiver);