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

Commit cc9aac8b authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 9463735 from c8b0259a to tm-qpr2-release

Change-Id: I981906e3ac1438065229a8118860d30ec8a795b2
parents bb8357a1 c8b0259a
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -16,12 +16,14 @@

package com.android.bluetooth;

import android.annotation.NonNull;
import android.annotation.RequiresPermission;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.le.PeriodicAdvertisingCallback;
import android.bluetooth.le.PeriodicAdvertisingManager;
import android.bluetooth.le.ScanResult;
import android.content.ContentProviderClient;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
@@ -161,6 +163,14 @@ public class BluetoothMethodProxy {
        return contentResolver.openInputStream(uri);
    }

    /**
     * Proxies {@link ContentResolver#acquireUnstableContentProviderClient(String)}.
     */
    public ContentProviderClient contentResolverAcquireUnstableContentProviderClient(
            ContentResolver contentResolver, @NonNull String name) {
        return contentResolver.acquireUnstableContentProviderClient(name);
    }

    /**
     * Proxies {@link Context#sendBroadcast(Intent)}.
     */
+2 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ package com.android.bluetooth.bas;

import static android.bluetooth.BluetoothDevice.PHY_LE_1M_MASK;
import static android.bluetooth.BluetoothDevice.PHY_LE_2M_MASK;
import static android.bluetooth.BluetoothDevice.TRANSPORT_AUTO;
import static android.bluetooth.BluetoothDevice.TRANSPORT_LE;

import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothGatt;
@@ -233,7 +233,7 @@ public class BatteryStateMachine extends StateMachine {
            mBluetoothGatt.close();
        }
        mBluetoothGatt = mDevice.connectGatt(service, /*autoConnect=*/false,
                mGattCallback, TRANSPORT_AUTO, /*opportunistic=*/true,
                mGattCallback, TRANSPORT_LE, /*opportunistic=*/true,
                PHY_LE_1M_MASK | PHY_LE_2M_MASK, getHandler());
        return mBluetoothGatt != null;
    }
