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

Commit 921bdf79 authored by Sal Savage's avatar Sal Savage Committed by Automerger Merge Worker
Browse files

Make BluetoothAdapter#disable(boolean persist) a @SystemApi am: f599dc49

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

Change-Id: If15d419a35511cd47ad2f586856abe1af5d2d6ce
parents b3f3826b f599dc49
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -1245,13 +1245,17 @@ public final class BluetoothAdapter {
    /**
     * Turn off the local Bluetooth adapter and don't persist the setting.
     *
     * @param persist Indicate whether the off state should be persisted following the next reboot
     * @return true to indicate adapter shutdown has begun, or false on immediate error
     * @hide
     */
    @UnsupportedAppUsage(trackingBug = 171933273)
    @SystemApi
    @RequiresLegacyBluetoothAdminPermission
    @RequiresBluetoothConnectPermission
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    @RequiresPermission(allOf = {
            android.Manifest.permission.BLUETOOTH_CONNECT,
            android.Manifest.permission.BLUETOOTH_PRIVILEGED,
    })
    public boolean disable(boolean persist) {

        try {
+6 −1
Original line number Diff line number Diff line
@@ -1154,6 +1154,11 @@ class BluetoothManagerService extends IBluetoothManager.Stub {

    public boolean disable(AttributionSource attributionSource, boolean persist)
            throws RemoteException {
        if (!persist) {
            mContext.enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED,
                    "Need BLUETOOTH_PRIVILEGED permission");
        }

        final String packageName = attributionSource.getPackageName();
        if (!checkBluetoothPermissions(attributionSource, "disable", true)) {
            if (DBG) {