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

Commit 3816c399 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Flags: Add config.xml entry that enable/disable GD scanning by default"...

Merge "Flags: Add config.xml entry that enable/disable GD scanning by default" am: 77b0ed2d am: 90903fc2 am: 9d18e372

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Bluetooth/+/1672429

Change-Id: Ib24e745d98c3839b22b15da3e82f0b260f590b26
parents 3a72031e 9d18e372
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -121,4 +121,15 @@
    <!-- Package that is providing the exposure notification service -->
    <string name="exposure_notification_package">com.google.android.gms</string>

    <!-- Enabling Gabeldorsche up to the scanning layer, including
            - BLE scanning
            - BLE advertising
            - ACL connection management
            - Controller information management
            - HCI layer
            - HAL interface layer
            - Other required GD components like config storage
     -->
    <bool name="enable_gd_up_to_scanning_layer">false</bool>

</resources>
+2 −1
Original line number Diff line number Diff line
@@ -3429,7 +3429,8 @@ public class AdapterService extends Service {
        if (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_BLUETOOTH, GD_ADVERTISING_FLAG, false)) {
            initFlags.add(String.format("%s=%s", GD_ADVERTISING_FLAG, "true"));
        }
        if (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_BLUETOOTH, GD_SCANNING_FLAG, false)) {
        if (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_BLUETOOTH, GD_SCANNING_FLAG,
                Config.isGdEnabledUpToScanningLayer())) {
            initFlags.add(String.format("%s=%s", GD_SCANNING_FLAG, "true"));
        }
        if (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_BLUETOOTH, GD_HCI_FLAG, false)) {
+8 −1
Original line number Diff line number Diff line
@@ -22,10 +22,10 @@ import android.bluetooth.IBluetoothManager;
import android.content.ContentResolver;
import android.content.Context;
import android.content.res.Resources;
import android.os.SystemProperties;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.SystemProperties;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.Log;
@@ -111,6 +111,8 @@ public class Config {

    private static Class[] sSupportedProfiles = new Class[0];

    private static boolean sIsGdEnabledUptoScanningLayer = false;

    static void init(Context ctx) {
        if (ctx == null) {
            return;
@@ -143,12 +145,17 @@ public class Config {
            }
        }
        sSupportedProfiles = profiles.toArray(new Class[profiles.size()]);
        sIsGdEnabledUptoScanningLayer = resources.getBoolean(R.bool.enable_gd_up_to_scanning_layer);
    }

    static Class[] getSupportedProfiles() {
        return sSupportedProfiles;
    }

    static boolean isGdEnabledUpToScanningLayer() {
        return sIsGdEnabledUptoScanningLayer;
    }

    private static long getProfileMask(Class profile) {
        for (ProfileConfig config : PROFILE_SERVICES_AND_FLAGS) {
            if (config.mClass == profile) {