Merge "[Audiosharing] Impl the switch audio sharing dialog." into main
diff --git a/res/layout-v34/settingslib_main_switch.xml b/res/layout-v34/settingslib_main_switch.xml
deleted file mode 100644
index 5ce4581..0000000
--- a/res/layout-v34/settingslib_main_switch.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  ~ 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.
-  -->
-
-<com.google.android.material.materialswitch.MaterialSwitch
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@android:id/switch_widget"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:layout_gravity="center_vertical"
-    android:background="@null"
-    android:clickable="false"
-    android:focusable="false"
-    android:theme="@style/Theme.Material3.DynamicColors.DayNight" />
diff --git a/res/layout-v34/settingslib_main_switch_bar.xml b/res/layout-v34/settingslib_main_switch_bar.xml
new file mode 100644
index 0000000..3a44d2a
--- /dev/null
+++ b/res/layout-v34/settingslib_main_switch_bar.xml
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  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.
+  -->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_height="wrap_content"
+    android:layout_width="match_parent"
+    android:minHeight="?android:attr/listPreferredItemHeight"
+    android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+    android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+    android:paddingTop="@dimen/settingslib_switchbar_margin"
+    android:paddingBottom="@dimen/settingslib_switchbar_margin"
+    android:orientation="vertical">
+
+    <LinearLayout
+        android:id="@+id/frame"
+        android:minHeight="@dimen/settingslib_min_switch_bar_height"
+        android:layout_height="wrap_content"
+        android:layout_width="match_parent"
+        android:paddingStart="@dimen/settingslib_switchbar_padding_left"
+        android:paddingEnd="@dimen/settingslib_switchbar_padding_right"
+        android:background="@drawable/settingslib_switch_bar_bg">
+
+        <TextView
+            android:id="@+id/switch_text"
+            android:layout_height="wrap_content"
+            android:layout_width="0dp"
+            android:layout_weight="1"
+            android:layout_marginEnd="@dimen/settingslib_switch_title_margin"
+            android:layout_marginVertical="@dimen/settingslib_switch_title_margin"
+            android:layout_gravity="center_vertical"
+            android:ellipsize="end"
+            android:textAppearance="?android:attr/textAppearanceListItem"
+            android:hyphenationFrequency="normalFast"
+            android:lineBreakWordStyle="phrase"
+            style="@style/MainSwitchText.Settingslib" />
+
+        <com.google.android.material.materialswitch.MaterialSwitch
+            android:id="@android:id/switch_widget"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center_vertical"
+            android:background="@null"
+            android:clickable="false"
+            android:focusable="false"
+            android:theme="@style/Theme.Material3.DynamicColors.DayNight" />
+    </LinearLayout>
+
+</LinearLayout>
diff --git a/res/values/config.xml b/res/values/config.xml
index f50e918..7af29c8 100755
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -761,6 +761,9 @@
         <item></item>
     </string-array>
 
+    <!-- Whether to display the "Enable wireless display" menu -->
+    <bool name="config_show_wifi_display_enable_menu">true</bool>
+
     <!-- List of packages that should be hidden for MVNO. Do not translate -->
     <string-array name="datausage_hiding_carrier_service_package_names" translatable="false"/>
 
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 94a2205..40c0605 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1228,16 +1228,8 @@
     <string name="privatespace_hide_on_summary">On</string>
     <!-- System category for the Private Space page. [CHAR LIMIT=30] -->
     <string name="private_space_category_system">System</string>
-    <!-- Title for the preference to create Private Space. [CHAR LIMIT=60] -->
-    <string name="private_space_create_title">Create Private Space</string>
     <!-- Title for the preference to delete Private Space. [CHAR LIMIT=60] -->
     <string name="private_space_delete_title">Delete Private Space</string>
-    <!-- Toast to show when the private space was created. [CHAR LIMIT=NONE] -->
-    <string name="private_space_created">Private Space successfully created</string>
-    <!-- Toast to show when the private space already exists. [CHAR LIMIT=NONE] -->
-    <string name="private_space_already_exists">Private Space already exists</string>
-    <!-- Toast to show when the private space could not be created. [CHAR LIMIT=NONE] -->
-    <string name="private_space_create_failed">Private Space could not be created</string>
     <!-- Toast to show when the private space was deleted. [CHAR LIMIT=NONE] -->
     <string name="private_space_deleted">Private Space successfully deleted</string>
     <!-- Toast to show when the private space could not be deleted. [CHAR LIMIT=NONE] -->
