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

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

Snap for 4402310 from b29da02e to oc-m2-release

Change-Id: Ib60666ffa813b2d5641c262861c307f41a851dfb
parents a6644786 b29da02e
Loading
Loading
Loading
Loading
+5 −7
Original line number Diff line number Diff line
@@ -855,7 +855,7 @@ public final class Avrcp {
            // As a result of that, if we pause the music, on carkits the
            // Play status indicator will continue to display "Playing"
            // for 3 more seconds which can be confusing.
            if (mAudioManagerIsPlaying
            if ((mAudioManagerIsPlaying && newState.getState() != PlaybackState.STATE_PLAYING)
                    || (controllerState == null && mAudioManager != null
                               && mAudioManager.isMusicActive())) {
                // Use AudioManager playback state if we don't have the state
@@ -2701,8 +2701,12 @@ public final class Avrcp {
                return KeyEvent.KEYCODE_VOLUME_DOWN;
            case BluetoothAvrcp.PASSTHROUGH_ID_MUTE:
                return KeyEvent.KEYCODE_MUTE;
            case BluetoothAvrcp.PASSTHROUGH_ID_PLAY:
                return KeyEvent.KEYCODE_MEDIA_PLAY;
            case BluetoothAvrcp.PASSTHROUGH_ID_STOP:
                return KeyEvent.KEYCODE_MEDIA_STOP;
            case BluetoothAvrcp.PASSTHROUGH_ID_PAUSE:
                return KeyEvent.KEYCODE_MEDIA_PAUSE;
            case BluetoothAvrcp.PASSTHROUGH_ID_RECORD:
                return KeyEvent.KEYCODE_MEDIA_RECORD;
            case BluetoothAvrcp.PASSTHROUGH_ID_REWIND:
@@ -2725,12 +2729,6 @@ public final class Avrcp {
                return KeyEvent.KEYCODE_F4;
            case BluetoothAvrcp.PASSTHROUGH_ID_F5:
                return KeyEvent.KEYCODE_F5;
            // Interop workaround for headphones/car kits
            // which do not properly key track of playback
            // state...
            case BluetoothAvrcp.PASSTHROUGH_ID_PLAY:
            case BluetoothAvrcp.PASSTHROUGH_ID_PAUSE:
                return KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE;
            // Fallthrough for all unknown key mappings
            case BluetoothAvrcp.PASSTHROUGH_ID_SELECT:
            case BluetoothAvrcp.PASSTHROUGH_ID_ROOT_MENU:
+26 −3
Original line number Diff line number Diff line
@@ -50,26 +50,49 @@ class MnsService {

    static private MapClientService mContext;
    private volatile boolean mShutdown = false;         // Used to interrupt socket accept thread
    private int mSdpHandle = -1;

    MnsService(MapClientService context) {
        if (VDBG) Log.v(TAG, "MnsService()");
        mContext = context;
        mAcceptThread = new SocketAcceptor();
        mServerSockets = ObexServerSockets.create(mAcceptThread);
        SdpManager.getDefaultManager().createMapMnsRecord(
                "MAP Message Notification Service", mServerSockets.getRfcommChannel(), -1,
                MNS_VERSION, MNS_FEATURE_BITS);
        SdpManager sdpManager = SdpManager.getDefaultManager();
        if (sdpManager == null) {
            Log.e(TAG, "SdpManager is null");
            return;
        }
        mSdpHandle = sdpManager.createMapMnsRecord("MAP Message Notification Service",
                mServerSockets.getRfcommChannel(), -1, MNS_VERSION, MNS_FEATURE_BITS);
    }

    void stop() {
        if (VDBG) Log.v(TAG, "stop()");
        mShutdown = true;
        cleanUpSdpRecord();
        if (mServerSockets != null) {
            mServerSockets.shutdown(false);
            mServerSockets = null;
        }
    }

    private void cleanUpSdpRecord() {
        if (mSdpHandle < 0) {
            Log.e(TAG, "cleanUpSdpRecord, SDP record never created");
            return;
        }
        int sdpHandle = mSdpHandle;
        mSdpHandle = -1;
        SdpManager sdpManager = SdpManager.getDefaultManager();
        if (sdpManager == null) {
            Log.e(TAG, "cleanUpSdpRecord failed, sdpManager is null, sdpHandle=" + sdpHandle);
            return;
        }
        Log.i(TAG, "cleanUpSdpRecord, mSdpHandle=" + sdpHandle);
        if (!sdpManager.removeSdpRecord(sdpHandle)) {
            Log.e(TAG, "cleanUpSdpRecord, removeSdpRecord failed, sdpHandle=" + sdpHandle);
        }
    }

    private class SocketAcceptor implements IObexConnectionHandler {

+10 −10
Original line number Diff line number Diff line
@@ -226,14 +226,6 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti
        public void handleMessage(Message msg) {
            switch (msg.what) {
                case STOP_LISTENER:
                    if (mAdapter != null && mOppSdpHandle >= 0
                            && SdpManager.getDefaultManager() != null) {
                        if (D) Log.d(TAG, "Removing SDP record mOppSdpHandle :" + mOppSdpHandle);
                        boolean status =
                                SdpManager.getDefaultManager().removeSdpRecord(mOppSdpHandle);
                        Log.d(TAG, "RemoveSDPrecord returns " + status);
                        mOppSdpHandle = -1;
                    }
                    stopListeners();
                    mListenStarted = false;
                    //Stop Active INBOUND Transfer
@@ -365,8 +357,10 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti
                            + " mServerSocket:" + mServerSocket);
            return;
        }
        mOppSdpHandle =
                sdpManager.createOppOpsRecord("OBEX Object Push", mServerSocket.getRfcommChannel(),
                        mServerSocket.getL2capPsm(), 0x0102, SUPPORTED_OPP_FORMAT);
        if (D) Log.d(TAG, "mOppSdpHandle :" + mOppSdpHandle);
    }

    @Override
@@ -1063,6 +1057,12 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti
    }

    private void stopListeners() {
        if (mAdapter != null && mOppSdpHandle >= 0 && SdpManager.getDefaultManager() != null) {
            if (D) Log.d(TAG, "Removing SDP record mOppSdpHandle :" + mOppSdpHandle);
            boolean status = SdpManager.getDefaultManager().removeSdpRecord(mOppSdpHandle);
            Log.d(TAG, "RemoveSDPrecord returns " + status);
            mOppSdpHandle = -1;
        }
        if (mServerSocket != null) {
            mServerSocket.shutdown(false);
            mServerSocket = null;