diff --git a/res/values/strings.xml b/res/values/strings.xml
index 87543c3..bf444ab 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -4080,6 +4080,18 @@
     <string name="experimental_category_title">Experimental</string>
     <!-- Title for feature flags dashboard where developers can turn on experimental features [CHAR LIMIT=50] -->
     <string name="feature_flags_dashboard_title">Feature flags</string>
+    <!-- Title for snoop logger filters dashboard where developers can turn on filters [CHAR LIMIT=50] -->
+    <string name="snoop_logger_filters_dashboard_title">Snoop Logger Filters</string>
+    <!-- Summary for the snoop logger filters [CHAR LIMIT=50] -->
+    <string name="bt_hci_snoop_log_filters_dashboard_summary">Set filters (Toggle Bluetooth after changing this setting)</string>
+    <!-- Title for the snoop logger pbap filter [CHAR LIMIT=50] -->
+    <string name="bt_hci_snoop_log_filter_pbap_title">Snoop Logger Filter PBAP</string>
+    <!-- Title for the snoop logger map filter [CHAR LIMIT=50] -->
+    <string name="bt_hci_snoop_log_filter_map_title">Snoop Logger Filter MAP</string>
+    <!-- Summary for the snoop logger filters [CHAR LIMIT=50] -->
+    <string name="bt_hci_snoop_log_filter_summary">Set filtering mode. (Toggle Bluetooth after changing this setting)</string>
+    <!-- Summary for the snoop logger profile filters while disabled [CHAR LIMIT=50] -->
+    <string name="bt_hci_snoop_log_filtered_mode_disabled_summary">Enable Snoop Log Mode Filtered to change this option.</string>
     <!-- Title for the Talkback Accessibility Service. Displayed on the Accessibility Settings screen in Setup Wizard. [CHAR_LIMIT=25] -->
     <string name="talkback_title">Talkback</string>
     <!-- Summary for the Talkback Accessibility Service. Lets the user know that Talkback is a screenreader and that it is usually most helpful to blind and low vision users and whether the service is on. [CHAR_LIMIT=none] -->
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index 82d7e43..abbc101 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -80,6 +80,26 @@
             android:entries="@array/bt_hci_snoop_log_entries"
             android:entryValues="@array/bt_hci_snoop_log_values" />
 
+        <Preference
+            android:key="snoop_logger_filters_dashboard"
+            android:title="@string/snoop_logger_filters_dashboard_title"
+            android:fragment=
+                "com.android.settings.development.snooplogger.SnoopLoggerFiltersDashboard" />
+
+        <ListPreference
+            android:key="bt_hci_snoop_log_filter_pbap"
+            android:title="@string/bt_hci_snoop_log_filter_pbap_title"
+            android:dialogTitle="@string/bt_hci_snoop_log_filter_summary"
+            android:entries="@array/bt_hci_snoop_log_profile_filter_entries"
+            android:entryValues="@array/bt_hci_snoop_log_profile_filter_values" />
+
+        <ListPreference
+            android:key="bt_hci_snoop_log_filter_map"
+            android:title="@string/bt_hci_snoop_log_filter_map_title"
+            android:dialogTitle="@string/bt_hci_snoop_log_filter_summary"
+            android:entries="@array/bt_hci_snoop_log_profile_filter_entries"
+            android:entryValues="@array/bt_hci_snoop_log_profile_filter_values" />
+
         <com.android.settingslib.RestrictedSwitchPreference
             android:key="oem_unlock_enable"
             android:title="@string/oem_unlock_enable"
