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

Commit c17d0475 authored by Sal Savage's avatar Sal Savage Committed by Gerrit Code Review
Browse files

Merge changes from topic "bt-profile-sysprop-tm-dev"

* changes:
  Migrate Config.java to use the new *.isEnabled() functions
  Migrate OPP profile enable/disable to sysprops
  Migrate HFP AG/server enable/disable to sysprops
  Migrate SAP server enable/disable to sysprops
  Migrate PBAP client enable/disable to sysprops
  Migrate PBAP server enable/disable to sysprops
  Migrate PAN profile enable/disable to sysprops
  Migrate MAP client enable/disable to sysprops
  Migrate MAP server enable/disable to sysprops
  Migrate HFP HF/Client enable/disable to sysprops
  Migrate ASHA central enable/disable to sysprops
  Migrate HID host/device enable/disable to sysprops
  Migrate GATT enable/disable to sysprops
  Migrate LE Audio related profile enable/disable to sysprops
  Migrate AVRCP Controller enable/disable to sysprops
  Migrate AVRCP Target enable/disable to sysprops
  Migrate A2DP Sink enable/disable to sysprops
  Migrate A2DP Source enable/disable to sysprops
  Create a setComponentAvailable() utility for profiles to use
parents fb71a66a df4d7182
Loading
Loading
Loading
Loading
+324 −269

File changed.

Preview size limit exceeded, changes collapsed.

+0 −26
Original line number Original line Diff line number Diff line
@@ -13,34 +13,8 @@
   limitations under the License.
   limitations under the License.
-->
-->
<resources>
<resources>
    <bool name="profile_supported_a2dp">true</bool>
    <bool name="profile_supported_a2dp_sink">false</bool>
    <bool name="profile_supported_hs_hfp">true</bool>
    <bool name="profile_supported_hfpclient">false</bool>
    <bool name="profile_supported_hfp_incallservice">true</bool>
    <bool name="profile_supported_hid_host">true</bool>
    <bool name="profile_supported_opp">true</bool>
    <bool name="profile_supported_pan">true</bool>
    <bool name="profile_supported_pbap">true</bool>
    <bool name="profile_supported_gatt">true</bool>
    <bool name="pbap_include_photos_in_vcard">true</bool>
    <bool name="pbap_include_photos_in_vcard">true</bool>
    <bool name="pbap_use_profile_for_owner_vcard">true</bool>
    <bool name="pbap_use_profile_for_owner_vcard">true</bool>
    <bool name="profile_supported_map">true</bool>
    <bool name="profile_supported_avrcp_target">true</bool>
    <bool name="profile_supported_avrcp_controller">false</bool>
    <bool name="profile_supported_sap">false</bool>
    <bool name="profile_supported_pbapclient">false</bool>
    <bool name="profile_supported_mapmce">false</bool>
    <bool name="profile_supported_hid_device">true</bool>
    <bool name="profile_supported_le_audio">true</bool>
    <bool name="profile_supported_le_audio_broadcast">false</bool>
    <bool name="profile_supported_vc">true</bool>
    <bool name="profile_supported_mcp_server">true</bool>
    <bool name="profile_supported_csip_set_coordinator">true</bool>
    <bool name="profile_supported_le_call_control">true</bool>
    <bool name="profile_supported_hap_client">true</bool>
    <bool name="profile_supported_bass_client">true</bool>
    <bool name="profile_supported_battery">true</bool>


    <!-- If true, we will require location to be enabled on the device to
    <!-- If true, we will require location to be enabled on the device to
         fire Bluetooth LE scan result callbacks in addition to having one
         fire Bluetooth LE scan result callbacks in addition to having one
+5 −0
Original line number Original line Diff line number Diff line
@@ -41,6 +41,7 @@ import android.media.AudioManager;
import android.media.BluetoothProfileConnectionInfo;
import android.media.BluetoothProfileConnectionInfo;
import android.os.Build;
import android.os.Build;
import android.os.HandlerThread;
import android.os.HandlerThread;
import android.sysprop.BluetoothProperties;
import android.util.Log;
import android.util.Log;


