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

Commit de733c54 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "MAP: Get MAS version by system property" am: 964d7e24 am: dd70ae62

Change-Id: I42869616212800c30f26d0644cb33d414c36d467
parents 7b6c83c0 dd70ae62
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -315,7 +315,7 @@ public class BluetoothMapContentObserver {

    public void setObserverRemoteFeatureMask(int remoteSupportedFeatures) {
        mMapSupportedFeatures =
                remoteSupportedFeatures & BluetoothMapMasInstance.SDP_MAP_MAS_FEATURES;
                remoteSupportedFeatures & BluetoothMapMasInstance.getFeatureMask();
        if ((BluetoothMapUtils.MAP_FEATURE_EXTENDED_EVENT_REPORT_11_BIT & mMapSupportedFeatures)
                != 0) {
            mMapEventReportVersion = BluetoothMapUtils.MAP_EVENT_REPORT_V11;
+37 −4
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.os.RemoteException;
import android.os.SystemProperties;
import android.util.Log;

import com.android.bluetooth.BluetoothObexTransport;
@@ -51,10 +52,16 @@ public class BluetoothMapMasInstance implements IObexConnectionHandler {
    private static final int SDP_MAP_MSG_TYPE_MMS = 0x08;
    private static final int SDP_MAP_MSG_TYPE_IM = 0x10;

    private static final int SDP_MAP_MAS_VERSION = 0x0104;
    private static final String BLUETOOTH_MAP_VERSION_PROPERTY = "persist.bluetooth.mapversion";

    private static final int SDP_MAP_MAS_VERSION_1_2 = 0x0102;
    private static final int SDP_MAP_MAS_VERSION_1_3 = 0x0103;
    private static final int SDP_MAP_MAS_VERSION_1_4 = 0x0104;

    /* TODO: Should these be adaptive for each MAS? - e.g. read from app? */
    static final int SDP_MAP_MAS_FEATURES = 0x603ff;
    static final int SDP_MAP_MAS_FEATURES_1_2 = 0x0000007F;
    static final int SDP_MAP_MAS_FEATURES_1_3 = 0x000603FF;
    static final int SDP_MAP_MAS_FEATURES_1_4 = 0x000603FF;

    private ServerSession mServerSession = null;
    // The handle to the socket registration with SDP
@@ -99,6 +106,7 @@ public class BluetoothMapMasInstance implements IObexConnectionHandler {
            new HashMap<Long, BluetoothMapConvoListingElement>();

    private int mRemoteFeatureMask = BluetoothMapUtils.MAP_FEATURE_DEFAULT_BITMASK;
    private static int sFeatureMask = SDP_MAP_MAS_FEATURES_1_2;

    public static final String TYPE_SMS_MMS_STR = "SMS/MMS";
    public static final String TYPE_EMAIL_STR = "EMAIL";
@@ -339,9 +347,30 @@ public class BluetoothMapMasInstance implements IObexConnectionHandler {
            }
        }

        final String currentValue = SystemProperties.get(BLUETOOTH_MAP_VERSION_PROPERTY, "map12");
        int masVersion;

        switch (currentValue) {
            case "map12":
                masVersion = SDP_MAP_MAS_VERSION_1_2;
                sFeatureMask = SDP_MAP_MAS_FEATURES_1_2;
                break;
            case "map13":
                masVersion = SDP_MAP_MAS_VERSION_1_3;
                sFeatureMask = SDP_MAP_MAS_FEATURES_1_3;
                break;
            case "map14":
                masVersion = SDP_MAP_MAS_VERSION_1_4;
                sFeatureMask = SDP_MAP_MAS_FEATURES_1_4;
                break;
            default:
                masVersion = SDP_MAP_MAS_VERSION_1_2;
                sFeatureMask = SDP_MAP_MAS_FEATURES_1_2;
        }

        return SdpManager.getDefaultManager()
                .createMapMasRecord(masName, mMasInstanceId, rfcommChannel, l2capPsm,
                        SDP_MAP_MAS_VERSION, messageTypeFlags, SDP_MAP_MAS_FEATURES);
                        masVersion, messageTypeFlags, sFeatureMask);
    }

    /* Called for all MAS instances for each instance when auth. is completed, hence
@@ -455,7 +484,7 @@ public class BluetoothMapMasInstance implements IObexConnectionHandler {
        if (V) {
            Log.v(mTag, "setRemoteFeatureMask : Curr: " + mRemoteFeatureMask);
        }
        mRemoteFeatureMask = supportedFeatures & SDP_MAP_MAS_FEATURES;
        mRemoteFeatureMask = supportedFeatures & sFeatureMask;
        BluetoothMapUtils.savePeerSupportUtcTimeStamp(mRemoteFeatureMask);
        if (mObserver != null) {
            mObserver.setObserverRemoteFeatureMask(mRemoteFeatureMask);
@@ -470,6 +499,10 @@ public class BluetoothMapMasInstance implements IObexConnectionHandler {
        return this.mRemoteFeatureMask;
    }

    public static int getFeatureMask() {
        return sFeatureMask;
    }

    @Override
    public synchronized boolean onConnect(BluetoothDevice device, BluetoothSocket socket) {
        if (!mAcceptNewConnections) {