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

Commit af5971ef authored by Zhihai Xu's avatar Zhihai Xu
Browse files

Add debug menu to enable btsnoop

bug: 8059358
Change-Id: I2d5f13e68defefb92e0b11b749fe77ad67215f36
parent c930c4e1
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -598,6 +598,25 @@ public final class BluetoothAdapter {
        return null;
    }

    /**
     * enable or disable Bluetooth HCI snoop log.
     *
     * <p>Requires the {@link android.Manifest.permission#BLUETOOTH_ADMIN}
     * permission
     *
     * @return true to indicate configure HCI log successfully, or false on
     *         immediate error
     * @hide
     */
    public boolean configHciSnoopLog(boolean enable) {
        try {
            synchronized(mManagerCallback) {
                if (mService != null) return mService.configHciSnoopLog(enable);
            }
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return false;
    }

    /**
     * Get the UUIDs supported by the local Bluetooth adapter.
     *
+2 −0
Original line number Diff line number Diff line
@@ -80,4 +80,6 @@ interface IBluetooth
    // For Socket
    ParcelFileDescriptor connectSocket(in BluetoothDevice device, int type, in ParcelUuid uuid, int port, int flag);
    ParcelFileDescriptor createSocketChannel(int type, in String serviceName, in ParcelUuid uuid, int port, int flag);

    boolean configHciSnoopLog(boolean enable);
}
+7 −0
Original line number Diff line number Diff line
@@ -3191,6 +3191,13 @@ public final class Settings {
        public static final String INPUT_METHOD_SELECTOR_VISIBILITY =
                "input_method_selector_visibility";

        /**
         * bluetooth HCI snoop log configuration
         * @hide
         */
        public static final String BLUETOOTH_HCI_LOG =
                "bluetooth_hci_log";

        /**
         * @deprecated Use {@link android.provider.Settings.Global#DEVICE_PROVISIONED} instead
         */
+11 −1
Original line number Diff line number Diff line
@@ -793,6 +793,16 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
                        mBinding = false;
                        mBluetooth = IBluetooth.Stub.asInterface(service);

                        try {
                            boolean enableHciSnoopLog = (Settings.Secure.getInt(mContentResolver,
                                Settings.Secure.BLUETOOTH_HCI_LOG, 0) == 1);
                            if (!mBluetooth.configHciSnoopLog(enableHciSnoopLog)) {
                                Log.e(TAG,"IBluetooth.configHciSnoopLog return false");
                            }
                        } catch (RemoteException e) {
                            Log.e(TAG,"Unable to call configHciSnoopLog", e);
                        }

                        if (mConnection.isGetNameAddressOnly()) {
                            //Request GET NAME AND ADDRESS
                            Message getMsg = mHandler.obtainMessage(MESSAGE_GET_NAME_AND_ADDRESS);