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

Commit 4fc751aa authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Start OBEX Client as a function of supported features" into main

parents a91c15d0 abacae6b
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -90,6 +90,9 @@ class PbapClientStateMachine extends StateMachine {
    static final int CONNECT_TIMEOUT = 10000;
    static final int DISCONNECT_TIMEOUT = 3000;

    private static final int LOCAL_SUPPORTED_FEATURES =
            PbapSdpRecord.FEATURE_DEFAULT_IMAGE_FORMAT | PbapSdpRecord.FEATURE_DOWNLOADING;

    private final Object mLock;
    private State mDisconnected;
    private State mConnecting;
@@ -168,6 +171,7 @@ class PbapClientStateMachine extends StateMachine {
                mConnectionHandler =
                        new PbapClientConnectionHandler.Builder()
                                .setLooper(looper)
                                .setLocalSupportedFeatures(LOCAL_SUPPORTED_FEATURES)
                                .setContext(mService)
                                .setClientSM(PbapClientStateMachine.this)
                                .setRemoteDevice(mCurrentDevice)
+9 −4
Original line number Diff line number Diff line
@@ -85,13 +85,11 @@ class PbapClientConnectionHandler extends Handler {
                0x66
            };

    private static final int PBAP_SUPPORTED_FEATURES =
            PbapSdpRecord.FEATURE_DEFAULT_IMAGE_FORMAT | PbapSdpRecord.FEATURE_DOWNLOADING;

    private Account mAccount;
    private AccountManager mAccountManager;
    private BluetoothSocket mSocket;
    private final BluetoothDevice mDevice;
    private final int mLocalSupportedFeatures;
    // PSE SDP Record for current device.
    private PbapSdpRecord mPseRec = null;
    private ClientSession mObexSession;
@@ -108,6 +106,7 @@ class PbapClientConnectionHandler extends Handler {
    PbapClientConnectionHandler(Builder pceHandlerbuild) {
        super(pceHandlerbuild.mLooper);
        mDevice = pceHandlerbuild.mDevice;
        mLocalSupportedFeatures = pceHandlerbuild.mLocalSupportedFeatures;
        mContext = pceHandlerbuild.mContext;
        mPbapClientStateMachine = pceHandlerbuild.mClientStateMachine;
        mAuth = new PbapClientObexAuthenticator();
@@ -123,6 +122,7 @@ class PbapClientConnectionHandler extends Handler {
        private Looper mLooper;
        private Context mContext;
        private BluetoothDevice mDevice;
        private int mLocalSupportedFeatures;
        private PbapClientStateMachine mClientStateMachine;

        public Builder setLooper(Looper loop) {
@@ -130,6 +130,11 @@ class PbapClientConnectionHandler extends Handler {
            return this;
        }

        public Builder setLocalSupportedFeatures(int features) {
            this.mLocalSupportedFeatures = features;
            return this;
        }

        public Builder setClientSM(PbapClientStateMachine clientStateMachine) {
            this.mClientStateMachine = clientStateMachine;
            return this;
@@ -295,7 +300,7 @@ class PbapClientConnectionHandler extends Handler {
                if (mPseRec.getProfileVersion() >= PbapSdpRecord.VERSION_1_2) {
                    oap.add(
                            PbapApplicationParameters.OAP_PBAP_SUPPORTED_FEATURES,
                            PBAP_SUPPORTED_FEATURES);
                            mLocalSupportedFeatures);
                }

                oap.addToHeaderSet(connectionRequest);
+5 −0
Original line number Diff line number Diff line
@@ -56,6 +56,10 @@ public class PbapClientConnectionHandlerTest {
    private static final String TAG = "ConnHandlerTest";
    private static final String REMOTE_DEVICE_ADDRESS = "00:00:00:00:00:00";

    // Normal supported features for our client
    private static final int SUPPORTED_FEATURES =
            PbapSdpRecord.FEATURE_DOWNLOADING | PbapSdpRecord.FEATURE_DEFAULT_IMAGE_FORMAT;

    private HandlerThread mThread;
    private Looper mLooper;
    private Context mTargetContext;
@@ -103,6 +107,7 @@ public class PbapClientConnectionHandlerTest {
        mHandler =
                new PbapClientConnectionHandler.Builder()
                        .setLooper(mLooper)
                        .setLocalSupportedFeatures(SUPPORTED_FEATURES)
                        .setClientSM(mStateMachine)
                        .setContext(mTargetContext)
                        .setRemoteDevice(mRemoteDevice)