diff --git a/res/xml/snoop_logger_filters_settings.xml b/res/xml/snoop_logger_filters_settings.xml
new file mode 100644
index 0000000..c804ec6
--- /dev/null
+++ b/res/xml/snoop_logger_filters_settings.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright (C) 2022 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+  -->
+
+<PreferenceScreen
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:settings="http://schemas.android.com/apk/res-auto"
+    android:title="@string/snoop_logger_filters_dashboard_title" >
+
+    <PreferenceCategory
+        android:key="snoop_logger_filters_category"
+        android:layout="@layout/preference_category_no_label"
+        android:title="@string/bt_hci_snoop_log_filters_dashboard_summary"
+        settings:controller=
+          "com.android.settings.development.snooplogger.SnoopLoggerFiltersPreferenceController" />
+</PreferenceScreen>
diff --git a/src/com/android/settings/development/BluetoothSnoopLogFilterProfileMapPreferenceController.java b/src/com/android/settings/development/BluetoothSnoopLogFilterProfileMapPreferenceController.java
new file mode 100644
index 0000000..8ace9bb
--- /dev/null
+++ b/src/com/android/settings/development/BluetoothSnoopLogFilterProfileMapPreferenceController.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development;
+
+import android.content.Context;
+import android.sysprop.BluetoothProperties;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.ListPreference;
+import androidx.preference.Preference;
+
+import com.android.settings.R;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.development.DeveloperOptionsPreferenceController;
+
+import java.util.Locale;
+
+/** Bluetooth Snoop Logger Map Profile Filter Preference Controller */
+public class BluetoothSnoopLogFilterProfileMapPreferenceController
+        extends DeveloperOptionsPreferenceController
+        implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
+
+    private static final String TAG = "BluetoothSnoopLogFilterProfileMapPreferenceController";
+    private static final String PREFERENCE_KEY = "bt_hci_snoop_log_filter_map";
+    @VisibleForTesting static final int BTSNOOP_LOG_PROFILE_FILTER_MODE_DISABLED_INDEX = 0;
+    @VisibleForTesting static final int BTSNOOP_LOG_PROFILE_FILTER_MODE_MAGIC_INDEX = 1;
+    @VisibleForTesting static final int BTSNOOP_LOG_PROFILE_FILTER_MODE_HEADER_INDEX = 2;
+    @VisibleForTesting static final int BTSNOOP_LOG_PROFILE_FILTER_MODE_FULL_FILTER_INDEX = 3;
+
+    private final String[] mListValues;
+    private final String[] mListEntries;
+    private final String mProfilesFilterDisabledEntry;
+
+    @VisibleForTesting
+    static boolean isSnoopLogModeFilteredEnabled() {
+        return (BluetoothProperties.snoop_log_mode()
+                        .orElse(BluetoothProperties.snoop_log_mode_values.DISABLED)
+                == BluetoothProperties.snoop_log_mode_values.FILTERED);
+    }
+
+    public BluetoothSnoopLogFilterProfileMapPreferenceController(Context context) {
+        super(context);
+        mListValues =
+                context.getResources()
+                        .getStringArray(R.array.bt_hci_snoop_log_profile_filter_values);
+        mListEntries =
+                context.getResources()
+                        .getStringArray(R.array.bt_hci_snoop_log_profile_filter_entries);
+        mProfilesFilterDisabledEntry =
+                context.getResources()
+                        .getString(R.string.bt_hci_snoop_log_filtered_mode_disabled_summary);
+    }
+
+    // Default mode is DISABLED.
+    public int getDefaultModeIndex() {
+        return BTSNOOP_LOG_PROFILE_FILTER_MODE_DISABLED_INDEX;
+    }
+
+    @Override
+    public String getPreferenceKey() {
+        return PREFERENCE_KEY;
+    }
+
+    @Override
+    public boolean onPreferenceChange(Preference preference, Object newValue) {
+        BluetoothProperties.snoop_log_filter_profile_map(
+                BluetoothProperties.snoop_log_filter_profile_map_values.valueOf(
+                        newValue.toString().toUpperCase(Locale.US)));
+        updateState(mPreference);
+        return true;
+    }
+
+    @Override
+    public void updateState(Preference preference) {
+        super.updateState(preference);
+        final ListPreference listPreference = (ListPreference) preference;
+        if (isSnoopLogModeFilteredEnabled()) {
+            mPreference.setEnabled(true);
+
+            BluetoothProperties.snoop_log_filter_profile_map_values currentValue =
+                    BluetoothProperties.snoop_log_filter_profile_map()
+                            .orElse(
+                                    BluetoothProperties.snoop_log_filter_profile_map_values
+                                            .DISABLED);
+
+            int index = getDefaultModeIndex();
+            for (int i = 0; i < mListValues.length; i++) {
+                if (currentValue
+                        == BluetoothProperties.snoop_log_filter_profile_map_values.valueOf(
+                                mListValues[i].toUpperCase(Locale.US))) {
+                    index = i;
+                    break;
+                }
+            }
+            listPreference.setValue(mListValues[index]);
+            listPreference.setSummary(mListEntries[index]);
+        } else {
+            mPreference.setEnabled(false);
+            listPreference.setSummary(mProfilesFilterDisabledEntry);
+        }
+    }
+
+    /** Called when the Bluetooth Snoop Log Mode changes. */
+    public void onSettingChanged() {
+        updateState(mPreference);
+    }
+
+    @Override
+    protected void onDeveloperOptionsSwitchEnabled() {
+        super.onDeveloperOptionsSwitchEnabled();
+        mPreference.setEnabled(isSnoopLogModeFilteredEnabled());
+    }
+
+    @Override
+    protected void onDeveloperOptionsSwitchDisabled() {
+        super.onDeveloperOptionsSwitchDisabled();
+        BluetoothProperties.snoop_log_filter_profile_map(
+                BluetoothProperties.snoop_log_filter_profile_map_values.DISABLED);
+        ((ListPreference) mPreference).setValue(mListValues[getDefaultModeIndex()]);
+        ((ListPreference) mPreference).setSummary(mListEntries[getDefaultModeIndex()]);
+        mPreference.setEnabled(false);
+    }
+}
diff --git a/src/com/android/settings/development/BluetoothSnoopLogFilterProfilePbapPreferenceController.java b/src/com/android/settings/development/BluetoothSnoopLogFilterProfilePbapPreferenceController.java
new file mode 100644
index 0000000..c17291c
--- /dev/null
+++ b/src/com/android/settings/development/BluetoothSnoopLogFilterProfilePbapPreferenceController.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development;
+
+import android.content.Context;
+import android.sysprop.BluetoothProperties;
+
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.ListPreference;
+import androidx.preference.Preference;
+
+import com.android.settings.R;
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settingslib.development.DeveloperOptionsPreferenceController;
+
+import java.util.Locale;
+
+/** Bluetooth Snoop Logger Pbap Profile Filter Preference Controller */
+public class BluetoothSnoopLogFilterProfilePbapPreferenceController
+        extends DeveloperOptionsPreferenceController
+        implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
+
+    private static final String TAG = "BluetoothSnoopLogFilterProfilePbapPreferenceController";
+    private static final String PREFERENCE_KEY = "bt_hci_snoop_log_filter_pbap";
+    @VisibleForTesting static final int BTSNOOP_LOG_PROFILE_FILTER_MODE_DISABLED_INDEX = 0;
+    @VisibleForTesting static final int BTSNOOP_LOG_PROFILE_FILTER_MODE_MAGIC_INDEX = 1;
+    @VisibleForTesting static final int BTSNOOP_LOG_PROFILE_FILTER_MODE_HEADER_INDEX = 2;
+    @VisibleForTesting static final int BTSNOOP_LOG_PROFILE_FILTER_MODE_FULL_FILTER_INDEX = 3;
+
+    private final String[] mListValues;
+    private final String[] mListEntries;
+    private final String mProfilesFilterDisabledEntry;
+
+    @VisibleForTesting
+    static boolean isSnoopLogModeFilteredEnabled() {
+        return (BluetoothProperties.snoop_log_mode()
+                        .orElse(BluetoothProperties.snoop_log_mode_values.DISABLED)
+                == BluetoothProperties.snoop_log_mode_values.FILTERED);
+    }
+
+    public BluetoothSnoopLogFilterProfilePbapPreferenceController(Context context) {
+        super(context);
+        mListValues =
+                context.getResources()
+                        .getStringArray(R.array.bt_hci_snoop_log_profile_filter_values);
+        mListEntries =
+                context.getResources()
+                        .getStringArray(R.array.bt_hci_snoop_log_profile_filter_entries);
+        mProfilesFilterDisabledEntry =
+                context.getResources()
+                        .getString(R.string.bt_hci_snoop_log_filtered_mode_disabled_summary);
+    }
+
+    // Default mode is DISABLED.
+    public int getDefaultModeIndex() {
+        return BTSNOOP_LOG_PROFILE_FILTER_MODE_DISABLED_INDEX;
+    }
+
+    @Override
+    public String getPreferenceKey() {
+        return PREFERENCE_KEY;
+    }
+
+    @Override
+    public boolean onPreferenceChange(Preference preference, Object newValue) {
+        BluetoothProperties.snoop_log_filter_profile_pbap(
+                BluetoothProperties.snoop_log_filter_profile_pbap_values.valueOf(
+                        newValue.toString().toUpperCase(Locale.US)));
+        updateState(mPreference);
+        return true;
+    }
+
+    @Override
+    public void updateState(Preference preference) {
+        super.updateState(preference);
+        final ListPreference listPreference = (ListPreference) preference;
+        if (isSnoopLogModeFilteredEnabled()) {
+            mPreference.setEnabled(true);
+            BluetoothProperties.snoop_log_filter_profile_pbap_values currentValue =
+                    BluetoothProperties.snoop_log_filter_profile_pbap()
+                            .orElse(
+                                    BluetoothProperties.snoop_log_filter_profile_pbap_values
+                                            .DISABLED);
+
+            int index = getDefaultModeIndex();
+            for (int i = 0; i < mListValues.length; i++) {
+                if (currentValue
+                        == BluetoothProperties.snoop_log_filter_profile_pbap_values.valueOf(
+                                mListValues[i].toUpperCase(Locale.US))) {
+                    index = i;
+                    break;
+                }
+            }
+            listPreference.setValue(mListValues[index]);
+            listPreference.setSummary(mListEntries[index]);
+        } else {
+            mPreference.setEnabled(false);
+            listPreference.setSummary(mProfilesFilterDisabledEntry);
+        }
+    }
+
+    /** Called when the Bluetooth Snoop Log Mode changes. */
+    public void onSettingChanged() {
+        updateState(mPreference);
+    }
+
+    @Override
+    protected void onDeveloperOptionsSwitchEnabled() {
+        super.onDeveloperOptionsSwitchEnabled();
+        mPreference.setEnabled(isSnoopLogModeFilteredEnabled());
+    }
+
+    @Override
+    protected void onDeveloperOptionsSwitchDisabled() {
+        super.onDeveloperOptionsSwitchDisabled();
+        BluetoothProperties.snoop_log_filter_profile_pbap(
+                BluetoothProperties.snoop_log_filter_profile_pbap_values.DISABLED);
+        ((ListPreference) mPreference).setValue(mListValues[getDefaultModeIndex()]);
+        ((ListPreference) mPreference).setSummary(mListEntries[getDefaultModeIndex()]);
+        mPreference.setEnabled(false);
+    }
+}
diff --git a/src/com/android/settings/development/BluetoothSnoopLogHost.java b/src/com/android/settings/development/BluetoothSnoopLogHost.java
new file mode 100644
index 0000000..1e53e73
--- /dev/null
+++ b/src/com/android/settings/development/BluetoothSnoopLogHost.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development;
+
+/**
+ * Interface for BluetoothSnoopLogPreferenceController callbacks.
+ */
+public interface BluetoothSnoopLogHost {
+
+    /**
+     * Called when the Bluetooth Snoop Log Mode changes.
+     */
+    void onSettingChanged();
+}
diff --git a/src/com/android/settings/development/BluetoothSnoopLogPreferenceController.java b/src/com/android/settings/development/BluetoothSnoopLogPreferenceController.java
index d698436..31ed652 100644
--- a/src/com/android/settings/development/BluetoothSnoopLogPreferenceController.java
+++ b/src/com/android/settings/development/BluetoothSnoopLogPreferenceController.java
@@ -22,12 +22,9 @@
 import android.provider.Settings;
 import android.text.TextUtils;
 
