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

Commit c422a7c0 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Remove new added hidden calls in Bt" am: 2f97b037

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1965498

Change-Id: Ibd415d7e7317f4be38281fde5e51c17843c703e6
parents e5fdb453 2f97b037
Loading
Loading
Loading
Loading
+12 −17
Original line number Diff line number Diff line
@@ -94,7 +94,6 @@ import android.sysprop.BluetoothProperties;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
import android.util.Slog;
import android.util.SparseArray;

import com.android.bluetooth.BluetoothMetricsProto;
@@ -1283,10 +1282,8 @@ public class AdapterService extends Service {
            PendingIntent pendingIntent,
            AttributionSource attributionSource) {
        if (mBluetoothServerSockets.containsKey(uuid.getUuid())) {
            Slog.d(TAG,
                    String.format(
                            "Cannot start RFCOMM listener: UUID %s already in use.",
                            uuid.getUuid()));
            Log.d(TAG, String.format(
                        "Cannot start RFCOMM listener: UUID %s already in use.", uuid.getUuid()));
            return BluetoothStatusCodes.RFCOMM_LISTENER_START_FAILED_UUID_IN_USE;
        }

@@ -1304,10 +1301,8 @@ public class AdapterService extends Service {
        RfcommListenerData listenerData = mBluetoothServerSockets.get(uuid.getUuid());

        if (listenerData == null) {
            Slog.d(TAG,
                    String.format(
                            "Cannot stop RFCOMM listener: UUID %s is not registered.",
                            uuid.getUuid()));
            Log.d(TAG, String.format(
                        "Cannot stop RFCOMM listener: UUID %s is not registered.", uuid.getUuid()));
            return BluetoothStatusCodes.RFCOMM_LISTENER_OPERATION_FAILED_NO_MATCHING_SERVICE_RECORD;
        }

@@ -1346,7 +1341,7 @@ public class AdapterService extends Service {
            return socketInfo;
        }

        mHandler.removeCallbacksAndEqualMessages(socket);
        mHandler.removeCallbacksAndMessages(socket);

        socketInfo.bluetoothDevice = socket.getRemoteDevice();
        socketInfo.pfd = socket.getParcelFileDescriptor();
@@ -1365,7 +1360,7 @@ public class AdapterService extends Service {
                if (mBluetoothServerSockets.containsKey(uuid)) {
                    // The uuid still being in the map indicates that the accept failure is
                    // unexpected. Try and restart the listener.
                    Slog.e(TAG, "Failed to accept socket on " + listenerData.mServerSocket, e);
                    Log.e(TAG, "Failed to accept socket on " + listenerData.mServerSocket, e);
                    restartRfcommListener(listenerData, uuid);
                }
                return;
@@ -1375,7 +1370,7 @@ public class AdapterService extends Service {
            try {
                listenerData.mPendingIntent.send();
            } catch (PendingIntent.CanceledException e) {
                Slog.e(TAG, "PendingIntent for RFCOMM socket notifications cancelled.", e);
                Log.e(TAG, "PendingIntent for RFCOMM socket notifications cancelled.", e);
                // The pending intent was cancelled, close the server as there is no longer any way
                // to notify the app that registered the listener.
                listenerData.closeServerAndPendingSockets(mHandler);
@@ -1399,7 +1394,7 @@ public class AdapterService extends Service {
                    listenerData.mPendingIntent,
                    listenerData.mAttributionSource);
        } catch (IOException e) {
            Slog.e(TAG, "Failed to recreate rfcomm server socket", e);
            Log.e(TAG, "Failed to recreate rfcomm server socket", e);

            mBluetoothServerSockets.remove(uuid);
        }
@@ -1412,7 +1407,7 @@ public class AdapterService extends Service {
            try {
                socket.close();
            } catch (IOException e) {
                Slog.e(TAG, "Failed to close bt socket", e);
                Log.e(TAG, "Failed to close bt socket", e);
                // We don't care if closing the socket failed, just continue on.
            }
        }
@@ -1471,16 +1466,16 @@ public class AdapterService extends Service {
            try {
                mServerSocket.close();
            } catch (IOException e) {
                Slog.e(TAG, "Failed to call close on rfcomm server socket", e);
                Log.e(TAG, "Failed to call close on rfcomm server socket", e);
                result = BluetoothStatusCodes.RFCOMM_LISTENER_FAILED_TO_CLOSE_SERVER_SOCKET;
            }
            mPendingSockets.forEach(
                    pendingSocket -> {
                        handler.removeCallbacksAndEqualMessages(pendingSocket);
                        handler.removeCallbacksAndMessages(pendingSocket);
                        try {
                            pendingSocket.close();
                        } catch (IOException e) {
                            Slog.e(TAG, "Failed to close socket", e);
                            Log.e(TAG, "Failed to close socket", e);
                        }
                    });
            mPendingSockets.clear();
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ public class LeAudioBroadcasterNativeInterface {
    private LeAudioBroadcasterNativeInterface() {
        mAdapter = BluetoothAdapter.getDefaultAdapter();
        if (mAdapter == null) {
            Log.wtfStack(TAG, "No Bluetooth Adapter Available");
            Log.wtf(TAG, "No Bluetooth Adapter Available");
        }
    }