diff --git a/res/xml/private_space_settings.xml b/res/xml/private_space_settings.xml
index 33243e1..eb9fdae 100644
--- a/res/xml/private_space_settings.xml
+++ b/res/xml/private_space_settings.xml
@@ -44,12 +44,6 @@
         android:title="@string/private_space_category_system">
 
         <Preference
-            android:key="private_space_create"
-            android:title="@string/private_space_create_title"
-            settings:controller="com.android.settings.privatespace.CreatePrivateSpaceController"
-            settings:searchable="false" />
-
-        <Preference
             android:key="private_space_delete"
             android:title="@string/private_space_delete_title"
             settings:controller="com.android.settings.privatespace.DeletePrivateSpaceController"
diff --git a/res/xml/wifi_network_details_fragment2.xml b/res/xml/wifi_network_details_fragment2.xml
index 56e7b04..daff20f 100644
--- a/res/xml/wifi_network_details_fragment2.xml
+++ b/res/xml/wifi_network_details_fragment2.xml
@@ -169,15 +169,11 @@
                 settings:enableCopying="true"/>
     </PreferenceCategory>
 
-    <!-- IPv6 Details -->
-    <PreferenceCategory
-            android:key="ipv6_category"
-            android:title="@string/wifi_details_ipv6_address_header"
-            android:selectable="false">
-        <Preference
-                android:key="ipv6_addresses"
-                android:selectable="false"
-                settings:enableCopying="true"/>
-    </PreferenceCategory>
+    <!-- IPv6 address -->
+    <Preference
+        android:title="@string/wifi_details_ipv6_address_header"
+        android:key="ipv6_addresses"
+        android:selectable="false"
+        settings:enableCopying="true"/>
 
 </PreferenceScreen>
diff --git a/src/com/android/settings/accessibility/AccessibilityDetailsSettingsFragment.java b/src/com/android/settings/accessibility/AccessibilityDetailsSettingsFragment.java
index 3e3674c..0dbf05e 100644
--- a/src/com/android/settings/accessibility/AccessibilityDetailsSettingsFragment.java
+++ b/src/com/android/settings/accessibility/AccessibilityDetailsSettingsFragment.java
@@ -32,7 +32,6 @@
 import android.os.Bundle;
 import android.os.UserHandle;
 import android.text.TextUtils;
-import android.util.FeatureFlagUtils;
 import android.util.Log;
 import android.view.accessibility.AccessibilityManager;
 
@@ -112,9 +111,7 @@
             return new LaunchFragmentArguments(destination, /* arguments= */ null);
         }
 
