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

Commit bf6a193e authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6022569 from ef25fb5ea48f79c9fbc83c30bb4d7e538c27f26a to rvc-release

Change-Id: Ife1314d0aae66c4d95d0e3f75e2c961c17ae1b1d
parents f98b55f9 21203bc6
Loading
Loading
Loading
Loading
+50 −0
Original line number Original line Diff line number Diff line
@@ -1733,6 +1733,56 @@ public final class BluetoothAdapter {
        return false;
        return false;
    }
    }


    /**
     * Connects all enabled and supported bluetooth profiles between the local and remote device
     *
     * @param device is the remote device with which to connect these profiles
     * @return true if all profiles successfully connected, false if an error occurred
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    public boolean connectAllEnabledProfiles(@NonNull BluetoothDevice device) {
        try {
            mServiceLock.readLock().lock();
            if (mService != null) {
                return mService.connectAllEnabledProfiles(device);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        } finally {
            mServiceLock.readLock().unlock();
        }

        return false;
    }

    /**
     * Disconnects all enabled and supported bluetooth profiles between the local and remote device
     *
     * @param device is the remote device with which to disconnect these profiles
     * @return true if all profiles successfully disconnected, false if an error occurred
     *
     * @hide
     */
    @SystemApi
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    public boolean disconnectAllEnabledProfiles(@NonNull BluetoothDevice device) {
        try {
            mServiceLock.readLock().lock();
            if (mService != null) {
                return mService.disconnectAllEnabledProfiles(device);
            }
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
        } finally {
            mServiceLock.readLock().unlock();
        }

        return false;
    }

    /**
    /**
     * Return true if the multi advertisement is supported by the chipset
     * Return true if the multi advertisement is supported by the chipset
     *
     *
+0 −18
Original line number Original line Diff line number Diff line
@@ -1094,24 +1094,6 @@ public final class BluetoothDevice implements Parcelable {
        return false;
        return false;
    }
    }


    /**
     * Get the Bluetooth alias of the remote device.
     * If Alias is null, get the Bluetooth name instead.
     *
     * @return the Bluetooth alias, or null if no alias or there was a problem
     * @hide
     * @see #getAlias()
     * @see #getName()
     */
    @UnsupportedAppUsage(publicAlternatives = "Use {@link #getName()} instead.")
    public String getAliasName() {
        String name = getAlias();
        if (name == null) {
            name = getName();
        }
        return name;
    }

    /**
    /**
     * Get the most recent identified battery level of this Bluetooth device
     * Get the most recent identified battery level of this Bluetooth device
     * <p>Requires {@link android.Manifest.permission#BLUETOOTH}
     * <p>Requires {@link android.Manifest.permission#BLUETOOTH}
+50 −0
Original line number Original line Diff line number Diff line
@@ -324,4 +324,54 @@ public interface BluetoothProfile {
                return "STATE_UNKNOWN";
                return "STATE_UNKNOWN";
        }
        }
    }
    }

    /**
     * Convert an integer value of profile ID into human readable string
     *
     * @param profile profile ID
     * @return profile name as String, UNKOWN_PROFILE if the profile ID is not defined.
     * @hide
     */
    static String getProfileName(int profile) {
        switch(profile) {
            case HEADSET:
                return "HEADSET";
            case A2DP:
                return "A2DP";
            case HID_HOST:
                return "HID_HOST";
            case PAN:
                return "PAN";
            case PBAP:
                return "PBAP";
            case GATT:
                return "GATT";
            case GATT_SERVER:
                return "GATT_SERVER";
            case MAP:
                return "MAP";
            case SAP:
                return "SAP";
            case A2DP_SINK:
                return "A2DP_SINK";
            case AVRCP_CONTROLLER:
                return "AVRCP_CONTROLLER";
            case AVRCP:
                return "AVRCP";
            case HEADSET_CLIENT:
                return "HEADSET_CLIENT";
            case PBAP_CLIENT:
                return "PBAP_CLIENT";
            case MAP_CLIENT:
                return "MAP_CLIENT";
            case HID_DEVICE:
                return "HID_DEVICE";
            case OPP:
                return "OPP";
            case HEARING_AID:
                return "HEARING_AID";
            default:
                return "UNKNOWN_PROFILE";
        }
    }
}
}