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

Commit 8f91ce0e authored by Santiago Seifert's avatar Santiago Seifert
Browse files

Rename AudioPoliciesBluetoothRC to BluetoothDeviceRoutesManager

For two reasons:
- Removes the RouteController prefix (this class doesn't implement
  the BluetoothRouteController interface).
- Removes the AudioPolicies prefix (unrelated to the class).

Bug: 205124386
Test: atest MediaRouterServiceTests
Change-Id: Ibb4e53b846ef69582d92653e095c31084cfb0df3
parent ce930181
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ import java.util.Objects;
 *
 * <p>This implementation obtains and manages all routes via {@link AudioManager}, with the
 * exception of {@link AudioManager#handleBluetoothActiveDeviceChanged inactive bluetooth} routes
 * which are managed by {@link AudioPoliciesBluetoothRouteController}, which depends on the
 * which are managed by {@link BluetoothDeviceRoutesManager}, which depends on the
 * bluetooth stack ({@link BluetoothAdapter} and related classes).
 */
/* package */ final class AudioManagerRouteController implements DeviceRouteController {
@@ -75,7 +75,7 @@ import java.util.Objects;
    @NonNull private final AudioManager mAudioManager;
    @NonNull private final Handler mHandler;
    @NonNull private final OnDeviceRouteChangedListener mOnDeviceRouteChangedListener;
    @NonNull private final AudioPoliciesBluetoothRouteController mBluetoothRouteController;
    @NonNull private final BluetoothDeviceRoutesManager mBluetoothRouteController;

    @NonNull
    private final Map<String, MediaRoute2InfoHolder> mRouteIdToAvailableDeviceRoutes =
@@ -118,7 +118,7 @@ import java.util.Objects;
                DeviceRouteController.getBuiltInSpeakerSuitabilityStatus(mContext);

        mBluetoothRouteController =
                new AudioPoliciesBluetoothRouteController(
                new BluetoothDeviceRoutesManager(
                        mContext, btAdapter, this::rebuildAvailableRoutesAndNotify);
        // Just build routes but don't notify. The caller may not expect the listener to be invoked
        // before this constructor has finished executing.
+5 −7
Original line number Diff line number Diff line
@@ -58,9 +58,7 @@ import java.util.stream.Collectors;
 * <p>This class also serves as ground truth for assigning {@link MediaRoute2Info#getId() route ids}
 * for bluetooth routes via {@link #getRouteIdForBluetoothAddress}.
 */
// TODO: b/305199571 - Rename this class to remove the RouteController suffix, which causes
// confusion with the BluetoothRouteController interface.
/* package */ class AudioPoliciesBluetoothRouteController {
/* package */ class BluetoothDeviceRoutesManager {
    private static final String TAG = SystemMediaRoute2Provider.TAG;

    private static final String HEARING_AID_ROUTE_ID_PREFIX = "HEARING_AID_";
@@ -86,7 +84,7 @@ import java.util.stream.Collectors;
    @NonNull
    private final BluetoothProfileMonitor mBluetoothProfileMonitor;

    AudioPoliciesBluetoothRouteController(@NonNull Context context,
    BluetoothDeviceRoutesManager(@NonNull Context context,
            @NonNull BluetoothAdapter bluetoothAdapter,
            @NonNull BluetoothRouteController.BluetoothRoutesUpdatedListener listener) {
        this(context, bluetoothAdapter,
@@ -94,7 +92,7 @@ import java.util.stream.Collectors;
    }

    @VisibleForTesting
    AudioPoliciesBluetoothRouteController(@NonNull Context context,
    BluetoothDeviceRoutesManager(@NonNull Context context,
            @NonNull BluetoothAdapter bluetoothAdapter,
            @NonNull BluetoothProfileMonitor bluetoothProfileMonitor,
            @NonNull BluetoothRouteController.BluetoothRoutesUpdatedListener listener) {
@@ -276,7 +274,7 @@ import java.util.stream.Collectors;
            int state = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, -1);
            if (state == BluetoothAdapter.STATE_OFF
                    || state == BluetoothAdapter.STATE_TURNING_OFF) {
                synchronized (AudioPoliciesBluetoothRouteController.this) {
                synchronized (BluetoothDeviceRoutesManager.this) {
                    mBluetoothRoutes.clear();
                }
                notifyBluetoothRoutesUpdated();
@@ -284,7 +282,7 @@ import java.util.stream.Collectors;
                updateBluetoothRoutes();

                boolean shouldCallListener;
                synchronized (AudioPoliciesBluetoothRouteController.this) {
                synchronized (BluetoothDeviceRoutesManager.this) {
                    shouldCallListener = !mBluetoothRoutes.isEmpty();
                }