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

Commit d27a4375 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 4486962 from 5c9c9041 to pi-release

Change-Id: I052f0d4c3c6f925254283f14d48fe5e58e9cab4b
parents 56ac2bd1 5c9c9041
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.bluetooth.hid;

import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothHidDevice;
import android.bluetooth.BluetoothHidDeviceAppConfiguration;
import android.bluetooth.BluetoothHidDeviceAppQosSettings;
import android.bluetooth.BluetoothHidDeviceAppSdpSettings;
import android.bluetooth.BluetoothProfile;
@@ -94,8 +93,7 @@ public class HidDeviceService extends ProfileService {

                    try {
                        if (mCallback != null) {
                            // TODO(hsz) remove AppConfig in frameworks/base in the follow-up CL
                            mCallback.onAppStatusChanged(device, null, success);
                            mCallback.onAppStatusChanged(device, success);
                        } else {
                            break;
                        }
@@ -283,9 +281,9 @@ public class HidDeviceService extends ProfileService {
        }

        @Override
        public boolean registerApp(BluetoothHidDeviceAppConfiguration config,
                BluetoothHidDeviceAppSdpSettings sdp, BluetoothHidDeviceAppQosSettings inQos,
                BluetoothHidDeviceAppQosSettings outQos, IBluetoothHidDeviceCallback callback) {
        public boolean registerApp(BluetoothHidDeviceAppSdpSettings sdp,
                BluetoothHidDeviceAppQosSettings inQos, BluetoothHidDeviceAppQosSettings outQos,
                IBluetoothHidDeviceCallback callback) {
            if (DBG) {
                Log.d(TAG, "registerApp()");
            }
@@ -299,7 +297,7 @@ public class HidDeviceService extends ProfileService {
        }

        @Override
        public boolean unregisterApp(BluetoothHidDeviceAppConfiguration config) {
        public boolean unregisterApp() {
            if (DBG) {
                Log.d(TAG, "unregisterApp()");
            }
+3 −2
Original line number Diff line number Diff line
@@ -410,8 +410,9 @@ public class BluetoothMapMasInstance implements IObexConnectionHandler {
        removeSdpRecord();

        closeConnectionSocket();

        closeServerSockets(true);
        // Do not block for Accept thread cleanup.
        // Fix Handler Thread block during BT Turn OFF.
        closeServerSockets(false);
    }

    /**
+8 −8
Original line number Diff line number Diff line
@@ -1174,9 +1174,6 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
        }

        try {
            // Open the OBEX body stream
            outStream = op.openOutputStream();

            if (appParams.getMaxListCount() == BluetoothMapAppParams.INVALID_VALUE_PARAMETER) {
                appParams.setMaxListCount(1024);
            }
@@ -1229,6 +1226,8 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
            replyHeaders.setHeader(HeaderSet.APPLICATION_PARAMETER, outAppParams.encodeParams());
            op.sendHeaders(replyHeaders);

            // Open the OBEX body stream
            outStream = op.openOutputStream();
        } catch (IOException e) {
            Log.w(TAG, "sendMessageListingRsp: IOException - sending OBEX_HTTP_BAD_REQUEST", e);
            if (outStream != null) {
@@ -1366,9 +1365,6 @@ public class BluetoothMapObexServer extends ServerRequestHandler {

        // Check to see if we only need to send the size - hence no need to encode.
        try {
            // Open the OBEX body stream
            outStream = op.openOutputStream();

            if (appParams.getMaxListCount() == BluetoothMapAppParams.INVALID_VALUE_PARAMETER) {
                appParams.setMaxListCount(1024);
            }
@@ -1416,6 +1412,8 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
            replyHeaders.setHeader(HeaderSet.APPLICATION_PARAMETER, outAppParams.encodeParams());
            op.sendHeaders(replyHeaders);

            // Open the OBEX body stream
            outStream = op.openOutputStream();
        } catch (IOException e) {
            Log.w(TAG, "sendConvoListingRsp: IOException - sending OBEX_HTTP_BAD_REQUEST", e);
            if (outStream != null) {
@@ -1524,7 +1522,6 @@ public class BluetoothMapObexServer extends ServerRequestHandler {

            if (maxListCount != 0) {
                outBytes = mCurrentFolder.encode(listStartOffset, maxListCount);
                outStream = op.openOutputStream();
            } else {
                // ESR08 specified that this shall only be included for MaxListCount=0
                outAppParams.setFolderListingSize(mCurrentFolder.getSubFolderCount());
@@ -1535,6 +1532,9 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
            replyHeaders.setHeader(HeaderSet.APPLICATION_PARAMETER, outAppParams.encodeParams());
            op.sendHeaders(replyHeaders);

            if (maxListCount != 0) {
                outStream = op.openOutputStream();
            }
        } catch (IOException e1) {
            Log.w(TAG, "sendFolderListingRsp: IOException"
                    + " - sending OBEX_HTTP_BAD_REQUEST Exception:", e1);
@@ -1723,7 +1723,6 @@ public class BluetoothMapObexServer extends ServerRequestHandler {

        try {
            outBytes = mOutContent.getMessage(handle, appParams, mCurrentFolder, version);
            outStream = op.openOutputStream();

            // If it is a fraction request of Email message, set header before responding
            if ((BluetoothMapUtils.getMsgTypeFromHandle(handle).equals(TYPE.EMAIL)
@@ -1742,6 +1741,7 @@ public class BluetoothMapObexServer extends ServerRequestHandler {
                            + "set FRACTION_DELIVER_LAST header");
                }
            }
            outStream = op.openOutputStream();

        } catch (IOException e) {
            Log.w(TAG, "sendGetMessageRsp: IOException - sending OBEX_HTTP_BAD_REQUEST", e);
+44 −12
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ public class BluetoothMapService extends ProfileService {
    private boolean mSdpSearchInitiated = false;
    SdpMnsRecord mMnsRecord = null;
    private MapServiceMessageHandler mSessionStatusHandler;
    private boolean mStartError = true;
    private boolean mServiceStarted = false;

    private boolean mSmsCapable = true;

@@ -165,7 +165,8 @@ public class BluetoothMapService extends ProfileService {
        if (DEBUG) {
            Log.d(TAG, "MAP Service closeService in");
        }

        // Mark MapService Started as false while shutdown ongoing.
        mServiceStarted = false;
        if (mBluetoothMnsObexClient != null) {
            mBluetoothMnsObexClient.shutdown();
            mBluetoothMnsObexClient = null;
@@ -505,7 +506,7 @@ public class BluetoothMapService extends ProfileService {
    }

    protected boolean isMapStarted() {
        return !mStartError;
        return mServiceStarted;
    }

    public static BluetoothDevice getRemoteDevice() {
@@ -672,8 +673,8 @@ public class BluetoothMapService extends ProfileService {

        // start RFCOMM listener
        sendStartListenerMessage(-1);
        mStartError = false;
        return !mStartError;
        mServiceStarted = true;
        return mServiceStarted;
    }

    /**
@@ -844,7 +845,8 @@ public class BluetoothMapService extends ProfileService {
        //TODO: Check if the profile state can be retreived from ProfileService or AdapterService.
        if (!isMapStarted()) {
            if (DEBUG) {
                Log.d(TAG, "Service Not Available to STOP, ignoring");
                Log.d(TAG, "Service Not Available to STOP or Shutdown already"
                                + " in progress - Ignoring");
            }
            return true;
        } else {
@@ -852,11 +854,13 @@ public class BluetoothMapService extends ProfileService {
                Log.d(TAG, "Service Stoping()");
            }
        }
        // setState Disconnect already handled from closeService.
        // Handle it otherwise - Redundant for backup?
        setState(BluetoothMap.STATE_DISCONNECTED, BluetoothMap.RESULT_CANCELED);
        if (mSessionStatusHandler != null) {
            sendShutdownMessage();
        }
        mStartError = true;
        setState(BluetoothMap.STATE_DISCONNECTED, BluetoothMap.RESULT_CANCELED);
        mServiceStarted = false;
        return true;
    }

@@ -865,10 +869,26 @@ public class BluetoothMapService extends ProfileService {
        if (DEBUG) {
            Log.d(TAG, "cleanup()");
        }
        // Stop MapProfile if already started.
        // TODO: Check if the profile state can be retreived from ProfileService or AdapterService.
        if (!isMapStarted()) {
            if (DEBUG) {
                Log.d(TAG, "Service Not Available to STOP or Shutdown already"
                                + " in progress - Ignoring");
            }
            return true;
        } else {
            if (VERBOSE) Log.d(TAG, "Service Stoping()");
        }
        // SetState Disconnect already handled from closeService.
        // Handle it otherwise. Redundant for backup ?
        setState(BluetoothMap.STATE_DISCONNECTED, BluetoothMap.RESULT_CANCELED);
        //Cleanup already handled in Stop().
        //Move this  extra check to Handler.
        if (mSessionStatusHandler != null) {
            sendShutdownMessage();
        }
        mServiceStarted = false;
        return true;
    }

@@ -1057,10 +1077,22 @@ public class BluetoothMapService extends ProfileService {
                int state =
                        intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR);
                if (state == BluetoothAdapter.STATE_TURNING_OFF) {
                    if (DEBUG) Log.d(TAG, "STATE_TURNING_OFF");
                    // Stop MapProfile if already started.
                    if (!isMapStarted()) {
                        if (DEBUG) {
                        Log.d(TAG, "STATE_TURNING_OFF");
                            Log.d(TAG, "Service Not Available to STOP or Shutdown already"
                                            + " in progress - Ignoring");
                        }
                    } else if (mSessionStatusHandler != null) {
                        if (VERBOSE) Log.d(TAG, "Service Stoping()");
                        sendShutdownMessage();
                    } else {
                        if (DEBUG) {
                            Log.d(TAG, "Unable to perform STOP or Shutdown already"
                                            + " in progress - Ignoring");
                        }
                    }
                } else if (state == BluetoothAdapter.STATE_ON) {
                    if (DEBUG) {
                        Log.d(TAG, "STATE_ON");
+2 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

import javax.obex.ApplicationParameter;
import javax.obex.HeaderSet;
@@ -838,6 +839,7 @@ public class BluetoothPbapObexServer extends ServerRequestHandler {
            // query the number, to get the names
            ArrayList<String> names =
                    mVcardManager.getContactNamesByNumber(appParamValue.searchValue);
            if (mOrderBy == ORDER_BY_ALPHABETICAL) Collections.sort(names);
            for (int i = 0; i < names.size(); i++) {
                compareValue = names.get(i).trim();
                if (D) {