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

Commit 5f3babb3 authored by William Escande's avatar William Escande Committed by Automerger Merge Worker
Browse files

Merge changes Ie931ff50,I202c2f54,I6a49a8ef,I60c58853,If2d7b3cb am: a8af4945...

Merge changes Ie931ff50,I202c2f54,I6a49a8ef,I60c58853,If2d7b3cb am: a8af4945 am: 6d81175e am: 761d295f am: ec5fc6bc

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



Change-Id: I7ed0443d5789126d7e6eb312f5286ba425634d9e
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents a1967333 ec5fc6bc
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@ package com.android.bluetooth;

import android.bluetooth.BluetoothSocket;
import android.os.Handler;
import android.os.Handler.Callback;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
@@ -35,7 +34,7 @@ import java.io.IOException;
 *
 * Will reject the OBEX connection, start a timer, and at timeout close the socket.
 */
public class ObexRejectServer extends ServerRequestHandler implements Callback {
public class ObexRejectServer extends ServerRequestHandler implements Handler.Callback {

    private static final String TAG = "ObexRejectServer";
    private static final boolean V = true;
+8 −8
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
*/
package com.android.bluetooth;

import android.annotation.RequiresPermission;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothServerSocket;
@@ -24,6 +25,7 @@ import com.android.obex.ResponseCodes;
import com.android.obex.ServerSession;

import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * Wraps multiple BluetoothServerSocket objects to make it possible to accept connections on
@@ -48,7 +50,6 @@ public class ObexServerSockets {
    private final String mTag;
    private static final String STAG = "ObexServerSockets";
    private static final boolean D = true; // TODO: set to false!
    private static final int NUMBER_OF_SOCKET_TYPES = 2; // increment if LE will be supported

    private final IObexConnectionHandler mConHandler;
    /* The wrapped sockets */
@@ -58,14 +59,14 @@ public class ObexServerSockets {
    private SocketAcceptThread mRfcommThread;
    private SocketAcceptThread mL2capThread;

    private static volatile int sInstanceCounter;
    private static volatile AtomicInteger sInstanceCounter = new AtomicInteger(0);

    private ObexServerSockets(IObexConnectionHandler conHandler, BluetoothServerSocket rfcommSocket,
            BluetoothServerSocket l2capSocket) {
        mConHandler = conHandler;
        mRfcommSocket = rfcommSocket;
        mL2capSocket = l2capSocket;
        mTag = "ObexServerSockets" + sInstanceCounter++;
        mTag = "ObexServerSockets" + sInstanceCounter.getAndIncrement();
    }

    /**
@@ -73,8 +74,8 @@ public class ObexServerSockets {
     * @param validator a reference to the {@link IObexConnectionHandler} object to call
     *                  to validate an incoming connection.
     * @return a reference to a {@link ObexServerSockets} object instance.
     * @throws IOException if it occurs while creating the {@link BluetoothServerSocket}s.
     */
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    public static ObexServerSockets create(IObexConnectionHandler validator) {
        return create(validator, BluetoothAdapter.SOCKET_CHANNEL_AUTO_STATIC_NO_SDP,
                BluetoothAdapter.SOCKET_CHANNEL_AUTO_STATIC_NO_SDP, true);
@@ -86,8 +87,8 @@ public class ObexServerSockets {
     * @param validator a reference to the {@link IObexConnectionHandler} object to call
     *                  to validate an incoming connection.
     * @return a reference to a {@link ObexServerSockets} object instance.
     * @throws IOException if it occurs while creating the {@link BluetoothServerSocket}s.
     */
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    public static ObexServerSockets createInsecure(IObexConnectionHandler validator) {
        return create(validator, BluetoothAdapter.SOCKET_CHANNEL_AUTO_STATIC_NO_SDP,
                BluetoothAdapter.SOCKET_CHANNEL_AUTO_STATIC_NO_SDP, false);
@@ -104,11 +105,11 @@ public class ObexServerSockets {
     *                  to validate an incoming connection.
     * @param isSecure boolean flag to determine whther socket would be secured or inseucure.
     * @return a reference to a {@link ObexServerSockets} object instance.
     * @throws IOException if it occurs while creating the {@link BluetoothServerSocket}s.
     *
     * TODO: Make public when it becomes possible to determine that the listen-call
     *       failed due to channel-in-use.
     */
    @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT)
    private static ObexServerSockets create(IObexConnectionHandler validator, int rfcommChannel,
            int l2capPsm, boolean isSecure) {
        if (D) {
@@ -292,8 +293,7 @@ public class ObexServerSockets {
        /**
         * Create a SocketAcceptThread
         * @param serverSocket shall never be null.
         * @param latch shall never be null.
         * @throws IllegalArgumentException
         * @throws IllegalArgumentException if {@code serverSocket} is null
         */
        SocketAcceptThread(BluetoothServerSocket serverSocket) {
            if (serverSocket == null) {
+12 −4
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.bluetooth;
import com.android.bluetooth.map.BluetoothMapUtils;

import java.io.UnsupportedEncodingException;
import java.util.Objects;

/**
 * Class to represent a 128bit value using two long member variables.
@@ -40,11 +41,13 @@ public class SignedLongLong implements Comparable<SignedLongLong> {
     * Create a SignedLongLong from a Hex-String without "0x" prefix
     * @param value the hex-string
     * @return the created object
     * @throws UnsupportedEncodingException
     * @throws UnsupportedEncodingException if "US-ASCII" charset is not supported,
     * @throws NullPointerException if the string {@code value} is null,
     * @throws NumberFormatException if the string {@code value} contains invalid characters.
     */
    public static SignedLongLong fromString(String value) throws UnsupportedEncodingException {
        String lsbStr, msbStr;
        long lsb = 0, msb = 0;
        long msb = 0;

        lsbStr = msbStr = null;
        if (value == null) {
@@ -62,7 +65,7 @@ public class SignedLongLong implements Comparable<SignedLongLong> {
            msbStr = value.substring(0, valueLength - 16);
            msb = BluetoothMapUtils.getLongFromString(msbStr);
        }
        lsb = BluetoothMapUtils.getLongFromString(lsbStr);
        long lsb = BluetoothMapUtils.getLongFromString(lsbStr);
        return new SignedLongLong(lsb, msb);
    }

@@ -104,7 +107,7 @@ public class SignedLongLong implements Comparable<SignedLongLong> {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
        if (!(obj instanceof SignedLongLong)) {
            return false;
        }
        SignedLongLong other = (SignedLongLong) obj;
@@ -117,6 +120,11 @@ public class SignedLongLong implements Comparable<SignedLongLong> {
        return true;
    }

    @Override
    public int hashCode() {
        return Objects.hash(mLeastSigBits, mMostSigBits);
    }

    public long getMostSignificantBits() {
        return mMostSigBits;
    }
+1 −2
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ import android.util.SparseIntArray;
 * the GSM SMS 7-bit alphabet specified in TS 23.038 6.2.1
 * and UTF-16
 *
 * {@hide}
 * @hide
 */
public class GsmAlphabet {
    private static final String TAG = "GSM";
@@ -309,7 +309,6 @@ public class GsmAlphabet {

    /**
     * Enable country-specific language tables from MCC-specific overlays.
     * @context the context to use to get the TelephonyManager
     */
    private static void enableCountrySpecificEncodings() {
        Resources r = Resources.getSystem();
+4 −1
Original line number Diff line number Diff line
@@ -845,5 +845,8 @@ public final class BluetoothSocket implements Closeable {
        return ret;
    }


    @Override
    public String toString() {
        return BluetoothUtils.toAnonymizedAddress(mAddress);
    }
}
Loading