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

Commit a4cf7151 authored by Yiyi Shen's avatar Yiyi Shen
Browse files

[Audiosharing] Set/get compatibility config by toggle.

Also use startPrivateBroadcast() to start the broadcast with
compatibility config stored in SettingsProvider.

Test: manual
Bug: 305620450
Bug: 292538935
Change-Id: Iff067833fb0668531aa32957b414585751f2bcee
parent ca0647aa
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -139,16 +139,20 @@ public class AudioSharingCompatibilityPreferenceController extends TogglePrefere

    @Override
    public boolean isChecked() {
        // TODO: return real compatibility config.
        return false;
        return mBroadcast != null && mBroadcast.getImproveCompatibility();
    }

    @Override
    public boolean setChecked(boolean isChecked) {
        if (mBroadcast == null) {
        if (mBroadcast == null || mBroadcast.getImproveCompatibility() == isChecked) {
            Log.d(
                    TAG,
                    "Skip setting improveCompatibility, unchanged = "
                            + (mBroadcast.getImproveCompatibility() == isChecked));
            return false;
        }
        // TODO: set real compatibility config.
        mBroadcast.setImproveCompatibility(isChecked);
        // TODO: call updateBroadcast once framework change ready.
        return true;
    }

+1 −3
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import android.bluetooth.BluetoothLeBroadcast;
import android.bluetooth.BluetoothLeBroadcastAssistant;
import android.bluetooth.BluetoothLeBroadcastMetadata;
import android.bluetooth.BluetoothLeBroadcastReceiveState;
import android.bluetooth.BluetoothLeBroadcastSubgroupSettings;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
import android.util.Log;
@@ -539,8 +538,7 @@ public class AudioSharingDevicePreferenceController extends BasePreferenceContro
                                                mTargetSinks.add(device.getDevice());
                                            }
                                        }
                                        mBroadcast.startPrivateBroadcast(
                                                BluetoothLeBroadcastSubgroupSettings.QUALITY_HIGH);
                                        mBroadcast.startPrivateBroadcast();
                                    });
                        });
            }
+1 −2
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import android.bluetooth.BluetoothLeBroadcast;
import android.bluetooth.BluetoothLeBroadcastAssistant;
import android.bluetooth.BluetoothLeBroadcastMetadata;
import android.bluetooth.BluetoothLeBroadcastReceiveState;
import android.bluetooth.BluetoothLeBroadcastSubgroupSettings;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
@@ -339,7 +338,7 @@ public class AudioSharingSwitchBarController extends BasePreferenceController
            }
            mDeviceItemsForSharing.remove(0);
        }
        mBroadcast.startPrivateBroadcast(BluetoothLeBroadcastSubgroupSettings.QUALITY_HIGH);
        mBroadcast.startPrivateBroadcast();
    }

    private void stopAudioSharing() {