-import android.util.Log;
-
 import androidx.annotation.VisibleForTesting;
 import androidx.preference.ListPreference;
 import androidx.preference.Preference;
-import androidx.preference.SwitchPreference;
 
 import com.android.settings.R;
 import com.android.settings.core.PreferenceControllerMixin;
@@ -37,22 +34,23 @@
         implements Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
 
     private static final String PREFERENCE_KEY = "bt_hci_snoop_log";
-    @VisibleForTesting
-    static final int BTSNOOP_LOG_MODE_DISABLED_INDEX = 0;
-    @VisibleForTesting
-    static final int BTSNOOP_LOG_MODE_FILTERED_INDEX = 1;
-    @VisibleForTesting
-    static final int BTSNOOP_LOG_MODE_FULL_INDEX = 2;
+    @VisibleForTesting static final int BTSNOOP_LOG_MODE_DISABLED_INDEX = 0;
+    @VisibleForTesting static final int BTSNOOP_LOG_MODE_FILTERED_INDEX = 1;
+    @VisibleForTesting static final int BTSNOOP_LOG_MODE_FULL_INDEX = 2;
+
     @VisibleForTesting
     static final String BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY = "persist.bluetooth.btsnooplogmode";
 
     private final String[] mListValues;
     private final String[] mListEntries;
+    private DevelopmentSettingsDashboardFragment mFragment;
 
-    public BluetoothSnoopLogPreferenceController(Context context) {
+    public BluetoothSnoopLogPreferenceController(
+            Context context, DevelopmentSettingsDashboardFragment fragment) {
         super(context);
         mListValues = context.getResources().getStringArray(R.array.bt_hci_snoop_log_values);
         mListEntries = context.getResources().getStringArray(R.array.bt_hci_snoop_log_entries);
+        mFragment = fragment;
     }
 
     // Default mode is DISABLED. It can also be changed by modifying the global setting.
@@ -61,8 +59,10 @@
             return BTSNOOP_LOG_MODE_DISABLED_INDEX;
         }
 
