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

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

Snap for 6157842 from 9a294d249cd4c27d8321556eef546933597fc5b9 to rvc-release

Change-Id: I3250d8d05fe3ccf9aa9409883a26a11679604ae0
parents 77c99209 f4370cb3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1222,6 +1222,7 @@ public final class BluetoothAdapter {
            if (mService != null) {
                return mService.factoryReset();
            }
            Log.e(TAG, "factoryReset(): IBluetooth Service is null");
            SystemProperties.set("persist.bluetooth.factoryreset", "true");
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
@@ -1239,7 +1240,7 @@ public final class BluetoothAdapter {
     */
    @UnsupportedAppUsage
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    public @NonNull ParcelUuid[] getUuids() {
    public @Nullable ParcelUuid[] getUuids() {
        if (getState() != STATE_ON) {
            return null;
        }
+18 −4
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import android.content.Context;
import android.os.Binder;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.CloseGuard;
import android.util.Log;

import java.lang.annotation.Retention;
@@ -50,10 +51,11 @@ import java.util.List;
 * @hide
 */
@SystemApi
public final class BluetoothPan implements BluetoothProfile {
public final class BluetoothPan implements BluetoothProfile, AutoCloseable {
    private static final String TAG = "BluetoothPan";
    private static final boolean DBG = true;
    private static final boolean VDBG = false;
    private CloseGuard mCloseGuard;

    /**
     * Intent used to broadcast the change in connection state of the Pan
@@ -166,10 +168,15 @@ public final class BluetoothPan implements BluetoothProfile {
        mAdapter = BluetoothAdapter.getDefaultAdapter();
        mContext = context;
        mProfileConnector.connect(context, listener);
        mCloseGuard = new CloseGuard();
        mCloseGuard.open("close");
    }

    @UnsupportedAppUsage
    /*package*/ void close() {
    /**
     * Closes the connection to the service and unregisters callbacks
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    public void close() {
        if (VDBG) log("close()");
        mProfileConnector.disconnect();
    }
@@ -178,8 +185,11 @@ public final class BluetoothPan implements BluetoothProfile {
        return mProfileConnector.getService();
    }


    @RequiresPermission(Manifest.permission.BLUETOOTH)
    protected void finalize() {
        if (mCloseGuard != null) {
            mCloseGuard.warnIfOpen();
        }
        close();
    }

@@ -316,6 +326,7 @@ public final class BluetoothPan implements BluetoothProfile {
     * @hide
     */
    @Override
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    public List<BluetoothDevice> getDevicesMatchingConnectionStates(int[] states) {
        if (VDBG) log("getDevicesMatchingStates()");
        final IBluetoothPan service = getService();
@@ -335,6 +346,7 @@ public final class BluetoothPan implements BluetoothProfile {
     * {@inheritDoc}
     */
    @Override
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    public int getConnectionState(@Nullable BluetoothDevice device) {
        if (VDBG) log("getState(" + device + ")");
        final IBluetoothPan service = getService();
@@ -355,6 +367,7 @@ public final class BluetoothPan implements BluetoothProfile {
     *
     * @param value is whether to enable or disable bluetooth tethering
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    public void setBluetoothTethering(boolean value) {
        String pkgName = mContext.getOpPackageName();
        if (DBG) log("setBluetoothTethering(" + value + "), calling package:" + pkgName);
@@ -373,6 +386,7 @@ public final class BluetoothPan implements BluetoothProfile {
     *
     * @return true if tethering is on, false if not or some error occurred
     */
    @RequiresPermission(Manifest.permission.BLUETOOTH)
    public boolean isTetheringOn() {
        if (VDBG) log("isTetheringOn()");
        final IBluetoothPan service = getService();