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

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

Merge "[Audiosharing] Disable auto pick in ui when developer preview on" into main

parents 2fef05b4 2a466400
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1056,7 +1056,7 @@ public class BluetoothUtils {

    /** Get develop option value for audio sharing preview. */
    @WorkerThread
    private static boolean getAudioSharingPreviewValue(@Nullable ContentResolver contentResolver) {
    public static boolean getAudioSharingPreviewValue(@Nullable ContentResolver contentResolver) {
        if (contentResolver == null) return false;
        return Settings.Global.getInt(
                contentResolver,
+9 −13
Original line number Diff line number Diff line
@@ -149,8 +149,8 @@ public class LocalBluetoothLeBroadcast implements LocalBluetoothProfile {
    private ContentResolver mContentResolver;
    private ContentObserver mSettingsObserver;
    // Cached broadcast callbacks being register before service is connected.
    private Map<BluetoothLeBroadcast.Callback, Executor> mCachedBroadcastCallbackExecutorMap =
            new ConcurrentHashMap<>();
    private ConcurrentHashMap<BluetoothLeBroadcast.Callback, Executor>
            mCachedBroadcastCallbackExecutorMap = new ConcurrentHashMap<>();

    private final ServiceListener mServiceListener =
            new ServiceListener() {
@@ -880,7 +880,7 @@ public class LocalBluetoothLeBroadcast implements LocalBluetoothProfile {
            @NonNull @CallbackExecutor Executor executor,
            @NonNull BluetoothLeBroadcast.Callback callback) {
        if (mServiceBroadcast == null) {
            Log.d(TAG, "registerServiceCallBack failed, the BluetoothLeBroadcast is null.");
            Log.d(TAG, "registerServiceCallBack failed, proxy not attached.");
            mCachedBroadcastCallbackExecutorMap.putIfAbsent(callback, executor);
            return;
        }
@@ -902,10 +902,7 @@ public class LocalBluetoothLeBroadcast implements LocalBluetoothProfile {
            @NonNull @CallbackExecutor Executor executor,
            @NonNull BluetoothLeBroadcastAssistant.Callback callback) {
        if (mServiceBroadcastAssistant == null) {
            Log.d(
                    TAG,
                    "registerBroadcastAssistantCallback failed, "
                            + "the BluetoothLeBroadcastAssistant is null.");
            Log.d(TAG, "registerBroadcastAssistantCallback failed, proxy not attached.");
            return;
        }

@@ -920,7 +917,7 @@ public class LocalBluetoothLeBroadcast implements LocalBluetoothProfile {
    public void unregisterServiceCallBack(@NonNull BluetoothLeBroadcast.Callback callback) {
        mCachedBroadcastCallbackExecutorMap.remove(callback);
        if (mServiceBroadcast == null) {
            Log.d(TAG, "unregisterServiceCallBack failed, the BluetoothLeBroadcast is null.");
            Log.d(TAG, "unregisterServiceCallBack failed, proxy not attached.");
            return;
        }

@@ -939,10 +936,7 @@ public class LocalBluetoothLeBroadcast implements LocalBluetoothProfile {
    private void unregisterBroadcastAssistantCallback(
            @NonNull BluetoothLeBroadcastAssistant.Callback callback) {
        if (mServiceBroadcastAssistant == null) {
            Log.d(
                    TAG,
                    "unregisterBroadcastAssistantCallback, "
                            + "the BluetoothLeBroadcastAssistant is null.");
            Log.d(TAG, "unregisterBroadcastAssistantCallback, proxy not attched.");
            return;
        }

@@ -1140,7 +1134,9 @@ public class LocalBluetoothLeBroadcast implements LocalBluetoothProfile {

    /** Update fallback active device if needed. */
    public void updateFallbackActiveDeviceIfNeeded() {
        if (Flags.disableAudioSharingAutoPickFallbackInUi()) {
        if (Flags.disableAudioSharingAutoPickFallbackInUi() || (mContext != null
                && Flags.audioSharingDeveloperOption()
                && BluetoothUtils.getAudioSharingPreviewValue(mContext.getContentResolver()))) {
            Log.d(TAG, "Skip updateFallbackActiveDeviceIfNeeded, disable flag is on");
            return;
        }