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

Commit 81a3abba authored by Etienne Ruffieux's avatar Etienne Ruffieux Committed by Gerrit Code Review
Browse files

Merge "Added static link to sysprop + Replaced SystemProperties"

parents 82139a51 640c2a44
Loading
Loading
Loading
Loading
+9 −8
Original line number Diff line number Diff line
@@ -92,22 +92,23 @@ android_app {
        "services.net",
    ],
    static_libs: [
        "com.android.vcard",
        "bluetooth.mapsapi",
        "sap-api-java-static",
        "services.net",
        "libprotobuf-java-lite",
        "bluetooth-protos-lite",
        "android.hardware.radio-V1.0-java",
        "androidx.core_core",
        "androidx.legacy_legacy-support-v4",
        "androidx.lifecycle_lifecycle-livedata",
        "modules-utils-statemachine",
        "androidx.room_room-runtime",
        "bluetooth.mapsapi",
        "bluetooth-protos-lite",
        "com.android.vcard",
        "guava",
        "android.hardware.radio-V1.0-java",
        "libprotobuf-java-lite",
        "mmslib",
        "modules-utils-backgroundthread",
        "modules-utils-bytesmatcher",
        "modules-utils-statemachine",
        "sap-api-java-static",
        "services.net",
        "PlatformProperties"
    ],

    plugins: [
+9 −2
Original line number Diff line number Diff line
@@ -88,6 +88,7 @@ import android.os.UserHandle;
import android.os.UserManager;
import android.provider.DeviceConfig;
import android.provider.Settings;
import android.sysprop.BluetoothProperties;
import android.text.TextUtils;
import android.util.Base64;
import android.util.Log;
@@ -757,8 +758,14 @@ public class AdapterService extends Service {
            mDefaultSnoopLogSettingAtEnable =
                    Settings.Global.getString(getContentResolver(),
                            Settings.Global.BLUETOOTH_BTSNOOP_DEFAULT_MODE);
            SystemProperties.set(BLUETOOTH_BTSNOOP_DEFAULT_MODE_PROPERTY,
                    mDefaultSnoopLogSettingAtEnable);
            BluetoothProperties.snoop_default_mode(
                    BluetoothProperties.snoop_default_mode_values.DISABLED);
            for (BluetoothProperties.snoop_default_mode_values value :
                    BluetoothProperties.snoop_default_mode_values.values()) {
                if (value.getPropValue().equals(mDefaultSnoopLogSettingAtEnable)) {
                    BluetoothProperties.snoop_default_mode(value);
                }
            }
        } else if (newState == BluetoothAdapter.STATE_BLE_ON
                   && prevState != BluetoothAdapter.STATE_OFF) {
            String snoopLogSetting =
+8 −6
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.permission.PermissionCheckerManager;
import android.sysprop.BluetoothProperties;
import android.test.mock.MockContentResolver;
import android.util.Log;

@@ -534,18 +535,19 @@ public class AdapterServiceTest {
     */
    @Test
    public void testSnoopLoggingChange() {
        String snoopSetting =
                SystemProperties.get(AdapterService.BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY, "");
        SystemProperties.set(AdapterService.BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY, "false");
        BluetoothProperties.snoop_log_mode_values snoopSetting =
                BluetoothProperties.snoop_log_mode()
                .orElse(BluetoothProperties.snoop_log_mode_values.EMPTY);
        BluetoothProperties.snoop_log_mode(BluetoothProperties.snoop_log_mode_values.DISABLED);
        doEnable(0, false);

        Assert.assertTrue(mAdapterService.getState() == BluetoothAdapter.STATE_ON);

        Assert.assertFalse(
                SystemProperties.get(AdapterService.BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY,
                        "true").equals("true"));
                        "full").equals("full"));

        SystemProperties.set(AdapterService.BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY, "true");
        BluetoothProperties.snoop_log_mode(BluetoothProperties.snoop_log_mode_values.FULL);

        mAdapterService.disable();

@@ -575,7 +577,7 @@ public class AdapterServiceTest {
        Assert.assertFalse(mAdapterService.getState() == BluetoothAdapter.STATE_ON);

        // Restore earlier setting
        SystemProperties.set(AdapterService.BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY, snoopSetting);
        BluetoothProperties.snoop_log_mode(snoopSetting);
    }