+10 −7
Original line number Diff line number Diff line
@@ -157,7 +157,8 @@ public class BluetoothMapContent {
    private final BluetoothMapAccountItem mAccount;
    /* The MasInstance reference is used to update persistent (over a connection) version counters*/
    private final BluetoothMapMasInstance mMasInstance;
    private String mMessageVersion = BluetoothMapUtils.MAP_V10_STR;
    @VisibleForTesting
    String mMessageVersion = BluetoothMapUtils.MAP_V10_STR;

    private int mRemoteFeatureMask = BluetoothMapUtils.MAP_FEATURE_DEFAULT_BITMASK;
    @VisibleForTesting
@@ -4092,8 +4093,8 @@ public class BluetoothMapContent {

        BluetoothMapbMessageEmail message = new BluetoothMapbMessageEmail();
        Uri contentUri = Uri.parse(mBaseUri + BluetoothMapContract.TABLE_MESSAGE);
        Cursor c = mResolver.query(contentUri, BluetoothMapContract.BT_MESSAGE_PROJECTION,
                "_ID = " + id, null, null);
        Cursor c = BluetoothMethodProxy.getInstance().contentResolverQuery(mResolver, contentUri,
                BluetoothMapContract.BT_MESSAGE_PROJECTION, "_ID = " + id, null, null);
        try {
            if (c != null && c.moveToFirst()) {
                BluetoothMapFolderElement folderElement;
@@ -4190,7 +4191,8 @@ public class BluetoothMapContent {
                // Get email message body content
                int count = 0;
                try {
                    fd = mResolver.openFileDescriptor(uri, "r");
                    fd = BluetoothMethodProxy.getInstance().contentResolverOpenFileDescriptor(
                            mResolver, uri, "r");
                    is = new FileInputStream(fd.getFileDescriptor());
                    StringBuilder email = new StringBuilder("");
                    byte[] buffer = new byte[1024];
@@ -4261,8 +4263,8 @@ public class BluetoothMapContent {

        BluetoothMapbMessageMime message = new BluetoothMapbMessageMime();
        Uri contentUri = Uri.parse(mBaseUri + BluetoothMapContract.TABLE_MESSAGE);
        Cursor c = mResolver.query(contentUri, BluetoothMapContract.BT_MESSAGE_PROJECTION,
                "_ID = " + id, null, null);
        Cursor c = BluetoothMethodProxy.getInstance().contentResolverQuery(mResolver, contentUri,
                BluetoothMapContract.BT_MESSAGE_PROJECTION, "_ID = " + id, null, null);
        Cursor contacts = null;
        try {
            if (c != null && c.moveToFirst()) {
@@ -4315,7 +4317,8 @@ public class BluetoothMapContent {
                // FIXME end temp code

                Uri contactsUri = Uri.parse(mBaseUri + BluetoothMapContract.TABLE_CONVOCONTACT);
                contacts = mResolver.query(contactsUri, BluetoothMapContract.BT_CONTACT_PROJECTION,
                contacts = BluetoothMethodProxy.getInstance().contentResolverQuery(mResolver,
                        contactsUri, BluetoothMapContract.BT_CONTACT_PROJECTION,
                        BluetoothMapContract.ConvoContactColumns.CONVO_ID + " = " + threadId, null,
                        null);
                // TODO this will not work for group-chats
+16 −8
Original line number Diff line number Diff line
@@ -143,17 +143,20 @@ public class BluetoothMapContentObserver {
    private int mMasId;
    private boolean mEnableSmsMms = false;
    private boolean mObserverRegistered = false;
    private BluetoothMapAccountItem mAccount;
    @VisibleForTesting
    BluetoothMapAccountItem mAccount;
    private String mAuthority = null;

    // Default supported feature bit mask is 0x1f
    private int mMapSupportedFeatures = BluetoothMapUtils.MAP_FEATURE_DEFAULT_BITMASK;
    // Default event report version is 1.0
    private int mMapEventReportVersion = BluetoothMapUtils.MAP_EVENT_REPORT_V10;
    @VisibleForTesting
    int mMapEventReportVersion = BluetoothMapUtils.MAP_EVENT_REPORT_V10;

    private BluetoothMapFolderElement mFolders = new BluetoothMapFolderElement("DUMMY", null);
    // Will be set by the MAS when generated.
    private Uri mMessageUri = null;
    @VisibleForTesting
    Uri mMessageUri = null;
    @VisibleForTesting
    Uri mContactUri = null;

@@ -1574,7 +1577,8 @@ public class BluetoothMapContentObserver {
        }
    }

    private void handleMsgListChangesMms() {
    @VisibleForTesting
    void handleMsgListChangesMms() {
        if (V) {
            Log.d(TAG, "handleMsgListChangesMms");
        }
@@ -1584,9 +1588,11 @@ public class BluetoothMapContentObserver {
        Cursor c;
        synchronized (getMsgListMms()) {
            if (mMapEventReportVersion == BluetoothMapUtils.MAP_EVENT_REPORT_V10) {
                c = mResolver.query(Mms.CONTENT_URI, MMS_PROJECTION_SHORT, null, null, null);
                c = BluetoothMethodProxy.getInstance().contentResolverQuery(mResolver,
                        Mms.CONTENT_URI, MMS_PROJECTION_SHORT, null, null, null);
            } else {
                c = mResolver.query(Mms.CONTENT_URI, MMS_PROJECTION_SHORT_EXT, null, null, null);
                c = BluetoothMethodProxy.getInstance().contentResolverQuery(mResolver,
                        Mms.CONTENT_URI, MMS_PROJECTION_SHORT_EXT, null, null, null);
            }

            try {
@@ -1742,7 +1748,8 @@ public class BluetoothMapContentObserver {
        }
    }

    private void handleMsgListChangesMsg(Uri uri) throws RemoteException {
    @VisibleForTesting
    void handleMsgListChangesMsg(Uri uri) throws RemoteException {
        if (V) {
            Log.v(TAG, "handleMsgListChangesMsg uri: " + uri.toString());
        }
@@ -1855,7 +1862,8 @@ public class BluetoothMapContentObserver {
                                        && sentFolder.getFolderId() == folderId
                                        && msg.localInitiatedSend) {
                                    if (msg.transparent) {
                                        mResolver.delete(
                                        BluetoothMethodProxy.getInstance().contentResolverDelete(
                                                mResolver,
                                                ContentUris.withAppendedId(mMessageUri, id), null,
                                                null);
                                    } else {
+7 −3
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import com.android.bluetooth.ObexServerSockets;
import com.android.bluetooth.map.BluetoothMapContentObserver.Msg;
import com.android.bluetooth.map.BluetoothMapUtils.TYPE;
import com.android.bluetooth.sdp.SdpManager;
import com.android.internal.annotations.VisibleForTesting;
import com.android.obex.ServerSession;

import java.io.IOException;
@@ -39,8 +40,10 @@ import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;

public class BluetoothMapMasInstance implements IObexConnectionHandler {
    private final String mTag;
    private static volatile int sInstanceCounter = 0;
    @VisibleForTesting
    final String mTag;
    @VisibleForTesting
    static volatile int sInstanceCounter = 0;

    private static final boolean D = BluetoothMapService.DEBUG;
    private static final boolean V = BluetoothMapService.VERBOSE;
@@ -146,7 +149,8 @@ public class BluetoothMapMasInstance implements IObexConnectionHandler {
    }

    /* Needed only for test */
    protected BluetoothMapMasInstance() {
    @VisibleForTesting
    BluetoothMapMasInstance() {
        mTag = "BluetoothMapMasInstance" + sInstanceCounter++;
    }

Loading