import com.android.bluetooth.BluetoothMetricsProto;
import com.android.bluetooth.BluetoothMetricsProto;
@@ -103,6 +104,10 @@ public class A2dpService extends ProfileService {
    private BroadcastReceiver mBondStateChangedReceiver;
    private BroadcastReceiver mBondStateChangedReceiver;
    private BroadcastReceiver mConnectionStateChangedReceiver;
    private BroadcastReceiver mConnectionStateChangedReceiver;


    public static boolean isEnabled() {
        return BluetoothProperties.isProfileA2dpSourceEnabled().orElse(false);
    }

    @Override
    @Override
    protected IProfileServiceBinder initBinder() {
    protected IProfileServiceBinder initBinder() {
        return new BluetoothA2dpBinder(this);
        return new BluetoothA2dpBinder(this);
+5 −0
Original line number Original line Diff line number Diff line
@@ -23,6 +23,7 @@ import android.bluetooth.BluetoothProfile;
import android.bluetooth.IBluetoothA2dpSink;
import android.bluetooth.IBluetoothA2dpSink;
import android.content.AttributionSource;
import android.content.AttributionSource;
import android.media.AudioManager;
import android.media.AudioManager;
import android.sysprop.BluetoothProperties;
import android.util.Log;
import android.util.Log;


import com.android.bluetooth.Utils;
import com.android.bluetooth.Utils;
@@ -63,6 +64,10 @@ public class A2dpSinkService extends ProfileService {


    A2dpSinkNativeInterface mNativeInterface;
    A2dpSinkNativeInterface mNativeInterface;


    public static boolean isEnabled() {
        return BluetoothProperties.isProfileA2dpSinkEnabled().orElse(false);
    }

    @Override
    @Override
    protected boolean start() {
    protected boolean start() {
        mAdapterService = Objects.requireNonNull(AdapterService.getAdapterService(),
        mAdapterService = Objects.requireNonNull(AdapterService.getAdapterService(),
+5 −13
Original line number Original line Diff line number Diff line
@@ -29,6 +29,7 @@ import android.os.Looper;
import android.os.SystemProperties;
import android.os.SystemProperties;
import android.os.UserManager;
import android.os.UserManager;
import android.text.TextUtils;
import android.text.TextUtils;
import android.sysprop.BluetoothProperties;
import android.util.Log;
import android.util.Log;


import com.android.bluetooth.BluetoothMetricsProto;
import com.android.bluetooth.BluetoothMetricsProto;
@@ -58,7 +59,6 @@ import java.util.Objects;
public class AvrcpTargetService extends ProfileService {
public class AvrcpTargetService extends ProfileService {
    private static final String TAG = "AvrcpTargetService";
    private static final String TAG = "AvrcpTargetService";
    private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
    private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
    private static final String AVRCP_ENABLE_PROPERTY = "persist.bluetooth.enablenewavrcp";


    private static final int AVRCP_MAX_VOL = 127;
    private static final int AVRCP_MAX_VOL = 127;
    private static final int MEDIA_KEY_EVENT_LOGGER_SIZE = 20;
    private static final int MEDIA_KEY_EVENT_LOGGER_SIZE = 20;
@@ -83,6 +83,10 @@ public class AvrcpTargetService extends ProfileService {


    private static AvrcpTargetService sInstance = null;
    private static AvrcpTargetService sInstance = null;


    public static boolean isEnabled() {
        return BluetoothProperties.isProfileAvrcpTargetEnabled().orElse(false);
    }

    class ListCallback implements MediaPlayerList.MediaUpdateCallback {
    class ListCallback implements MediaPlayerList.MediaUpdateCallback {
        @Override
        @Override
        public void run(MediaData data) {
        public void run(MediaData data) {
@@ -180,12 +184,6 @@ public class AvrcpTargetService extends ProfileService {
    protected void setUserUnlocked(int userId) {
    protected void setUserUnlocked(int userId) {
        Log.i(TAG, "User unlocked, initializing the service");
        Log.i(TAG, "User unlocked, initializing the service");


        if (!SystemProperties.getBoolean(AVRCP_ENABLE_PROPERTY, true)) {
            Log.w(TAG, "Skipping initialization of the new AVRCP Target Player List");
            sInstance = null;
            return;
        }

        if (mMediaPlayerList != null) {
        if (mMediaPlayerList != null) {
            mMediaPlayerList.init(new ListCallback());
            mMediaPlayerList.init(new ListCallback());
        }
        }
@@ -201,12 +199,6 @@ public class AvrcpTargetService extends ProfileService {
        Log.i(TAG, "Starting the AVRCP Target Service");
        Log.i(TAG, "Starting the AVRCP Target Service");
        mCurrentData = new MediaData(null, null, null);
        mCurrentData = new MediaData(null, null, null);


        if (!SystemProperties.getBoolean(AVRCP_ENABLE_PROPERTY, true)) {
            Log.w(TAG, "Skipping initialization of the new AVRCP Target Service");
            sInstance = null;
            return true;
        }

        mAudioManager = getSystemService(AudioManager.class);
        mAudioManager = getSystemService(AudioManager.class);
        sDeviceMaxVolume = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
        sDeviceMaxVolume = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);


Loading