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

Commit 3cbf6056 authored by Yiyi Shen's avatar Yiyi Shen Committed by Android (Google) Code Review
Browse files

Merge "[Cleanup] Clean up promote_audio_sharing_for_second_auto_connected_lea_device" into main

parents 55d47cd9 777d3407
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ import androidx.annotation.VisibleForTesting;
import androidx.collection.ArraySet;

import com.android.settingslib.R;
import com.android.settingslib.flags.Flags;
import com.android.settingslib.utils.ThreadUtils;

import java.util.Collection;
@@ -236,12 +235,13 @@ public class BluetoothEventManager {
        LocalBluetoothLeBroadcast broadcast = mBtManager == null ? null
                : mBtManager.getProfileManager().getLeAudioBroadcastProfile();
        // Dispatch handleOnProfileStateChanged to local broadcast profile
        if (Flags.promoteAudioSharingForSecondAutoConnectedLeaDevice()
                && broadcast != null
                && state == BluetoothAdapter.STATE_CONNECTED) {
        if (broadcast != null && state == BluetoothAdapter.STATE_CONNECTED) {
            Log.d(TAG, "dispatchProfileConnectionStateChanged to local broadcast profile");
            var unused = ThreadUtils.postOnBackgroundThread(
                    () -> broadcast.handleProfileConnected(device, bluetoothProfile, mBtManager));
            var unused =
                    ThreadUtils.postOnBackgroundThread(
                            () ->
                                    broadcast.handleProfileConnected(
                                            device, bluetoothProfile, mBtManager));
        }
    }

+0 −4
Original line number Diff line number Diff line
@@ -1268,10 +1268,6 @@ public class LocalBluetoothLeBroadcast implements LocalBluetoothProfile {
    @WorkerThread
    public void handleProfileConnected(@NonNull CachedBluetoothDevice cachedDevice,
            int bluetoothProfile, @Nullable LocalBluetoothManager btManager) {
        if (!Flags.promoteAudioSharingForSecondAutoConnectedLeaDevice()) {
            Log.d(TAG, "Skip handleProfileConnected, flag off");
            return;
        }
        if (!SYSUI_PKG.equals(mContext.getPackageName())) {
            Log.d(TAG, "Skip handleProfileConnected, not a valid caller");
            return;
+0 −6
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.os.UserHandle;
import android.os.UserManager;
import android.platform.test.annotations.EnableFlags;
import android.platform.test.flag.junit.SetFlagsRule;
import android.telephony.TelephonyManager;

@@ -208,7 +207,6 @@ public class BluetoothEventManagerTest {
     * callback.
     */
    @Test
    @EnableFlags(Flags.FLAG_PROMOTE_AUDIO_SHARING_FOR_SECOND_AUTO_CONNECTED_LEA_DEVICE)
    public void dispatchProfileConnectionStateChanged_registerCallback_shouldDispatchCallback() {
        mBluetoothEventManager.registerCallback(mBluetoothCallback);

@@ -224,7 +222,6 @@ public class BluetoothEventManagerTest {
     * LocalBluetoothLeBroadcast}#handleProfileConnected when audio sharing flag is off.
     */
    @Test
    @EnableFlags(Flags.FLAG_PROMOTE_AUDIO_SHARING_FOR_SECOND_AUTO_CONNECTED_LEA_DEVICE)
    public void dispatchProfileConnectionStateChanged_flagOff_noCallToBroadcastProfile() {
        setUpAudioSharing(/* enableFlag= */ false, /* enableFeature= */ true, /* enableProfile= */
                true, /* workProfile= */ false);
@@ -242,7 +239,6 @@ public class BluetoothEventManagerTest {
     * sharing.
     */
    @Test
    @EnableFlags(Flags.FLAG_PROMOTE_AUDIO_SHARING_FOR_SECOND_AUTO_CONNECTED_LEA_DEVICE)
    public void dispatchProfileConnectionStateChanged_notSupport_noCallToBroadcastProfile() {
        setUpAudioSharing(/* enableFlag= */ true, /* enableFeature= */ false, /* enableProfile= */
                true, /* workProfile= */ false);
@@ -259,7 +255,6 @@ public class BluetoothEventManagerTest {
     * LocalBluetoothLeBroadcast}#handleProfileConnected when triggered for work profile.
     */
    @Test
    @EnableFlags(Flags.FLAG_PROMOTE_AUDIO_SHARING_FOR_SECOND_AUTO_CONNECTED_LEA_DEVICE)
    public void dispatchProfileConnectionStateChanged_workProfile_noCallToBroadcastProfile() {
        setUpAudioSharing(/* enableFlag= */ true, /* enableFeature= */ true, /* enableProfile= */
                true, /* workProfile= */ true);
@@ -277,7 +272,6 @@ public class BluetoothEventManagerTest {
     * audio sharing is enabled.
     */
    @Test
    @EnableFlags(Flags.FLAG_PROMOTE_AUDIO_SHARING_FOR_SECOND_AUTO_CONNECTED_LEA_DEVICE)
    public void dispatchProfileConnectionStateChanged_assistConnected_handleStateChanged() {
        setUpAudioSharing(/* enableFlag= */ true, /* enableFeature= */ true, /* enableProfile= */
                true, /* workProfile= */ false);