-        final String default_mode = Settings.Global.getString(mContext.getContentResolver(),
-                Settings.Global.BLUETOOTH_BTSNOOP_DEFAULT_MODE);
+        final String default_mode =
+                Settings.Global.getString(
+                        mContext.getContentResolver(),
+                        Settings.Global.BLUETOOTH_BTSNOOP_DEFAULT_MODE);
 
         for (int i = 0; i < mListValues.length; i++) {
             if (TextUtils.equals(default_mode, mListValues[i])) {
@@ -82,6 +82,9 @@
     public boolean onPreferenceChange(Preference preference, Object newValue) {
         SystemProperties.set(BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY, newValue.toString());
         updateState(mPreference);
+        if (mFragment != null) {
+            mFragment.onSettingChanged();
+        }
         return true;
     }
 
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index 8ff2336..0bdccfb 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -83,7 +83,7 @@
         AdbClearKeysDialogHost, LogPersistDialogHost,
         BluetoothRebootDialog.OnRebootDialogListener,
         AbstractBluetoothPreferenceController.Callback,
-        NfcRebootDialog.OnNfcRebootDialogConfirmedListener {
+        NfcRebootDialog.OnNfcRebootDialogConfirmedListener, BluetoothSnoopLogHost {
 
     private static final String TAG = "DevSettingsDashboard";
 
@@ -431,6 +431,18 @@
     }
 
     @Override
+    public void onSettingChanged() {
+        final BluetoothSnoopLogFilterProfileMapPreferenceController controllerMap =
+                getDevelopmentOptionsController(
+                        BluetoothSnoopLogFilterProfileMapPreferenceController.class);
+        final BluetoothSnoopLogFilterProfilePbapPreferenceController controllerPbap =
+                getDevelopmentOptionsController(
+                        BluetoothSnoopLogFilterProfilePbapPreferenceController.class);
+        controllerMap.onSettingChanged();
+        controllerPbap.onSettingChanged();
+    }
+
+    @Override
     public void onActivityResult(int requestCode, int resultCode, Intent data) {
         boolean handledResult = false;
         for (AbstractPreferenceController controller : mPreferenceControllers) {
@@ -548,7 +560,11 @@
         controllers.add(new LocalBackupPasswordPreferenceController(context));
         controllers.add(new StayAwakePreferenceController(context, lifecycle));
         controllers.add(new HdcpCheckingPreferenceController(context));
-        controllers.add(new BluetoothSnoopLogPreferenceController(context));
+        controllers.add(new BluetoothSnoopLogPreferenceController(context, fragment));
+        controllers.add(new DefaultLaunchPreferenceController(context,
+                "snoop_logger_filters_dashboard"));
+        controllers.add(new BluetoothSnoopLogFilterProfilePbapPreferenceController(context));
+        controllers.add(new BluetoothSnoopLogFilterProfileMapPreferenceController(context));
         controllers.add(new OemUnlockPreferenceController(context, activity, fragment));
         controllers.add(new PictureColorModePreferenceController(context, lifecycle));
         controllers.add(new WebViewAppPreferenceController(context));
diff --git a/src/com/android/settings/development/snooplogger/SnoopLoggerFiltersDashboard.java b/src/com/android/settings/development/snooplogger/SnoopLoggerFiltersDashboard.java
new file mode 100644
index 0000000..6f1ede2
--- /dev/null
+++ b/src/com/android/settings/development/snooplogger/SnoopLoggerFiltersDashboard.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development.snooplogger;
+
+import android.app.settings.SettingsEnums;
+import android.content.Context;
+import android.provider.SearchIndexableResource;
+
+import com.android.settings.R;
+import com.android.settings.dashboard.DashboardFragment;
+import com.android.settings.search.BaseSearchIndexProvider;
+import com.android.settingslib.development.DevelopmentSettingsEnabler;
+import com.android.settingslib.search.SearchIndexable;
+
+import java.util.List;
+
+/**
+ * Bluetooth Snoop Logger Filters Dashboard
+ */
+@SearchIndexable
+public class SnoopLoggerFiltersDashboard extends DashboardFragment {
+
+    private static final String TAG = "SnoopLoggerFiltersDashboard";
+
+    @Override
+    public int getMetricsCategory() {
+        return SettingsEnums.SETTINGS_SNOOP_LOGGER_DASHBOARD;
+    }
+
+    @Override
+    protected String getLogTag() {
+        return TAG;
+    }
+
+    @Override
+    protected int getPreferenceScreenResId() {
+        return R.xml.snoop_logger_filters_settings;
+    }
+
+    @Override
+    public void onAttach(Context context) {
+        super.onAttach(context);
+    }
+
+    @Override
+    public int getHelpResource() {
+        return 0;
+    }
+
+    public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
+            new BaseSearchIndexProvider() {
+                @Override
+                public List<SearchIndexableResource> getXmlResourcesToIndex(
+                        Context context, boolean enabled) {
+                    final SearchIndexableResource sir = new SearchIndexableResource(context);
+                    sir.xmlResId = R.xml.snoop_logger_filters_settings;
+                    return List.of(sir);
+                }
+
+                @Override
+                protected boolean isPageSearchEnabled(Context context) {
+                    return DevelopmentSettingsEnabler.isDevelopmentSettingsEnabled(context);
+                }
+            };
+}
diff --git a/src/com/android/settings/development/snooplogger/SnoopLoggerFiltersPreference.java b/src/com/android/settings/development/snooplogger/SnoopLoggerFiltersPreference.java
new file mode 100644
index 0000000..f0c9ff4
--- /dev/null
+++ b/src/com/android/settings/development/snooplogger/SnoopLoggerFiltersPreference.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development.snooplogger;
+
+import android.content.Context;
+import android.os.SystemProperties;
+
+import androidx.preference.SwitchPreference;
+
+/**
+ * Bluetooth Snoop Logger Filters Preference
+ */
+public class SnoopLoggerFiltersPreference extends SwitchPreference {
+
+    private final String mKey;
+    private static final String TAG = "SnoopLoggerFiltersPreference";
+    private static final String SNOOP_LOG_FILTERS_PREFIX = "persist.bluetooth.snooplogfilter.";
+    private static final String SNOOP_LOG_FILTERS_SUFFIX = ".enabled";
+
+    public SnoopLoggerFiltersPreference(Context context, String key, String entry) {
+        super(context);
+        mKey = key;
+        setKey(key);
+        setTitle(entry);
+
+        String filterProp = SNOOP_LOG_FILTERS_PREFIX.concat(mKey).concat(SNOOP_LOG_FILTERS_SUFFIX);
+
+        boolean isFilterEnabled = SystemProperties.get(filterProp).equals("true");
+
+        super.setChecked(isFilterEnabled);
+    }
+
+    @Override
+    public void setChecked(boolean isChecked) {
+        super.setChecked(isChecked);
+        String filterProp = SNOOP_LOG_FILTERS_PREFIX.concat(mKey).concat(SNOOP_LOG_FILTERS_SUFFIX);
+        SystemProperties.set(filterProp, isChecked ? "true" : "false");
+    }
+}
diff --git a/src/com/android/settings/development/snooplogger/SnoopLoggerFiltersPreferenceController.java b/src/com/android/settings/development/snooplogger/SnoopLoggerFiltersPreferenceController.java
new file mode 100644
index 0000000..8262182
--- /dev/null
+++ b/src/com/android/settings/development/snooplogger/SnoopLoggerFiltersPreferenceController.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development.snooplogger;
+
+import android.content.Context;
+import android.sysprop.BluetoothProperties;
+
+import androidx.preference.PreferenceGroup;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settings.R;
+import com.android.settings.core.BasePreferenceController;
+
+/** A {@link BasePreferenceController} used in {@link SnoopLoggerFiltersDashboard} */
+public class SnoopLoggerFiltersPreferenceController extends BasePreferenceController {
+    private static final String TAG = "SnoopLoggerFiltersPreferenceController";
+
+    private final String[] mListValues;
+    private final String[] mListEntries;
+
+    public SnoopLoggerFiltersPreferenceController(Context context, String key) {
+        super(context, key);
+        mListValues =
+                context.getResources().getStringArray(R.array.bt_hci_snoop_log_filters_values);
+        mListEntries =
+                context.getResources().getStringArray(R.array.bt_hci_snoop_log_filters_entries);
+    }
+
+    @Override
+    public int getAvailabilityStatus() {
+        BluetoothProperties.snoop_log_mode_values snoopLogMode =
+                BluetoothProperties.snoop_log_mode()
+                        .orElse(BluetoothProperties.snoop_log_mode_values.DISABLED);
+        if (snoopLogMode == BluetoothProperties.snoop_log_mode_values.FILTERED) {
+            return AVAILABLE;
+        }
+        return DISABLED_DEPENDENT_SETTING;
+    }
+
+    @Override
+    public void displayPreference(PreferenceScreen screen) {
+        super.displayPreference(screen);
+        PreferenceGroup mGroup = screen.findPreference(getPreferenceKey());
+        mGroup.removeAll();
+        final Context prefContext = mGroup.getContext();
+        for (int i = 0; i < mListValues.length; i++) {
+            mGroup.addPreference(
+                    new SnoopLoggerFiltersPreference(prefContext, mListValues[i], mListEntries[i]));
+        }
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/development/BluetoothSnoopLogFilterProfileMapPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/BluetoothSnoopLogFilterProfileMapPreferenceControllerTest.java
new file mode 100644
index 0000000..411cca0
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/development/BluetoothSnoopLogFilterProfileMapPreferenceControllerTest.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.sysprop.BluetoothProperties;
+
+import androidx.preference.ListPreference;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settings.R;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+import java.util.Locale;
+
+@RunWith(RobolectricTestRunner.class)
+public class BluetoothSnoopLogFilterProfileMapPreferenceControllerTest {
+
+    @Spy private Context mSpyContext = RuntimeEnvironment.application;
+    @Spy private Resources mSpyResources = RuntimeEnvironment.application.getResources();
+    private ListPreference mPreference;
+    @Mock private PreferenceScreen mPreferenceScreen;
+    private BluetoothSnoopLogFilterProfileMapPreferenceController mController;
+
+    private CharSequence[] mListValues;
+    private CharSequence[] mListEntries;
+
+    @Before
+    public void setup() {
+        MockitoAnnotations.initMocks(this);
+        doReturn(mSpyResources).when(mSpyContext).getResources();
+        // Get XML values without mock
+        // Setup test list preference using XML values
+        mPreference = new ListPreference(mSpyContext);
+        mPreference.setEntries(R.array.bt_hci_snoop_log_profile_filter_entries);
+        mPreference.setEntryValues(R.array.bt_hci_snoop_log_profile_filter_values);
+        // Init the actual controller
+        mController = new BluetoothSnoopLogFilterProfileMapPreferenceController(mSpyContext);
+        // Construct preference in the controller via a mocked preference screen object
+        when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
+                .thenReturn(mPreference);
+        mController.displayPreference(mPreferenceScreen);
+        mListValues = mPreference.getEntryValues();
+        mListEntries = mPreference.getEntries();
+        BluetoothProperties.snoop_log_mode(BluetoothProperties.snoop_log_mode_values.FILTERED);
+    }
+
+    @Test
+    public void verifyResourceSizeAndRange() {
+        Assert.assertTrue(
+                BluetoothSnoopLogFilterProfileMapPreferenceController
+                        .isSnoopLogModeFilteredEnabled());
+        // Verify normal list entries and default preference entries have the same size
+        Assert.assertEquals(mListEntries.length, mListValues.length);
+        // Update the preference
+        mController.updateState(mPreference);
+        // Verify default preference value, entry and summary
+        final int defaultIndex = mController.getDefaultModeIndex();
+        Assert.assertEquals(mPreference.getValue(), mListValues[defaultIndex]);
+        Assert.assertEquals(mPreference.getEntry(), mListEntries[defaultIndex]);
+        Assert.assertEquals(mPreference.getSummary(), mListEntries[defaultIndex]);
+    }
+
+    @Test
+    public void onPreferenceChanged_turnOnBluetoothSnoopLogFullFilterMap() {
+        Assert.assertTrue(
+                BluetoothSnoopLogFilterProfileMapPreferenceController
+                        .isSnoopLogModeFilteredEnabled());
+        mController.onPreferenceChange(
+                null,
+                mListValues[
+                        BluetoothSnoopLogFilterProfileMapPreferenceController
+                                .BTSNOOP_LOG_PROFILE_FILTER_MODE_FULL_FILTER_INDEX]);
+        var mode =
+                BluetoothProperties.snoop_log_filter_profile_map()
+                        .orElse(BluetoothProperties.snoop_log_filter_profile_map_values.DISABLED);
+        // "fullfilter" is hard-coded between Settings and system/bt
+        Assert.assertEquals(
+                mode, BluetoothProperties.snoop_log_filter_profile_map_values.FULLFILTER);
+    }
+
+    @Test
+    public void onPreferenceChanged_turnOnBluetoothSnoopLogHeaderFilterMap() {
+        Assert.assertTrue(
+                BluetoothSnoopLogFilterProfileMapPreferenceController
+                        .isSnoopLogModeFilteredEnabled());
+        mController.onPreferenceChange(
+                null,
+                mListValues[
+                        BluetoothSnoopLogFilterProfileMapPreferenceController
+                                .BTSNOOP_LOG_PROFILE_FILTER_MODE_HEADER_INDEX]);
+        var mode =
+                BluetoothProperties.snoop_log_filter_profile_map()
+                        .orElse(BluetoothProperties.snoop_log_filter_profile_map_values.DISABLED);
+        // "header" is hard-coded between Settings and system/bt
+        Assert.assertEquals(mode, BluetoothProperties.snoop_log_filter_profile_map_values.HEADER);
+    }
+
+    @Test
+    public void onPreferenceChanged_turnOnBluetoothSnoopLogMagicFilterMap() {
+        Assert.assertTrue(
+                BluetoothSnoopLogFilterProfileMapPreferenceController
+                        .isSnoopLogModeFilteredEnabled());
+        mController.onPreferenceChange(
+                null,
+                mListValues[
+                        BluetoothSnoopLogFilterProfileMapPreferenceController
+                                .BTSNOOP_LOG_PROFILE_FILTER_MODE_MAGIC_INDEX]);
+        var mode =
+                BluetoothProperties.snoop_log_filter_profile_map()
+                        .orElse(BluetoothProperties.snoop_log_filter_profile_map_values.DISABLED);
+        // "magic" is hard-coded between Settings and system/bt
+        Assert.assertEquals(mode, BluetoothProperties.snoop_log_filter_profile_map_values.MAGIC);
+    }
+
+    @Test
+    public void onPreferenceChanged_turnOffBluetoothSnoopLogFilterMap() {
+        Assert.assertTrue(
+                BluetoothSnoopLogFilterProfileMapPreferenceController
+                        .isSnoopLogModeFilteredEnabled());
+        mController.onPreferenceChange(
+                null,
+                mListValues[
+                        BluetoothSnoopLogFilterProfileMapPreferenceController
+                                .BTSNOOP_LOG_PROFILE_FILTER_MODE_DISABLED_INDEX]);
+        var mode =
+                BluetoothProperties.snoop_log_filter_profile_map()
+                        .orElse(BluetoothProperties.snoop_log_filter_profile_map_values.DISABLED);
+        // "disabled" is hard-coded between Settings and system/bt
+        Assert.assertEquals(mode, BluetoothProperties.snoop_log_filter_profile_map_values.DISABLED);
+    }
+
+    @Test
+    public void updateState_preferenceShouldBeSetToRightValue() {
+        Assert.assertTrue(
+                BluetoothSnoopLogFilterProfileMapPreferenceController
+                        .isSnoopLogModeFilteredEnabled());
+        for (int i = 0; i < mListValues.length; ++i) {
+            BluetoothProperties.snoop_log_filter_profile_map(
+                    BluetoothProperties.snoop_log_filter_profile_map_values.valueOf(
+                            mListValues[i].toString().toUpperCase(Locale.US)));
+            mController.updateState(mPreference);
+            Assert.assertEquals(mPreference.getValue(), mListValues[i].toString());
+            Assert.assertEquals(mPreference.getSummary(), mListEntries[i].toString());
+        }
+    }
+
+    @Test
+    public void onDeveloperOptionsDisabled_shouldDisablePreference() {
+        mController.onDeveloperOptionsDisabled();
+        Assert.assertFalse(mPreference.isEnabled());
+        Assert.assertEquals(
+                mPreference.getValue(), mListValues[mController.getDefaultModeIndex()].toString());
+        Assert.assertEquals(
+                mPreference.getSummary(),
+                mListEntries[mController.getDefaultModeIndex()].toString());
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/development/BluetoothSnoopLogFilterProfilePbapPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/BluetoothSnoopLogFilterProfilePbapPreferenceControllerTest.java
new file mode 100644
index 0000000..add84c3
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/development/BluetoothSnoopLogFilterProfilePbapPreferenceControllerTest.java
@@ -0,0 +1,186 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.sysprop.BluetoothProperties;
+
+import androidx.preference.ListPreference;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settings.R;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+import java.util.Locale;
+
+@RunWith(RobolectricTestRunner.class)
+public class BluetoothSnoopLogFilterProfilePbapPreferenceControllerTest {
+
+    @Spy private Context mSpyContext = RuntimeEnvironment.application;
+    @Spy private Resources mSpyResources = RuntimeEnvironment.application.getResources();
+    private ListPreference mPreference;
+    @Mock private PreferenceScreen mPreferenceScreen;
+    private BluetoothSnoopLogFilterProfilePbapPreferenceController mController;
+
+    private CharSequence[] mListValues;
+    private CharSequence[] mListEntries;
+
+    @Before
+    public void setup() {
+        MockitoAnnotations.initMocks(this);
+        doReturn(mSpyResources).when(mSpyContext).getResources();
+        // Get XML values without mock
+        // Setup test list preference using XML values
+        mPreference = new ListPreference(mSpyContext);
+        mPreference.setEntries(R.array.bt_hci_snoop_log_profile_filter_entries);
+        mPreference.setEntryValues(R.array.bt_hci_snoop_log_profile_filter_values);
+        // Init the actual controller
+        mController = new BluetoothSnoopLogFilterProfilePbapPreferenceController(mSpyContext);
+        // Construct preference in the controller via a mocked preference screen object
+        when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
+                .thenReturn(mPreference);
+        mController.displayPreference(mPreferenceScreen);
+        mListValues = mPreference.getEntryValues();
+        mListEntries = mPreference.getEntries();
+        BluetoothProperties.snoop_log_mode(BluetoothProperties.snoop_log_mode_values.FILTERED);
+    }
+
+    @Test
+    public void verifyResourceSizeAndRange() {
+        Assert.assertTrue(
+                BluetoothSnoopLogFilterProfilePbapPreferenceController
+                        .isSnoopLogModeFilteredEnabled());
+        // Verify normal list entries and default preference entries have the same size
+        Assert.assertEquals(mListEntries.length, mListValues.length);
+        // Update the preference
+        mController.updateState(mPreference);
+        // Verify default preference value, entry and summary
+        final int defaultIndex = mController.getDefaultModeIndex();
+        Assert.assertEquals(mPreference.getValue(), mListValues[defaultIndex]);
+        Assert.assertEquals(mPreference.getEntry(), mListEntries[defaultIndex]);
+        Assert.assertEquals(mPreference.getSummary(), mListEntries[defaultIndex]);
+    }
+
+    @Test
+    public void onPreferenceChanged_turnOnBluetoothSnoopLogFullFilterPbap() {
+        Assert.assertTrue(
+                BluetoothSnoopLogFilterProfilePbapPreferenceController
+                        .isSnoopLogModeFilteredEnabled());
+        mController.onPreferenceChange(
+                null,
+                mListValues[
+                        BluetoothSnoopLogFilterProfilePbapPreferenceController
+                                .BTSNOOP_LOG_PROFILE_FILTER_MODE_FULL_FILTER_INDEX]);
+        var mode =
+                BluetoothProperties.snoop_log_filter_profile_pbap()
+                        .orElse(BluetoothProperties.snoop_log_filter_profile_pbap_values.DISABLED);
+        // "fullfilter" is hard-coded between Settings and system/bt
+        Assert.assertEquals(
+                mode, BluetoothProperties.snoop_log_filter_profile_pbap_values.FULLFILTER);
+    }
+
+    @Test
+    public void onPreferenceChanged_turnOnBluetoothSnoopLogHeaderFilterPbap() {
+        Assert.assertTrue(
+                BluetoothSnoopLogFilterProfilePbapPreferenceController
+                        .isSnoopLogModeFilteredEnabled());
+        mController.onPreferenceChange(
+                null,
+                mListValues[
+                        BluetoothSnoopLogFilterProfilePbapPreferenceController
+                                .BTSNOOP_LOG_PROFILE_FILTER_MODE_HEADER_INDEX]);
+        var mode =
+                BluetoothProperties.snoop_log_filter_profile_pbap()
+                        .orElse(BluetoothProperties.snoop_log_filter_profile_pbap_values.DISABLED);
+        // "header" is hard-coded between Settings and system/bt
+        Assert.assertEquals(mode, BluetoothProperties.snoop_log_filter_profile_pbap_values.HEADER);
+    }
+
+    @Test
+    public void onPreferenceChanged_turnOnBluetoothSnoopLogMagicFilterPbap() {
+        Assert.assertTrue(
+                BluetoothSnoopLogFilterProfilePbapPreferenceController
+                        .isSnoopLogModeFilteredEnabled());
+        mController.onPreferenceChange(
+                null,
+                mListValues[
+                        BluetoothSnoopLogFilterProfilePbapPreferenceController
+                                .BTSNOOP_LOG_PROFILE_FILTER_MODE_MAGIC_INDEX]);
+        var mode =
+                BluetoothProperties.snoop_log_filter_profile_pbap()
+                        .orElse(BluetoothProperties.snoop_log_filter_profile_pbap_values.DISABLED);
+        // "magic" is hard-coded between Settings and system/bt
+        Assert.assertEquals(mode, BluetoothProperties.snoop_log_filter_profile_pbap_values.MAGIC);
+    }
+
+    @Test
+    public void onPreferenceChanged_turnOffBluetoothSnoopLogFilterPbap() {
+        Assert.assertTrue(
+                BluetoothSnoopLogFilterProfilePbapPreferenceController
+                        .isSnoopLogModeFilteredEnabled());
+        mController.onPreferenceChange(
+                null,
+                mListValues[
+                        BluetoothSnoopLogFilterProfilePbapPreferenceController
+                                .BTSNOOP_LOG_PROFILE_FILTER_MODE_DISABLED_INDEX]);
+        var mode =
+                BluetoothProperties.snoop_log_filter_profile_pbap()
+                        .orElse(BluetoothProperties.snoop_log_filter_profile_pbap_values.DISABLED);
+        // "disabled" is hard-coded between Settings and system/bt
+        Assert.assertEquals(
+                mode, BluetoothProperties.snoop_log_filter_profile_pbap_values.DISABLED);
+    }
+
+    @Test
+    public void updateState_preferenceShouldBeSetToRightValue() {
+        Assert.assertTrue(
+                BluetoothSnoopLogFilterProfilePbapPreferenceController
+                        .isSnoopLogModeFilteredEnabled());
+        for (int i = 0; i < mListValues.length; ++i) {
+            BluetoothProperties.snoop_log_filter_profile_pbap(
+                    BluetoothProperties.snoop_log_filter_profile_pbap_values.valueOf(
+                            mListValues[i].toString().toUpperCase(Locale.US)));
+            mController.updateState(mPreference);
+            Assert.assertEquals(mPreference.getValue(), mListValues[i].toString());
+            Assert.assertEquals(mPreference.getSummary(), mListEntries[i].toString());
+        }
+    }
+
+    @Test
+    public void onDeveloperOptionsDisabled_shouldDisablePreference() {
+        mController.onDeveloperOptionsDisabled();
+        Assert.assertFalse(mPreference.isEnabled());
+        Assert.assertEquals(
+                mPreference.getValue(), mListValues[mController.getDefaultModeIndex()].toString());
+        Assert.assertEquals(
+                mPreference.getSummary(),
+                mListEntries[mController.getDefaultModeIndex()].toString());
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/development/BluetoothSnoopLogPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/BluetoothSnoopLogPreferenceControllerTest.java
index 630fd5f..6668a53 100644
--- a/tests/robotests/src/com/android/settings/development/BluetoothSnoopLogPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/BluetoothSnoopLogPreferenceControllerTest.java
@@ -17,9 +17,8 @@
 package com.android.settings.development;
 
 import static com.android.settings.development.BluetoothSnoopLogPreferenceController.BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY;
-import static com.google.common.truth.Truth.assertThat;
+
 import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import android.content.Context;
@@ -31,6 +30,7 @@
 
 import com.android.settings.R;
 
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -43,13 +43,10 @@
 @RunWith(RobolectricTestRunner.class)
 public class BluetoothSnoopLogPreferenceControllerTest {
 
-    @Spy
-    private Context mSpyContext = RuntimeEnvironment.application;
-    @Spy
-    private Resources mSpyResources = RuntimeEnvironment.application.getResources();
+    @Spy private Context mSpyContext = RuntimeEnvironment.application;
+    @Spy private Resources mSpyResources = RuntimeEnvironment.application.getResources();
     private ListPreference mPreference;
-    @Mock
-    private PreferenceScreen mPreferenceScreen;
+    @Mock private PreferenceScreen mPreferenceScreen;
     private BluetoothSnoopLogPreferenceController mController;
 
     private CharSequence[] mListValues;
@@ -65,10 +62,10 @@
         mPreference.setEntries(R.array.bt_hci_snoop_log_entries);
         mPreference.setEntryValues(R.array.bt_hci_snoop_log_values);
         // Init the actual controller
-        mController = new BluetoothSnoopLogPreferenceController(mSpyContext);
+        mController = new BluetoothSnoopLogPreferenceController(mSpyContext, null);
         // Construct preference in the controller via a mocked preference screen object
         when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
-            .thenReturn(mPreference);
+                .thenReturn(mPreference);
         mController.displayPreference(mPreferenceScreen);
         mListValues = mPreference.getEntryValues();
         mListEntries = mPreference.getEntries();
@@ -77,41 +74,44 @@
     @Test
     public void verifyResourceSizeAndRange() {
         // Verify normal list entries and default preference entries have the same size
-        assertThat(mListEntries.length).isEqualTo(mListValues.length);
+        Assert.assertEquals(mListEntries.length, mListValues.length);
         // Update the preference
         mController.updateState(mPreference);
         // Verify default preference value, entry and summary
         final int defaultIndex = mController.getDefaultModeIndex();
-        assertThat(mPreference.getValue()).isEqualTo(mListValues[defaultIndex]);
-        assertThat(mPreference.getEntry()).isEqualTo(mListEntries[defaultIndex]);
-        assertThat(mPreference.getSummary()).isEqualTo(mListEntries[defaultIndex]);
+        Assert.assertEquals(mPreference.getValue(), mListValues[defaultIndex]);
+        Assert.assertEquals(mPreference.getEntry(), mListEntries[defaultIndex]);
+        Assert.assertEquals(mPreference.getSummary(), mListEntries[defaultIndex]);
     }
 
     @Test
     public void onPreferenceChanged_turnOnFullBluetoothSnoopLog() {
-        mController.onPreferenceChange(null,
+        mController.onPreferenceChange(
+                null,
                 mListValues[BluetoothSnoopLogPreferenceController.BTSNOOP_LOG_MODE_FULL_INDEX]);
         final String mode = SystemProperties.get(BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY);
         // "full" is hard-coded between Settings and system/bt
-        assertThat(mode).isEqualTo("full");
+        Assert.assertEquals(mode, "full");
     }
 
     @Test
     public void onPreferenceChanged_turnOnFilteredBluetoothSnoopLog() {
-        mController.onPreferenceChange(null,
+        mController.onPreferenceChange(
+                null,
                 mListValues[BluetoothSnoopLogPreferenceController.BTSNOOP_LOG_MODE_FILTERED_INDEX]);
         final String mode = SystemProperties.get(BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY);
         // "filtered" is hard-coded between Settings and system/bt
-        assertThat(mode).isEqualTo("filtered");
+        Assert.assertEquals(mode, "filtered");
     }
 
     @Test
     public void onPreferenceChanged_turnOffBluetoothSnoopLog() {
-        mController.onPreferenceChange(null,
+        mController.onPreferenceChange(
+                null,
                 mListValues[BluetoothSnoopLogPreferenceController.BTSNOOP_LOG_MODE_DISABLED_INDEX]);
         final String mode = SystemProperties.get(BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY);
         // "disabled" is hard-coded between Settings and system/bt
-        assertThat(mode).isEqualTo("disabled");
+        Assert.assertEquals(mode, "disabled");
     }
 
     @Test
@@ -119,20 +119,19 @@
         for (int i = 0; i < mListValues.length; ++i) {
             SystemProperties.set(BLUETOOTH_BTSNOOP_LOG_MODE_PROPERTY, mListValues[i].toString());
             mController.updateState(mPreference);
-            assertThat(mPreference.getValue()).isEqualTo(mListValues[i].toString());
-            assertThat(mPreference.getSummary()).isEqualTo(mListEntries[i].toString());
+            Assert.assertEquals(mPreference.getValue(), mListValues[i].toString());
+            Assert.assertEquals(mPreference.getSummary(), mListEntries[i].toString());
         }
     }
 
     @Test
     public void onDeveloperOptionsDisabled_shouldDisablePreference() {
         mController.onDeveloperOptionsDisabled();
-        assertThat(mPreference.isEnabled()).isFalse();
-        assertThat(mPreference.getValue()).isEqualTo(
-                mListValues[mController.getDefaultModeIndex()]
-                        .toString());
-        assertThat(mPreference.getSummary()).isEqualTo(
-                mListEntries[mController.getDefaultModeIndex()]
-                        .toString());
+        Assert.assertFalse(mPreference.isEnabled());
+        Assert.assertEquals(
+                mPreference.getValue(), mListValues[mController.getDefaultModeIndex()].toString());
+        Assert.assertEquals(
+                mPreference.getSummary(),
+                mListEntries[mController.getDefaultModeIndex()].toString());
     }
 }
diff --git a/tests/robotests/src/com/android/settings/development/snooplogger/SnoopLoggerFiltersDashboardTest.java b/tests/robotests/src/com/android/settings/development/snooplogger/SnoopLoggerFiltersDashboardTest.java
new file mode 100644
index 0000000..40c34bf
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/development/snooplogger/SnoopLoggerFiltersDashboardTest.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development.snooplogger;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.settings.SettingsEnums;
+
+import com.android.settings.R;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+
+@RunWith(RobolectricTestRunner.class)
+public class SnoopLoggerFiltersDashboardTest {
+
+    private SnoopLoggerFiltersDashboard mDashboard;
+
+    @Before
+    public void setUp() {
+        mDashboard = new SnoopLoggerFiltersDashboard();
+    }
+
+    @Test
+    public void shouldNotHaveHelpResource() {
+        assertThat(mDashboard.getHelpResource()).isEqualTo(0);
+    }
+
+    @Test
+    public void shouldLogAsSnoopLoggerFiltersPage() {
+        assertThat(mDashboard.getMetricsCategory())
+                .isEqualTo(SettingsEnums.SETTINGS_SNOOP_LOGGER_DASHBOARD);
+    }
+
+    @Test
+    public void shouldUseSnoopLoggerFiltersPreferenceLayout() {
+        assertThat(mDashboard.getPreferenceScreenResId())
+                .isEqualTo(R.xml.snoop_logger_filters_settings);
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/development/snooplogger/SnoopLoggerFiltersPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/snooplogger/SnoopLoggerFiltersPreferenceControllerTest.java
new file mode 100644
index 0000000..f96ada0
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/development/snooplogger/SnoopLoggerFiltersPreferenceControllerTest.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development.snooplogger;
+
+import static com.android.settings.core.BasePreferenceController.AVAILABLE;
+import static com.android.settings.core.BasePreferenceController.DISABLED_DEPENDENT_SETTING;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.atLeastOnce;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.sysprop.BluetoothProperties;
+
+import androidx.preference.PreferenceCategory;
+import androidx.preference.PreferenceScreen;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class SnoopLoggerFiltersPreferenceControllerTest {
+
+    @Mock
+    private PreferenceScreen mScreen;
+    @Mock
+    private PreferenceCategory mCategory;
+    private Context mContext;
+    private SnoopLoggerFiltersPreferenceController mController;
+
+    @Before
+    public void setUp() {
+        MockitoAnnotations.initMocks(this);
+        mContext = RuntimeEnvironment.application;
+        mController = new SnoopLoggerFiltersPreferenceController(mContext, "test_key");
+        when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mCategory);
+        when(mCategory.getContext()).thenReturn(mContext);
+        mController.displayPreference(mScreen);
+    }
+
+    @Test
+    public void getAvailability_debug_available() {
+        BluetoothProperties.snoop_log_mode(BluetoothProperties.snoop_log_mode_values.FILTERED);
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE);
+    }
+
+    @Test
+    public void getAvailability_user_unavailable() {
+        BluetoothProperties.snoop_log_mode(BluetoothProperties.snoop_log_mode_values.DISABLED);
+        assertThat(mController.getAvailabilityStatus()).isEqualTo(DISABLED_DEPENDENT_SETTING);
+    }
+
+    @Test
+    public void onStart_shouldRefreshFilters() {
+        mController.displayPreference(mScreen);
+
+        verify(mCategory, atLeastOnce()).addPreference(any(SnoopLoggerFiltersPreference.class));
+    }
+}
diff --git a/tests/robotests/src/com/android/settings/development/snooplogger/SnoopLoggerFiltersPreferenceTest.java b/tests/robotests/src/com/android/settings/development/snooplogger/SnoopLoggerFiltersPreferenceTest.java
new file mode 100644
index 0000000..56f29ba
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/development/snooplogger/SnoopLoggerFiltersPreferenceTest.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.settings.development.snooplogger;
+
+import android.content.Context;
+
+import com.android.settings.R;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class SnoopLoggerFiltersPreferenceTest {
+
+    private static String sKEY;
+    private static String sENTRY;
+
+    private Context mContext;
+    private SnoopLoggerFiltersPreference mPreference;
+
+    @Before
+    public void setUp() {
+        mContext = RuntimeEnvironment.application;
+        sKEY = mContext.getResources().getStringArray(R.array.bt_hci_snoop_log_filters_values)[0];
+        sENTRY =
+                mContext.getResources().getStringArray(R.array.bt_hci_snoop_log_filters_entries)[0];
+        mPreference = new SnoopLoggerFiltersPreference(mContext, sKEY, sENTRY);
+    }
+
+    @Test
+    public void constructor_shouldSetTitle() {
+        Assert.assertEquals(mPreference.getTitle(), sENTRY);
+        Assert.assertFalse(mPreference.isChecked());
+    }
+
+    @Test
+    public void setChecked_shouldSetChecked() {
+        mPreference.setChecked(true);
+        Assert.assertTrue(mPreference.isChecked());
+    }
+}
