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

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

Snap for 8909196 from eabc3781 to tm-qpr1-release

Change-Id: Id534bf322513bac7c4ca787efc873eb7d529da9f
parents ce19b770 eabc3781
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -1307,8 +1307,8 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
                        appParamValue.ignorefilter ? null : appParamValue.propertySelector);
                return pushBytes(op, ownerVcard);
            } else {
                return mVcardSimManager.composeAndSendSIMPhonebookOneVcard(op, intIndex,
                        vcard21, null, mOrderBy);
                return BluetoothPbapSimVcardManager.composeAndSendSIMPhonebookOneVcard(
                        mContext, op, intIndex, vcard21, null, mOrderBy);
            }
        } else {
            if (intIndex <= 0 || intIndex > size) {
@@ -1425,12 +1425,12 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
                if (endPoint == 0) {
                    return pushBytes(op, ownerVcard);
                } else {
                    return mVcardSimManager.composeAndSendSIMPhonebookVcards(op, 1, endPoint,
                        vcard21, ownerVcard);
                    return BluetoothPbapSimVcardManager.composeAndSendSIMPhonebookVcards(
                            mContext, op, 1, endPoint, vcard21, ownerVcard);
                }
            } else {
                return mVcardSimManager.composeAndSendSIMPhonebookVcards(op, startPoint,
                        endPoint, vcard21, null);
                return BluetoothPbapSimVcardManager.composeAndSendSIMPhonebookVcards(
                        mContext, op, startPoint, endPoint, vcard21, null);
            }
        } else {
            return mVcardManager.composeAndSendSelectedCallLogVcards(appParamValue.needTag, op,
+5 −1
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ import android.bluetooth.BluetoothSocket;
import android.bluetooth.IBluetoothPbap;
import android.content.AttributionSource;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
@@ -555,6 +554,11 @@ public class BluetoothPbapService extends ProfileService implements IObexConnect
        return sLocalPhoneNum;
    }

    @VisibleForTesting
    static void setLocalPhoneName(String localPhoneName) {
        sLocalPhoneName = localPhoneName;
    }

    static String getLocalPhoneName() {
        return sLocalPhoneName;
    }
+33 −31
Original line number Diff line number Diff line
@@ -59,22 +59,28 @@ public class BluetoothPbapSimVcardManager {

    private static final boolean V = BluetoothPbapService.VERBOSE;

    private static final String FAILURE_REASON_FAILED_TO_GET_DATABASE_INFO =
    @VisibleForTesting
    public static final String FAILURE_REASON_FAILED_TO_GET_DATABASE_INFO =
        "Failed to get database information";

    private static final String FAILURE_REASON_NO_ENTRY =
    @VisibleForTesting
    public static final String FAILURE_REASON_NO_ENTRY =
        "There's no exportable in the database";

    private static final String FAILURE_REASON_NOT_INITIALIZED =
    @VisibleForTesting
    public static final String FAILURE_REASON_NOT_INITIALIZED =
        "The vCard composer object is not correctly initialized";

    /** Should be visible only from developers... (no need to translate, hopefully) */
    private static final String FAILURE_REASON_UNSUPPORTED_URI =
    @VisibleForTesting
    public static final String FAILURE_REASON_UNSUPPORTED_URI =
        "The Uri vCard composer received is not supported by the composer.";

    private static final String NO_ERROR = "No error";
    @VisibleForTesting
    public static final String NO_ERROR = "No error";

    private final String SIM_URI = "content://icc/adn";
    @VisibleForTesting
    public static final Uri SIM_URI = Uri.parse("content://icc/adn");

    @VisibleForTesting
    public static final String SIM_PATH = "/SIM1/telecom";
@@ -86,8 +92,10 @@ public class BluetoothPbapSimVcardManager {
        CommonDataKinds.Phone.LABEL
    };

    private static final int NAME_COLUMN_INDEX = 0;
    private static final int NUMBER_COLUMN_INDEX = 1;
    @VisibleForTesting
    public static final int NAME_COLUMN_INDEX = 0;
    @VisibleForTesting
    public static final int NUMBER_COLUMN_INDEX = 1;
    private static final int NUMBERTYPE_COLUMN_INDEX = 2;
    private static final int NUMBERLABEL_COLUMN_INDEX = 3;

@@ -105,15 +113,13 @@ public class BluetoothPbapSimVcardManager {

    public boolean init(final Uri contentUri, final String selection,
            final String[] selectionArgs, final String sortOrder) {
            final Uri myUri = Uri.parse(SIM_URI);
        if (!myUri.equals(contentUri)) {

        if (!SIM_URI.equals(contentUri)) {
            mErrorReason = FAILURE_REASON_UNSUPPORTED_URI;
            return false;
        }

        //checkpoint Figure out if we can apply selection, projection and sort order.
        mCursor = mContentResolver.query(
        mCursor = BluetoothPbapMethodProxy.getInstance().contentResolverQuery(mContentResolver,
                contentUri, SIM_PROJECTION, null, null, sortOrder);

        if (mCursor == null) {
@@ -234,7 +240,7 @@ public class BluetoothPbapSimVcardManager {
        return mErrorReason;
    }

    public void setPositionByAlpha(int position) {
    private void setPositionByAlpha(int position) {
        if(mCursor == null) {
            return;
        }
@@ -264,11 +270,11 @@ public class BluetoothPbapSimVcardManager {
    }

    public final int getSIMContactsSize() {
        final Uri myUri = Uri.parse(SIM_URI);
        int size = 0;
        Cursor contactCursor = null;
        try {
            contactCursor = mContentResolver.query(myUri, SIM_PROJECTION, null,null, null);
            contactCursor = BluetoothPbapMethodProxy.getInstance().contentResolverQuery(
                    mContentResolver, SIM_URI, SIM_PROJECTION, null,null, null);
            if (contactCursor != null) {
                size = contactCursor.getCount();
            }
@@ -285,10 +291,10 @@ public class BluetoothPbapSimVcardManager {
        nameList.add(BluetoothPbapService.getLocalPhoneName());
        //Since owner card should always be 0.vcf, maintain a separate list to avoid sorting
        ArrayList<String> allnames = new ArrayList<String>();
        final Uri myUri = Uri.parse(SIM_URI);
        Cursor contactCursor = null;
        try {
            contactCursor = mContentResolver.query(myUri, SIM_PROJECTION, null,null,null);
            contactCursor = BluetoothPbapMethodProxy.getInstance().contentResolverQuery(
                    mContentResolver, SIM_URI, SIM_PROJECTION, null,null,null);
            if (contactCursor != null) {
                for (contactCursor.moveToFirst(); !contactCursor.isAfterLast(); contactCursor
                        .moveToNext()) {
@@ -326,11 +332,10 @@ public class BluetoothPbapSimVcardManager {
        ArrayList<String> nameList = new ArrayList<String>();
        ArrayList<String> startNameList = new ArrayList<String>();
        Cursor contactCursor = null;
        final Uri uri = Uri.parse(SIM_URI);

        try {
            contactCursor = mContentResolver.query(uri, SIM_PROJECTION,
                    null, null, null);
            contactCursor = BluetoothPbapMethodProxy.getInstance().contentResolverQuery(
                    mContentResolver, SIM_URI, SIM_PROJECTION, null, null, null);

            if (contactCursor != null) {
                for (contactCursor.moveToFirst(); !contactCursor.isAfterLast(); contactCursor
@@ -374,21 +379,20 @@ public class BluetoothPbapSimVcardManager {
        return nameList;
    }

    public final int composeAndSendSIMPhonebookVcards(Operation op,
    public static final int composeAndSendSIMPhonebookVcards(Context context, Operation op,
            final int startPoint, final int endPoint, final boolean vcardType21,
            String ownerVCard) {
        if (startPoint < 1 || startPoint > endPoint) {
            Log.e(TAG, "internal error: startPoint or endPoint is not correct.");
            return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
        }
        final Uri myUri = Uri.parse(SIM_URI);
        BluetoothPbapSimVcardManager composer = null;
        HandlerForStringBuffer buffer = null;
        try {
            composer = new BluetoothPbapSimVcardManager(mContext);
            composer = new BluetoothPbapSimVcardManager(context);
            buffer = new HandlerForStringBuffer(op, ownerVCard);

            if (!composer.init(myUri, null, null, null) || !buffer.onInit(mContext)) {
            if (!composer.init(SIM_URI, null, null, null) || !buffer.onInit(context)) {
                return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
            }
            composer.moveToPosition(startPoint -1, false);
@@ -420,7 +424,7 @@ public class BluetoothPbapSimVcardManager {
    /**
     * Handler to emit vCards to PCE.
     */
    public class HandlerForStringBuffer {
    public static class HandlerForStringBuffer {
        private Operation operation;

        private OutputStream outputStream;
@@ -473,22 +477,20 @@ public class BluetoothPbapSimVcardManager {
        }
    }

    public final int composeAndSendSIMPhonebookOneVcard(Operation op,
    public static final int composeAndSendSIMPhonebookOneVcard(Context context, Operation op,
            final int offset, final boolean vcardType21, String ownerVCard,
            int orderByWhat) {
        if (offset < 1) {
            Log.e(TAG, "Internal error: offset is not correct.");
            return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
        }
        final Uri myUri = Uri.parse(SIM_URI);
        if (V) Log.v(TAG, "composeAndSendSIMPhonebookOneVcard orderByWhat " + orderByWhat);
        BluetoothPbapSimVcardManager composer = null;
        HandlerForStringBuffer buffer = null;
        try {
            composer = new BluetoothPbapSimVcardManager(mContext);
            composer = new BluetoothPbapSimVcardManager(context);
            buffer = new HandlerForStringBuffer(op, ownerVCard);
            if (!composer.init(myUri, null, null,null)||
                               !buffer.onInit(mContext)) {
            if (!composer.init(SIM_URI, null, null, null) || !buffer.onInit(context)) {
                return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
            }
            if (orderByWhat == BluetoothPbapObexServer.ORDER_BY_INDEXED) {
+446 −0

File added.

Preview size limit exceeded, changes collapsed.

+14 −0
Original line number Diff line number Diff line
@@ -8,6 +8,20 @@
        {
            "name": "Ringtone",
            "configurations": [
                "DualDev_OneChanStereoSnk_OneChanStereoSrc_32_2_Server_Preferred",
                "DualDev_OneChanStereoSnk_OneChanStereoSrc_32_2_1",
                "DualDev_OneChanStereoSnk_OneChanMonoSrc_32_2_Server_Preferred",
                "DualDev_OneChanStereoSnk_OneChanMonoSrc_32_2_1",
                "DualDev_OneChanDoubleStereoSnk_OneChanMonoSrc_32_2_Server_Preferred",
                "DualDev_OneChanDoubleStereoSnk_OneChanMonoSrc_32_2_1",
                "SingleDev_TwoChanStereoSnk_TwoChanStereoSrc_32_2_Server_Preferred",
                "SingleDev_TwoChanStereoSnk_TwoChanStereoSrc_32_2_1",
                "SingleDev_TwoChanStereoSnk_OneChanMonoSrc_32_2_Server_Preferred",
                "SingleDev_TwoChanStereoSnk_OneChanMonoSrc_32_2_1",
                "SingleDev_OneChanStereoSnk_OneChanMonoSrc_32_2_Server_Preferred",
                "SingleDev_OneChanStereoSnk_OneChanMonoSrc_32_2_1",
                "SingleDev_OneChanMonoSnk_OneChanMonoSrc_32_2_Server_Preferred",
                "SingleDev_OneChanMonoSnk_OneChanMonoSrc_32_2_1",
                "DualDev_OneChanStereoSnk_16_2_Server_Preferred",
                "DualDev_OneChanStereoSnk_16_2_1",
                "DualDev_OneChanStereoSnk_16_1_Server_Preferred",
Loading