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

Commit 0083700a authored by Venkateshwarlu Domakonda's avatar Venkateshwarlu Domakonda Committed by Linux Build Service Account
Browse files

AVRCP: Check player focus state

While handling get total no of items, need to check player focus state
before framework call.

CRs-Fixed: 1045746
Change-Id: I4e8daae31d2783bc342d1c8a4b6421c5c977aa4f
parent 382a8f40
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -2803,6 +2803,7 @@ public final class Avrcp {

    private void processGetTotalNumberOfItems(byte scope, String deviceAddress) {
        long itemCount = 0;
        boolean IsPlayerInFocus = false;
        BluetoothDevice device = mAdapter.getRemoteDevice(deviceAddress);
        int deviceIndex = getIndexForDevice(device);
        if (deviceIndex == INVALID_DEVICE_INDEX) {
@@ -2810,6 +2811,22 @@ public final class Avrcp {
            return;
        }

        if (mMediaPlayers.size() > 0) {
            final Iterator<MediaPlayerInfo> rccIterator = mMediaPlayers.iterator();
            while (rccIterator.hasNext()) {
                 final MediaPlayerInfo di = rccIterator.next();
                 IsPlayerInFocus = di.GetPlayerFocus();
                 if (DEBUG) Log.v(TAG, "IsPlayerInFocus:" + IsPlayerInFocus);
                 if (IsPlayerInFocus)
                      break;
            }
        }
        if (!IsPlayerInFocus) {
            if (DEBUG) Log.v(TAG, "Player not in focus");
            getTotalNumberOfItemsRspNative(INTERNAL_ERROR, itemCount, 0x0000,
                    getByteAddress(device));
            return;
        }
        if (DEBUG) Log.v(TAG, "procesGetTotalNumberOfItems: scope: " + scope);
        if (scope == SCOPE_PLAYER_LIST) {
            processGetMediaPlayerTotalItems(scope, deviceAddress);