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

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

Snap for 8898488 from 30d6d273 to tm-qpr1-release

Change-Id: I6309d9a31a6fd0e4ef42fa2d419f03ac47f4ed56
parents 7a19502f 30d6d273
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.bluetooth.pbap;

import android.content.ContentResolver;
import android.content.Context;
import android.database.Cursor;
import android.net.Uri;
import android.util.Log;
@@ -75,17 +76,16 @@ public class BluetoothPbapMethodProxy {
    }

    /**
     * Proxies {@link HeaderSet#setHeader}.
     * Proxies {@link HeaderSet#getHeader}.
     */
    public void setHeader(HeaderSet headerSet, int headerId, Object headerValue)
            throws IOException {
        headerSet.setHeader(headerId, headerValue);
    public Object getHeader(HeaderSet headerSet, int headerId) throws IOException {
        return headerSet.getHeader(headerId);
    }

    /**
     * Proxies {@link HeaderSet#getHeader}.
     * Proxies {@link Context#getSystemService(Class)}.
     */
    public Object getHeader(HeaderSet headerSet, int headerId) throws IOException {
        return headerSet.getHeader(headerId);
    public <T> T getSystemService(Context context, Class<T> serviceClass) {
        return context.getSystemService(serviceClass);
    }
}
+64 −28
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import android.provider.CallLog.Calls;
import android.text.TextUtils;
import android.util.Log;

import com.android.internal.annotations.VisibleForTesting;
import com.android.obex.ApplicationParameter;
import com.android.obex.HeaderSet;
import com.android.obex.Operation;
@@ -74,7 +75,8 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
    private static final int VCARD_NAME_SUFFIX_LENGTH = 5;

    // 128 bit UUID for PBAP
    private static final byte[] PBAP_TARGET = new byte[]{
    @VisibleForTesting
    public static final byte[] PBAP_TARGET = new byte[]{
            0x79,
            0x61,
            0x35,
@@ -122,39 +124,53 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
    };

    // SIM card
    private static final String SIM1 = "SIM1";
    @VisibleForTesting
    public static final String SIM1 = "SIM1";

    // missed call history
    private static final String MCH = "mch";
    @VisibleForTesting
    public static final String MCH = "mch";

    // incoming call history
    private static final String ICH = "ich";
    @VisibleForTesting
    public static final String ICH = "ich";

    // outgoing call history
    private static final String OCH = "och";
    @VisibleForTesting
    public static final String OCH = "och";

    // combined call history
    private static final String CCH = "cch";
    @VisibleForTesting
    public static final String CCH = "cch";

    // phone book
    private static final String PB = "pb";
    @VisibleForTesting
    public static final String PB = "pb";

    // favorites
    private static final String FAV = "fav";
    @VisibleForTesting
    public static final String FAV = "fav";

    private static final String TELECOM_PATH = "/telecom";
    @VisibleForTesting
    public static final String TELECOM_PATH = "/telecom";

    private static final String ICH_PATH = "/telecom/ich";
    @VisibleForTesting
    public static final String ICH_PATH = "/telecom/ich";

    private static final String OCH_PATH = "/telecom/och";
    @VisibleForTesting
    public static final String OCH_PATH = "/telecom/och";

    private static final String MCH_PATH = "/telecom/mch";
    @VisibleForTesting
    public static final String MCH_PATH = "/telecom/mch";

    private static final String CCH_PATH = "/telecom/cch";
    @VisibleForTesting
    public static final String CCH_PATH = "/telecom/cch";

    private static final String PB_PATH = "/telecom/pb";
    @VisibleForTesting
    public static final String PB_PATH = "/telecom/pb";

    private static final String FAV_PATH = "/telecom/fav";
    @VisibleForTesting
    public static final String FAV_PATH = "/telecom/fav";

    // SIM Support
    private static final String SIM_PATH = "/SIM1/telecom";
@@ -170,16 +186,19 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
    private static final String SIM_PB_PATH = "/SIM1/telecom/pb";

    // type for list vcard objects
    private static final String TYPE_LISTING = "x-bt/vcard-listing";
    @VisibleForTesting
    public static final String TYPE_LISTING = "x-bt/vcard-listing";

    // type for get single vcard object
    private static final String TYPE_VCARD = "x-bt/vcard";
    @VisibleForTesting
    public static final String TYPE_VCARD = "x-bt/vcard";

    // to indicate if need send body besides headers
    private static final int NEED_SEND_BODY = -1;

    // type for download all vcard objects
    private static final String TYPE_PB = "x-bt/phonebook";
    @VisibleForTesting
    public static final String TYPE_PB = "x-bt/phonebook";

    // The number of indexes in the phone book.
    private boolean mNeedPhonebookSize = false;
@@ -281,7 +300,7 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
                    return ResponseCodes.OBEX_HTTP_NOT_ACCEPTABLE;
                }
            }
            mPbapMethodProxy.setHeader(reply, HeaderSet.WHO, uuid);
            reply.setHeader(HeaderSet.WHO, uuid);
        } catch (IOException e) {
            Log.e(TAG, e.toString());
            return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
@@ -293,7 +312,7 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
                if (D) {
                    Log.d(TAG, "onConnect(): remote=" + Arrays.toString(remote));
                }
                mPbapMethodProxy.setHeader(reply, HeaderSet.TARGET, remote);
                reply.setHeader(HeaderSet.TARGET, remote);
            }
        } catch (IOException e) {
            Log.e(TAG, e.toString());
@@ -373,7 +392,7 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
        String currentPathTmp = mCurrentPath;
        String tmpPath = null;
        try {
            tmpPath = (String) request.getHeader(HeaderSet.NAME);
            tmpPath = (String) mPbapMethodProxy.getHeader(request, HeaderSet.NAME);
        } catch (IOException e) {
            Log.e(TAG, "Get name header fail");
            return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
@@ -389,10 +408,14 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
        } else {
            if (tmpPath == null) {
                currentPathTmp = "";
            } else {
                if (tmpPath.startsWith("/")) {
                    currentPathTmp = currentPathTmp + tmpPath;
                } else {
                    currentPathTmp = currentPathTmp + "/" + tmpPath;
                }
            }
        }

        if ((currentPathTmp.length() != 0) && (!isLegalPath(currentPathTmp))) {
            if (create) {
@@ -428,9 +451,10 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
        AppParamValue appParamValue = new AppParamValue();
        try {
            request = op.getReceivedHeader();
            type = (String) request.getHeader(HeaderSet.TYPE);
            name = (String) request.getHeader(HeaderSet.NAME);
            appParam = (byte[]) request.getHeader(HeaderSet.APPLICATION_PARAMETER);
            type = (String) mPbapMethodProxy.getHeader(request, HeaderSet.TYPE);
            name = (String) mPbapMethodProxy.getHeader(request, HeaderSet.NAME);
            appParam = (byte[]) mPbapMethodProxy.getHeader(
                    request, HeaderSet.APPLICATION_PARAMETER);
        } catch (IOException e) {
            Log.e(TAG, "request headers error");
            return ResponseCodes.OBEX_HTTP_INTERNAL_ERROR;
@@ -449,7 +473,7 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
            return ResponseCodes.OBEX_HTTP_NOT_ACCEPTABLE;
        }

        if (!mContext.getSystemService(UserManager.class).isUserUnlocked()) {
        if (!mPbapMethodProxy.getSystemService(mContext, UserManager.class).isUserUnlocked()) {
            Log.e(TAG, "Storage locked, " + type + " failed");
            return ResponseCodes.OBEX_HTTP_UNAVAILABLE;
        }
@@ -612,7 +636,8 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
        return false;
    }

    private class AppParamValue {
    @VisibleForTesting
    public static class AppParamValue {
        public int maxListCount;

        public int listStartOffset;
@@ -645,7 +670,7 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {

        public byte[] callHistoryVersionCounter;

        AppParamValue() {
        public AppParamValue() {
            maxListCount = 0xFFFF;
            listStartOffset = 0;
            searchValue = "";
@@ -1594,4 +1619,15 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
        return ((ByteBuffer.wrap(mConnAppParamValue.supportedFeature).getInt() & featureBitMask)
                != 0);
    }

    @VisibleForTesting
    public void setCurrentPath(String path) {
        mCurrentPath = path != null ? path : "";
    }

    @VisibleForTesting
    public void setConnAppParamValue(AppParamValue connAppParamValue) {
        mConnAppParamValue = connAppParamValue;
    }

}
+5 −1
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@ import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteException;
import android.net.Uri;

import com.android.internal.annotations.VisibleForTesting;
import com.android.vcard.VCardBuilder;
import com.android.vcard.VCardConfig;
import com.android.vcard.VCardConstants;
@@ -73,7 +75,9 @@ public class BluetoothPbapSimVcardManager {
    private static final String NO_ERROR = "No error";

    private final String SIM_URI = "content://icc/adn";
    private final  String SIM_PATH = "/SIM1/telecom";

    @VisibleForTesting
    public static final String SIM_PATH = "/SIM1/telecom";

    private static final String[] SIM_PROJECTION = new String[] {
        Contacts.DISPLAY_NAME,
+3 −1
Original line number Diff line number Diff line
@@ -278,7 +278,9 @@ public class BluetoothPbapVcardManager {
        if (ownerName == null || ownerName.length() == 0) {
            ownerName = BluetoothPbapService.getLocalPhoneName();
        }
        if (ownerName != null) {
            nameList.add(ownerName);
        }
        //End enhancement

        final Uri myUri = DevicePolicyUtils.getEnterprisePhoneUri(mContext);
+352 −57

File changed.

Preview size limit exceeded, changes collapsed.

Loading