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

Commit 9d293808 authored by William Escande's avatar William Escande
Browse files

Interop: Remove unused BROWSE_PLAYER_ALLOW_LIST

Bug: 337054479
Test: m .
Flag: Exempt, dead code removal
Change-Id: I957d5d98455df494693f542f0b5e397743fdc7b9
parent 5e6bbde5
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -46,7 +46,6 @@ public final class AbstractionLayer {

    static final int BT_PROPERTY_DYNAMIC_AUDIO_BUFFER = 0x10;
    static final int BT_PROPERTY_REMOTE_IS_COORDINATED_SET_MEMBER = 0x11;
    static final int BT_PROPERTY_WL_MEDIA_PLAYERS_LIST = 0x14;
    static final int BT_PROPERTY_REMOTE_ASHA_CAPABILITY = 0X15;
    static final int BT_PROPERTY_REMOTE_ASHA_TRUNCATED_HISYNCID = 0X16;
    static final int BT_PROPERTY_REMOTE_MODEL_NUM = 0x17;
+0 −47
Original line number Diff line number Diff line
@@ -104,8 +104,6 @@ class AdapterProperties {

    private static final int SCAN_MODE_CHANGES_MAX_SIZE = 10;
    private EvictingQueue<String> mScanModeChanges;
    private CopyOnWriteArrayList<String> mAllowlistedPlayers =
            new CopyOnWriteArrayList<String>();

    private int mProfilesConnecting, mProfilesConnected, mProfilesDisconnecting;
    private final HashMap<Integer, Pair<Integer, Integer>> mProfileConnectionState =
@@ -290,7 +288,6 @@ class AdapterProperties {
        mBondedDevices.clear();
        mScanModeChanges.clear();
        invalidateBluetoothCaches();
        mAllowlistedPlayers.clear();
    }

    private static void invalidateGetProfileConnectionStateCache() {
@@ -750,24 +747,6 @@ class AdapterProperties {
        }
    }

     /**
     * @return the mAllowlistedPlayers
     */
    String[] getAllowlistedMediaPlayers() {
        String[] AllowlistedPlayersList = new String[0];
        try {
            AllowlistedPlayersList = mAllowlistedPlayers.toArray(AllowlistedPlayersList);
        } catch (ArrayStoreException ee) {
            errorLog("Error retrieving Allowlisted Players array");
        }
        Log.d(TAG, "getAllowlistedMediaPlayers: numAllowlistedPlayers = "
                                        + AllowlistedPlayersList.length);
        for (int i = 0; i < AllowlistedPlayersList.length; i++) {
            Log.d(TAG, "players :" + AllowlistedPlayersList[i]);
        }
        return AllowlistedPlayersList;
    }

    long discoveryEndMillis() {
        return mDiscoveryEndMs;
    }
@@ -1003,15 +982,6 @@ class AdapterProperties {
        }
    }

    void updateAllowlistedMediaPlayers(String playername) {
        Log.d(TAG, "updateAllowlistedMediaPlayers ");

        if (!mAllowlistedPlayers.contains(playername)) {
            Log.d(TAG, "Adding to Allowlisted Players list:" + playername);
            mAllowlistedPlayers.add(playername);
        }
    }

    @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS)
    void adapterPropertyChangedCallback(int[] types, byte[][] values) {
        Intent intent;
@@ -1101,23 +1071,6 @@ class AdapterProperties {
                        debugLog("mLocalIOCapability set to " + mLocalIOCapability);
                        break;

                    case AbstractionLayer.BT_PROPERTY_WL_MEDIA_PLAYERS_LIST:
                        int pos = 0;
                        for (int j = 0; j < val.length; j++) {
                            if (val[j] != 0) {
                                continue;
                            }
                            int name_len = j - pos;

                            byte[] buf = new byte[name_len];
                            System.arraycopy(val, pos, buf, 0, name_len);
                            String player_name = new String(buf, 0, name_len);
                            Log.d(TAG, "player_name: "  +  player_name);
                            updateAllowlistedMediaPlayers(player_name);
                            pos += (name_len + 1);
                        }
                        break;

                    default:
                        errorLog("Property change not handled in Java land:" + type);
                }
+0 −4
Original line number Diff line number Diff line
@@ -5706,10 +5706,6 @@ public class AdapterService extends Service {
        return mAdapterProperties.getScanMode();
    }

    public String[] getAllowlistedMediaPlayers() {
        return mAdapterProperties.getAllowlistedMediaPlayers();
    }

    @VisibleForTesting
    BluetoothActivityEnergyInfo reportActivityInfo() {
        if (mAdapterProperties.getState() != BluetoothAdapter.STATE_ON
+0 −1
Original line number Diff line number Diff line
@@ -191,7 +191,6 @@ class BtPropertyType(enum.IntEnum):
    Appearance = 0x12
    VendorProductInfo = 0x13
    # Unimplemented:
    #  BT_PROPERTY_WL_MEDIA_PLAYERS_LIST,
    #  BT_PROPERTY_REMOTE_ASHA_CAPABILITY,
    #  BT_PROPERTY_REMOTE_ASHA_TRUNCATED_HISYNCID,
    #  BT_PROPERTY_REMOTE_MODEL_NUM,
+0 −40
Original line number Diff line number Diff line
@@ -2105,45 +2105,6 @@ void btif_on_did_received(RawAddress bd_addr, uint8_t vendor_id_src,
      BT_STATUS_SUCCESS, bd_addr, 1, &prop_did);
}

static void btif_dm_update_allowlisted_media_players() {
  uint8_t i = 0, buf_len = 0;
  bt_property_t wlplayers_prop;
  list_t* wl_players = list_new(nullptr);
  if (!wl_players) {
    log::error("Unable to allocate space for allowlist players");
    return;
  }
  log::debug("btif_dm_update_allowlisted_media_players");

  wlplayers_prop.len = 0;
  if (!interop_get_allowlisted_media_players_list(wl_players)) {
    log::debug("Allowlisted media players not found");
    list_free(wl_players);
    return;
  }

  /*find the total number of bytes and allocate memory */
  for (list_node_t* node = list_begin(wl_players); node != list_end(wl_players);
       node = list_next(node)) {
    buf_len += (strlen((char*)list_node(node)) + 1);
  }
  char* players_list = (char*)osi_malloc(buf_len);
  for (list_node_t* node = list_begin(wl_players); node != list_end(wl_players);
       node = list_next(node)) {
    char* name;
    name = (char*)list_node(node);
    memcpy(&players_list[i], list_node(node), strlen(name) + 1);
    i += (strlen(name) + 1);
  }
  wlplayers_prop.type = BT_PROPERTY_WL_MEDIA_PLAYERS_LIST;
  wlplayers_prop.len = buf_len;
  wlplayers_prop.val = players_list;

  GetInterfaceToProfiles()->events->invoke_adapter_properties_cb(
      BT_STATUS_SUCCESS, 1, &wlplayers_prop);
  list_free(wl_players);
}

void BTIF_dm_report_inquiry_status_change(tBTM_INQUIRY_STATE status) {
  btif_dm_inquiry_in_progress =
      (status == tBTM_INQUIRY_STATE::BTM_INQUIRY_STARTED);
@@ -2207,7 +2168,6 @@ void BTIF_dm_enable() {
  */
  btif_storage_load_bonded_devices();
  bluetooth::bqr::EnableBtQualityReport(true);
  btif_dm_update_allowlisted_media_players();
  btif_enable_bluetooth_evt();
}

Loading