-        if (ACCESSIBILITY_HEARING_AIDS_COMPONENT_NAME.equals(componentName)
-                && FeatureFlagUtils.isEnabled(getContext(),
-                FeatureFlagUtils.SETTINGS_ACCESSIBILITY_HEARING_AID_PAGE)) {
+        if (ACCESSIBILITY_HEARING_AIDS_COMPONENT_NAME.equals(componentName)) {
             final String destination = AccessibilityHearingAidsFragment.class.getName();
             return new LaunchFragmentArguments(destination, /* arguments= */ null);
         }
diff --git a/src/com/android/settings/accessibility/AccessibilityHearingAidPreferenceController.java b/src/com/android/settings/accessibility/AccessibilityHearingAidPreferenceController.java
index 3aad141..fab6e47 100644
--- a/src/com/android/settings/accessibility/AccessibilityHearingAidPreferenceController.java
+++ b/src/com/android/settings/accessibility/AccessibilityHearingAidPreferenceController.java
@@ -25,9 +25,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
-import android.os.Bundle;
 import android.text.TextUtils;
-import android.util.FeatureFlagUtils;
 
 import androidx.annotation.VisibleForTesting;
 import androidx.fragment.app.FragmentManager;
@@ -35,7 +33,6 @@
 import androidx.preference.PreferenceScreen;
 
 import com.android.settings.R;
-import com.android.settings.bluetooth.BluetoothDeviceDetailsFragment;
 import com.android.settings.core.BasePreferenceController;
 import com.android.settings.core.SubSettingLauncher;
 import com.android.settingslib.bluetooth.BluetoothCallback;
@@ -116,17 +113,7 @@
     @Override
     public boolean handlePreferenceTreeClick(Preference preference) {
         if (TextUtils.equals(preference.getKey(), getPreferenceKey())) {
-            final CachedBluetoothDevice device = mHelper.getConnectedHearingAidDevice();
-            if (FeatureFlagUtils.isEnabled(mContext,
-                    FeatureFlagUtils.SETTINGS_ACCESSIBILITY_HEARING_AID_PAGE)) {
-                launchHearingAidPage();
-                return true;
-            }
-            if (device == null) {
-                launchHearingAidInstructionDialog();
-            } else {
-                launchBluetoothDeviceDetailSetting(device);
-            }
+            launchHearingAidPage();
             return true;
         }
         return false;
@@ -215,29 +202,6 @@
         mHearingAidPreference = preference;
     }
 
-    @VisibleForTesting
-    void launchBluetoothDeviceDetailSetting(final CachedBluetoothDevice device) {
-        if (device == null) {
-            return;
-        }
-        final Bundle args = new Bundle();
-        args.putString(BluetoothDeviceDetailsFragment.KEY_DEVICE_ADDRESS,
-                device.getDevice().getAddress());
-
-        new SubSettingLauncher(mContext)
-                .setDestination(BluetoothDeviceDetailsFragment.class.getName())
-                .setArguments(args)
-                .setTitleRes(R.string.device_details_title)
-                .setSourceMetricsCategory(getMetricsCategory())
-                .launch();
-    }
-
-    @VisibleForTesting
-    void launchHearingAidInstructionDialog() {
-        HearingAidDialogFragment fragment = HearingAidDialogFragment.newInstance();
-        fragment.show(mFragmentManager, HearingAidDialogFragment.class.toString());
-    }
-
     private void launchHearingAidPage() {
         new SubSettingLauncher(mContext)
                 .setDestination(AccessibilityHearingAidsFragment.class.getName())
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsHearingDeviceControlsController.java b/src/com/android/settings/bluetooth/BluetoothDetailsHearingDeviceControlsController.java
index c4a4221..18ad210 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsHearingDeviceControlsController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsHearingDeviceControlsController.java
@@ -18,7 +18,6 @@
 
 import android.content.Context;
 import android.text.TextUtils;
-import android.util.FeatureFlagUtils;
 
 import androidx.preference.Preference;
 import androidx.preference.PreferenceCategory;
@@ -51,8 +50,7 @@
 
     @Override
     public boolean isAvailable() {
-        return mCachedDevice.isHearingAidDevice() && FeatureFlagUtils.isEnabled(mContext,
-                FeatureFlagUtils.SETTINGS_ACCESSIBILITY_HEARING_AID_PAGE);
+        return mCachedDevice.isHearingAidDevice();
     }
 
     @Override
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java b/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java
index 73857f2..a3dace6 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java
@@ -126,9 +126,12 @@
         pref.setOnPreferenceClickListener(this);
         pref.setOrder(profile.getOrdinal());
 
-        if (profile instanceof LeAudioProfile && !isModelNameInAllowList(
+        boolean isLeEnabledByDefault =
+                SystemProperties.getBoolean(LE_AUDIO_CONNECTION_BY_DEFAULT_PROPERTY, true);
+
+        if (profile instanceof LeAudioProfile && (!isLeEnabledByDefault || !isModelNameInAllowList(
                 BluetoothUtils.getStringMetaData(mCachedDevice.getDevice(),
-                        METADATA_MODEL_NAME))) {
+                        METADATA_MODEL_NAME)))) {
             pref.setSummary(R.string.device_details_leaudio_toggle_summary);
         }
         return pref;
diff --git a/src/com/android/settings/privatespace/CreatePrivateSpaceController.java b/src/com/android/settings/privatespace/CreatePrivateSpaceController.java
deleted file mode 100644
index 3214988..0000000
--- a/src/com/android/settings/privatespace/CreatePrivateSpaceController.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.privatespace;
-
-import android.content.Context;
-import android.text.TextUtils;
-import android.widget.Toast;
-
-import androidx.preference.Preference;
-
-import com.android.settings.R;
-import com.android.settings.core.BasePreferenceController;
-
-// TODO(b/293569406): Remove this when we have the setup flow in place to create PS
-/**
- * Temp Controller to create the private space from the PS Settings page. This is to allow PM, UX,
- * and other folks to play around with PS before the PS setup flow is ready.
- */
-public final class CreatePrivateSpaceController extends BasePreferenceController {
-
-    public CreatePrivateSpaceController(Context context, String preferenceKey) {
-        super(context, preferenceKey);
-    }
-
-    @Override
-    public int getAvailabilityStatus() {
-        return AVAILABLE;
-    }
-
-    @Override
-    public boolean handlePreferenceTreeClick(Preference preference) {
-        if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) {
-            return false;
-        }
-
-        if (PrivateSpaceMaintainer.getInstance(mContext).doesPrivateSpaceExist()) {
-            showPrivateSpaceAlreadyExistsToast();
-            return super.handlePreferenceTreeClick(preference);
-        }
-
-        if (PrivateSpaceMaintainer.getInstance(mContext).createPrivateSpace()) {
-            showPrivateSpaceCreatedToast();
-        } else {
-            showPrivateSpaceCreationFailedToast();
-        }
-        return super.handlePreferenceTreeClick(preference);
-    }
-
-    private void showPrivateSpaceCreatedToast() {
-        Toast.makeText(mContext, R.string.private_space_created, Toast.LENGTH_SHORT).show();
-    }
-
-    private void showPrivateSpaceCreationFailedToast() {
-        Toast.makeText(mContext, R.string.private_space_create_failed, Toast.LENGTH_SHORT).show();
-    }
-
-    private void showPrivateSpaceAlreadyExistsToast() {
-        Toast.makeText(mContext, R.string.private_space_already_exists, Toast.LENGTH_SHORT).show();
-    }
-}
diff --git a/src/com/android/settings/privatespace/PrivateSpaceDashboardFragment.java b/src/com/android/settings/privatespace/PrivateSpaceDashboardFragment.java
index f72bcd9..5d00329 100644
--- a/src/com/android/settings/privatespace/PrivateSpaceDashboardFragment.java
+++ b/src/com/android/settings/privatespace/PrivateSpaceDashboardFragment.java
@@ -17,25 +17,13 @@
 package com.android.settings.privatespace;
 
 import android.app.settings.SettingsEnums;
-import android.content.Context;
-import android.os.Flags;
 
 import com.android.settings.R;
 import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.safetycenter.SafetyCenterManagerWrapper;
-import com.android.settings.search.BaseSearchIndexProvider;
-import com.android.settingslib.search.SearchIndexable;
-
-import java.util.List;
 
 /** Fragment representing the Private Space dashboard in Settings. */
-@SearchIndexable
 public class PrivateSpaceDashboardFragment extends DashboardFragment {
     private static final String TAG = "PrivateSpaceDashboardFragment";
-    private static final String KEY_CREATE_PROFILE_PREFERENCE = "private_space_create";
-    private static final String KEY_DELETE_PROFILE_PREFERENCE = "private_space_delete";
-    private static final String KEY_ONE_LOCK_PREFERENCE = "private_space_use_one_lock";
-    private static final String KEY_PS_HIDDEN_PREFERENCE = "private_space_hidden";
 
     @Override
     protected int getPreferenceScreenResId() {
@@ -51,23 +39,4 @@
     protected String getLogTag() {
         return TAG;
     }
-
-    public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
-            new BaseSearchIndexProvider(R.xml.private_space_settings) {
-                @Override
-                protected boolean isPageSearchEnabled(Context context) {
-                    return SafetyCenterManagerWrapper.get().isEnabled(context)
-                            && Flags.allowPrivateProfile();
-                }
-
-                @Override
-                public List<String> getNonIndexableKeys(Context context) {
-                    List<String> keys = super.getNonIndexableKeys(context);
-                    keys.add(KEY_CREATE_PROFILE_PREFERENCE);
-                    keys.add(KEY_DELETE_PROFILE_PREFERENCE);
-                    keys.add(KEY_ONE_LOCK_PREFERENCE);
-                    keys.add(KEY_PS_HIDDEN_PREFERENCE);
-                    return keys;
-                }
-            };
 }
diff --git a/src/com/android/settings/wfd/WifiDisplaySettings.java b/src/com/android/settings/wfd/WifiDisplaySettings.java
index 96f067c..2ec69c4 100644
--- a/src/com/android/settings/wfd/WifiDisplaySettings.java
+++ b/src/com/android/settings/wfd/WifiDisplaySettings.java
@@ -140,7 +140,6 @@
         mWifiP2pChannel = mWifiP2pManager.initialize(context, Looper.getMainLooper(), null);
 
         addPreferencesFromResource(R.xml.wifi_display_settings);
-        setHasOptionsMenu(true);
     }
 
     @Override
@@ -197,8 +196,9 @@
 
     @Override
     public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
-        if (mWifiDisplayStatus != null && mWifiDisplayStatus.getFeatureState()
-                != WifiDisplayStatus.FEATURE_STATE_UNAVAILABLE) {
+        if (getResources().getBoolean(R.bool.config_show_wifi_display_enable_menu)
+                && mWifiDisplayStatus != null && mWifiDisplayStatus.getFeatureState()
+                        != WifiDisplayStatus.FEATURE_STATE_UNAVAILABLE) {
             MenuItem item = menu.add(Menu.NONE, MENU_ID_ENABLE_WIFI_DISPLAY, 0,
                     R.string.wifi_display_enable_menu_item);
             item.setCheckable(true);
diff --git a/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java b/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java
index 5ab8807..faa0c3b 100644
--- a/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java
+++ b/src/com/android/settings/wifi/details2/WifiDetailPreferenceController2.java
@@ -59,7 +59,6 @@
 import androidx.annotation.VisibleForTesting;
 import androidx.core.text.BidiFormatter;
 import androidx.preference.Preference;
-import androidx.preference.PreferenceCategory;
 import androidx.preference.PreferenceFragmentCompat;
 import androidx.preference.PreferenceScreen;
 import androidx.recyclerview.widget.RecyclerView;
@@ -184,7 +183,6 @@
     private Preference mSubnetPref;
     private Preference mDnsPref;
     private Preference mTypePref;
-    private PreferenceCategory mIpv6Category;
     private Preference mIpv6AddressPref;
     private final IconInjector mIconInjector;
     private final Clock mClock;
@@ -376,8 +374,6 @@
         mSubnetPref = screen.findPreference(KEY_SUBNET_MASK_PREF);
         mDnsPref = screen.findPreference(KEY_DNS_PREF);
         mTypePref = screen.findPreference(KEY_WIFI_TYPE_PREF);
-
-        mIpv6Category = screen.findPreference(KEY_IPV6_CATEGORY);
         mIpv6AddressPref = screen.findPreference(KEY_IPV6_ADDRESSES_PREF);
     }
 
@@ -824,7 +820,7 @@
             mSubnetPref.setVisible(false);
             mGatewayPref.setVisible(false);
             mDnsPref.setVisible(false);
-            mIpv6Category.setVisible(false);
+            mIpv6AddressPref.setVisible(false);
             return;
         }
 
@@ -864,11 +860,11 @@
         updatePreference(mDnsPref, dnsServers);
 
         if (ipv6Addresses.length() > 0) {
+            mIpv6AddressPref.setVisible(true);
             mIpv6AddressPref.setSummary(
                     BidiFormatter.getInstance().unicodeWrap(ipv6Addresses.toString()));
-            mIpv6Category.setVisible(true);
         } else {
-            mIpv6Category.setVisible(false);
+            mIpv6AddressPref.setVisible(false);
         }
     }
 
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilityDetailsSettingsFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilityDetailsSettingsFragmentTest.java
index 995d74f..c105d08 100644
--- a/tests/robotests/src/com/android/settings/accessibility/AccessibilityDetailsSettingsFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilityDetailsSettingsFragmentTest.java
@@ -32,7 +32,6 @@
 import android.content.pm.ApplicationInfo;
 import android.content.pm.ResolveInfo;
 import android.content.pm.ServiceInfo;
