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

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

release-request-4595c00b-3a4c-419f-96ea-b7c0015df602-for-git_oc-dr1-release-41...

release-request-4595c00b-3a4c-419f-96ea-b7c0015df602-for-git_oc-dr1-release-4185213 snap-temp-L64800000082738945

Change-Id: I12bf4e99281a67c6839f87031d527a7ada4b02b4
parents 4238e6e4 04d2df36
Loading
Loading
Loading
Loading
+15 −6
Original line number Diff line number Diff line
@@ -48,7 +48,9 @@ public class A2dpService extends ProfileService {
    private A2dpStateMachine mStateMachine;
    private Avrcp mAvrcp;

    private BroadcastReceiver mConnectionStateChangedReceiver = new BroadcastReceiver() {
    private BroadcastReceiver mConnectionStateChangedReceiver = null;

    private class CodecSupportReceiver extends BroadcastReceiver {
        @Override
        public void onReceive(Context context, Intent intent) {
            if (!BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED.equals(intent.getAction())) {
@@ -108,9 +110,12 @@ public class A2dpService extends ProfileService {
        mAvrcp = Avrcp.make(this);
        mStateMachine = A2dpStateMachine.make(this, this);
        setA2dpService(this);
        if (mConnectionStateChangedReceiver == null) {
            IntentFilter filter = new IntentFilter();
            filter.addAction(BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED);
            mConnectionStateChangedReceiver = new CodecSupportReceiver();
            registerReceiver(mConnectionStateChangedReceiver, filter);
        }
        return true;
    }

@@ -125,9 +130,13 @@ public class A2dpService extends ProfileService {
    }

    protected boolean cleanup() {
        if (mConnectionStateChangedReceiver != null) {
            unregisterReceiver(mConnectionStateChangedReceiver);
            mConnectionStateChangedReceiver = null;
        }
        if (mStateMachine != null) {
            mStateMachine.cleanup();
            mStateMachine = null;
        }
        if (mAvrcp != null) {
            mAvrcp.cleanup();
+6 −0
Original line number Diff line number Diff line
@@ -2225,6 +2225,12 @@ public final class Avrcp {
    }

    private void handleGetItemAttr(AvrcpCmd.ItemAttrCmd itemAttr) {
        if (itemAttr.mUidCounter != sUIDCounter) {
            Log.e(TAG, "handleGetItemAttr: invaild uid counter.");
            getItemAttrRspNative(
                    itemAttr.mAddress, AvrcpConstants.RSP_UID_CHANGED, (byte) 0, null, null);
            return;
        }
        if (itemAttr.mScope == AvrcpConstants.BTRC_SCOPE_NOW_PLAYING) {
            if (mCurrAddrPlayerID == NO_PLAYER_ID) {
                getItemAttrRspNative(
+11 −2
Original line number Diff line number Diff line
@@ -47,6 +47,10 @@ class HeadsetPhoneState {
    // HFP 1.6 CIND service
    private int mService = HeadsetHalConstants.NETWORK_STATE_NOT_AVAILABLE;

    // Check this before sending out service state to the device -- if the SIM isn't fully
    // loaded, don't expose that the network is available.
    private boolean mIsSimStateLoaded = false;

    // Number of active (foreground) calls
    private int mNumActive = 0;

@@ -235,17 +239,20 @@ class HeadsetPhoneState {

    void sendDeviceStateChanged()
    {
        int service =
                mIsSimStateLoaded ? mService : HeadsetHalConstants.NETWORK_STATE_NOT_AVAILABLE;
        // When out of service, send signal strength as 0. Some devices don't
        // use the service indicator, but only the signal indicator
        int signal = mService == HeadsetHalConstants.NETWORK_STATE_AVAILABLE ? mSignal : 0;
        int signal = service == HeadsetHalConstants.NETWORK_STATE_AVAILABLE ? mSignal : 0;

        Log.d(TAG, "sendDeviceStateChanged. mService="+ mService +
                   " mIsSimStateLoaded=" + mIsSimStateLoaded +
                   " mSignal=" + signal +" mRoam="+ mRoam +
                   " mBatteryCharge=" + mBatteryCharge);
        HeadsetStateMachine sm = mStateMachine;
        if (sm != null) {
            sm.sendMessage(HeadsetStateMachine.DEVICE_STATE_CHANGED,
                new HeadsetDeviceState(mService, mRoam, signal, mBatteryCharge));
                new HeadsetDeviceState(service, mRoam, signal, mBatteryCharge));
        }
    }

@@ -270,6 +277,7 @@ class HeadsetPhoneState {
                // If this is due to a SIM insertion, we want to defer sending device state changed
                // until all the SIM config is loaded.
                if (newService == HeadsetHalConstants.NETWORK_STATE_NOT_AVAILABLE) {
                    mIsSimStateLoaded = false;
                    sendDeviceStateChanged();
                    return;
                }
@@ -283,6 +291,7 @@ class HeadsetPhoneState {
                            // this'll execute immediately.
                            if (IccCardConstants.INTENT_VALUE_ICC_LOADED.equals(
                                    intent.getStringExtra(IccCardConstants.INTENT_KEY_ICC_STATE))) {
                                mIsSimStateLoaded = true;
                                sendDeviceStateChanged();
                                mContext.unregisterReceiver(this);
                            }