-import android.util.FeatureFlagUtils;
 import android.view.accessibility.AccessibilityManager;
 
 import androidx.test.core.app.ApplicationProvider;
@@ -158,8 +157,6 @@
 
     @Test
     public void onCreate_hearingAidsComponentName_launchAccessibilityHearingAidsFragment() {
-        FeatureFlagUtils.setEnabled(mContext,
-                FeatureFlagUtils.SETTINGS_ACCESSIBILITY_HEARING_AID_PAGE, true);
         Intent intent = new Intent();
         intent.putExtra(Intent.EXTRA_COMPONENT_NAME,
                 ACCESSIBILITY_HEARING_AIDS_COMPONENT_NAME.flattenToString());
diff --git a/tests/robotests/src/com/android/settings/accessibility/AccessibilityHearingAidPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/accessibility/AccessibilityHearingAidPreferenceControllerTest.java
index 3333782..bb15378 100644
--- a/tests/robotests/src/com/android/settings/accessibility/AccessibilityHearingAidPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/AccessibilityHearingAidPreferenceControllerTest.java
@@ -18,11 +18,7 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 import static org.robolectric.Shadows.shadowOf;
 
@@ -35,7 +31,6 @@
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
-import android.util.FeatureFlagUtils;
 
 import androidx.preference.Preference;
 import androidx.test.core.app.ApplicationProvider;
@@ -111,8 +106,6 @@
 
     @Before
     public void setUp() {
-        FeatureFlagUtils.setEnabled(mContext,
-                FeatureFlagUtils.SETTINGS_ACCESSIBILITY_HEARING_AID_PAGE, true);
         mShadowApplication = shadowOf((Application) ApplicationProvider.getApplicationContext());
         setupEnvironment();
 
@@ -252,37 +245,6 @@
     }
 
     @Test
-    public void handleHearingAidPreferenceClick_noHearingAid_launchHearingAidInstructionDialog() {
-        FeatureFlagUtils.setEnabled(mContext,
-                FeatureFlagUtils.SETTINGS_ACCESSIBILITY_HEARING_AID_PAGE, false);
-        mPreferenceController = spy(new AccessibilityHearingAidPreferenceController(mContext,
-                HEARING_AID_PREFERENCE));
-        mPreferenceController.setPreference(mHearingAidPreference);
-        doNothing().when(mPreferenceController).launchHearingAidInstructionDialog();
-
-        mPreferenceController.handlePreferenceTreeClick(mHearingAidPreference);
-
-        verify(mPreferenceController).launchHearingAidInstructionDialog();
-    }
-
-    @Test
-    public void handleHearingAidPreferenceClick_withHearingAid_launchBluetoothDeviceDetailSetting
-            () {
-        FeatureFlagUtils.setEnabled(mContext,
-                FeatureFlagUtils.SETTINGS_ACCESSIBILITY_HEARING_AID_PAGE, false);
-        mPreferenceController = spy(new AccessibilityHearingAidPreferenceController(mContext,
-                HEARING_AID_PREFERENCE));
-        mPreferenceController.setPreference(mHearingAidPreference);
-        when(mHearingAidProfile.getConnectedDevices()).thenReturn(generateHearingAidDeviceList());
-        when(mCachedBluetoothDevice.getDevice()).thenReturn(mBluetoothDevice);
-        doNothing().when(mPreferenceController).launchBluetoothDeviceDetailSetting(any());
-
-        mPreferenceController.handlePreferenceTreeClick(mHearingAidPreference);
-
-        verify(mPreferenceController).launchBluetoothDeviceDetailSetting(mCachedBluetoothDevice);
-    }
-
-    @Test
     public void onServiceConnected_onHearingAidProfileConnected_updateSummary() {
         when(mCachedBluetoothDevice.getDeviceSide()).thenReturn(
                 HearingAidInfo.DeviceSide.SIDE_LEFT);
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHearingDeviceControlsControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHearingDeviceControlsControllerTest.java
index bf4e055..364d299 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHearingDeviceControlsControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsHearingDeviceControlsControllerTest.java
@@ -23,7 +23,6 @@
 
 import android.content.Context;
 import android.content.Intent;
-import android.util.FeatureFlagUtils;
 
 import androidx.preference.Preference;
 
@@ -63,8 +62,6 @@
 
     @Test
     public void isAvailable_isHearingAidDevice_available() {
-        FeatureFlagUtils.setEnabled(mContext,
-                FeatureFlagUtils.SETTINGS_ACCESSIBILITY_HEARING_AID_PAGE, true);
         when(mCachedDevice.isHearingAidDevice()).thenReturn(true);
 
         assertThat(mController.isAvailable()).isTrue();
@@ -72,8 +69,6 @@
 
     @Test
     public void isAvailable_isNotHearingAidDevice_notAvailable() {
-        FeatureFlagUtils.setEnabled(mContext,
-                FeatureFlagUtils.SETTINGS_ACCESSIBILITY_HEARING_AID_PAGE, true);
         when(mCachedDevice.isHearingAidDevice()).thenReturn(false);
 
         assertThat(mController.isAvailable()).isFalse();
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/detectors/IncompatibleChargerDetectorTest.java b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/detectors/IncompatibleChargerDetectorTest.java
index 3f65a67..c0f6108 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/detectors/IncompatibleChargerDetectorTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/detectors/IncompatibleChargerDetectorTest.java
@@ -81,6 +81,7 @@
         when(mUsbPort.getStatus()).thenReturn(mUsbPortStatus);
         when(mUsbPort.supportsComplianceWarnings()).thenReturn(true);
         when(mUsbPortStatus.isConnected()).thenReturn(true);
-        when(mUsbPortStatus.getComplianceWarnings()).thenReturn(new int[] {1});
+        when(mUsbPortStatus.getComplianceWarnings())
+                .thenReturn(new int[] {UsbPortStatus.COMPLIANCE_WARNING_DEBUG_ACCESSORY});
     }
 }