Loading aconfig/settings_bluetooth_declarations.aconfig +0 −7 Original line number Diff line number Diff line Loading @@ -8,13 +8,6 @@ flag { bug: "305636727" } flag { name: "enable_bluetooth_profile_toggle_visibility_checker" namespace: "pixel_cross_device_control" description: "Gates whether to enable checker for bluetooth profile toggle visibility" bug: "321178209" } flag { name: "hide_le_audio_toggle_for_le_audio_only_device" namespace: "pixel_cross_device_control" Loading src/com/android/settings/bluetooth/BluetoothDetailsCompanionAppsController.java +1 −5 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import android.net.Uri; import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; import android.provider.DeviceConfig; import android.text.TextUtils; import android.util.Log; Loading @@ -42,7 +41,6 @@ import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceScreen; import com.android.settings.R; import com.android.settings.core.SettingsUIDeviceConfig; import com.android.settings.overlay.FeatureFactory; import com.android.settingslib.bluetooth.CachedBluetoothDevice; import com.android.settingslib.core.lifecycle.Lifecycle; Loading Loading @@ -187,11 +185,9 @@ public class BluetoothDetailsCompanionAppsController extends BluetoothDetailsCon // If the device is FastPair, remove CDM companion apps. final BluetoothFeatureProvider bluetoothFeatureProvider = FeatureFactory.getFeatureFactory() .getBluetoothFeatureProvider(); final boolean sliceEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SETTINGS_UI, SettingsUIDeviceConfig.BT_SLICE_SETTINGS_ENABLED, true); final Uri settingsUri = bluetoothFeatureProvider.getBluetoothDeviceSettingsUri( mCachedDevice.getDevice()); if (sliceEnabled && settingsUri != null) { if (settingsUri != null) { container.removeAll(); return; } Loading src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java +15 −31 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.content.Context; import android.os.SystemProperties; import android.provider.DeviceConfig; import android.sysprop.BluetoothProperties; import android.text.TextUtils; import android.util.Log; Loading @@ -36,7 +35,6 @@ import androidx.preference.SwitchPreferenceCompat; import androidx.preference.TwoStatePreference; import com.android.settings.R; import com.android.settings.core.SettingsUIDeviceConfig; import com.android.settings.flags.Flags; import com.android.settings.overlay.FeatureFactory; import com.android.settingslib.bluetooth.A2dpProfile; Loading Loading @@ -92,7 +90,6 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll private Set<CachedBluetoothDevice> mCachedDeviceGroup; private Map<String, List<CachedBluetoothDevice>> mProfileDeviceMap = new HashMap<String, List<CachedBluetoothDevice>>(); private boolean mIsLeContactSharingEnabled = false; private boolean mIsLeAudioToggleEnabled = false; private boolean mIsLeAudioOnlyDevice = false; Loading Loading @@ -172,10 +169,6 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll boolean isBusy = deviceList != null && deviceList.stream().anyMatch(item -> item.isBusy()); profilePref.setEnabled(!isBusy); } else if (profile instanceof PbapServerProfile && isLeAudioEnabled && !mIsLeContactSharingEnabled) { profilePref.setEnabled(false); } else { profilePref.setEnabled(!mCachedDevice.isBusy()); } Loading Loading @@ -531,15 +524,12 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll } private void updateLeAudioConfig() { mIsLeContactSharingEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SETTINGS_UI, SettingsUIDeviceConfig.BT_LE_AUDIO_CONTACT_SHARING_ENABLED, true); boolean isLeAudioToggleVisible = SystemProperties.getBoolean( LE_AUDIO_TOGGLE_VISIBLE_PROPERTY, LE_AUDIO_TOGGLE_VISIBLE_DEFAULT_VALUE); boolean isLeEnabledByDefault = SystemProperties.getBoolean(LE_AUDIO_CONNECTION_BY_DEFAULT_PROPERTY, true); mIsLeAudioToggleEnabled = isLeAudioToggleVisible || isLeEnabledByDefault; Log.d(TAG, "BT_LE_AUDIO_CONTACT_SHARING_ENABLED:" + mIsLeContactSharingEnabled + ", LE_AUDIO_TOGGLE_VISIBLE_PROPERTY:" + isLeAudioToggleVisible Log.d(TAG, "LE_AUDIO_TOGGLE_VISIBLE_PROPERTY:" + isLeAudioToggleVisible + ", LE_AUDIO_CONNECTION_BY_DEFAULT_PROPERTY:" + isLeEnabledByDefault); } Loading Loading @@ -572,7 +562,6 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll */ @Override protected void refresh() { if (Flags.enableBluetoothProfileToggleVisibilityChecker()) { ThreadUtils.postOnBackgroundThread( () -> { mInvisiblePreferenceKey.set( Loading @@ -582,9 +571,6 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll mContext, mCachedDevice.getDevice())); ThreadUtils.postOnMainThread(this::refreshUi); }); } else { refreshUi(); } } private void refreshUi() { Loading Loading @@ -619,7 +605,6 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll mProfilesContainer.addPreference(preference); } if (Flags.enableBluetoothProfileToggleVisibilityChecker()) { Set<String> invisibleKeys = mInvisiblePreferenceKey.get(); if (invisibleKeys != null) { for (int i = 0; i < mProfilesContainer.getPreferenceCount(); ++i) { Loading @@ -628,7 +613,6 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll } } } } @Override public String getPreferenceKey() { Loading src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java +9 −16 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import android.hardware.input.InputManager; import android.net.Uri; import android.os.Bundle; import android.os.UserManager; import android.provider.DeviceConfig; import android.text.TextUtils; import android.util.FeatureFlagUtils; import android.util.Log; Loading @@ -51,7 +50,6 @@ import com.android.settings.R; import com.android.settings.bluetooth.ui.model.FragmentTypeModel; import com.android.settings.bluetooth.ui.view.DeviceDetailsFragmentFormatter; import com.android.settings.connecteddevice.stylus.StylusDevicesController; import com.android.settings.core.SettingsUIDeviceConfig; import com.android.settings.dashboard.RestrictedDashboardFragment; import com.android.settings.flags.Flags; import com.android.settings.inputmethod.KeyboardSettingsPreferenceController; Loading Loading @@ -233,17 +231,13 @@ public class BluetoothDeviceDetailsFragment extends RestrictedDashboardFragment final BluetoothFeatureProvider featureProvider = FeatureFactory.getFeatureFactory().getBluetoothFeatureProvider(); final boolean sliceEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SETTINGS_UI, SettingsUIDeviceConfig.BT_SLICE_SETTINGS_ENABLED, true); getController( BlockingPrefWithSliceController.class, controller -> controller.setSliceUri( sliceEnabled ? featureProvider.getBluetoothDeviceSettingsUri( mCachedDevice.getDevice()) : null)); featureProvider.getBluetoothDeviceSettingsUri( mCachedDevice.getDevice()))); mManager.getEventManager().registerCallback(mBluetoothCallback); mBluetoothAdapter.addOnMetadataChangedListener( Loading Loading @@ -272,8 +266,6 @@ public class BluetoothDeviceDetailsFragment extends RestrictedDashboardFragment private void updateExtraControlUri(int viewWidth) { BluetoothFeatureProvider featureProvider = FeatureFactory.getFeatureFactory().getBluetoothFeatureProvider(); boolean sliceEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SETTINGS_UI, SettingsUIDeviceConfig.BT_SLICE_SETTINGS_ENABLED, true); Uri controlUri = null; String uri = featureProvider.getBluetoothDeviceControlUri(mCachedDevice.getDevice()); if (!TextUtils.isEmpty(uri)) { Loading @@ -286,13 +278,14 @@ public class BluetoothDeviceDetailsFragment extends RestrictedDashboardFragment mExtraControlUriLoaded |= controlUri != null; Uri finalControlUri = controlUri; getController(SlicePreferenceController.class, controller -> { controller.setSliceUri(sliceEnabled ? finalControlUri : null); getController( SlicePreferenceController.class, controller -> { controller.setSliceUri(finalControlUri); controller.onStart(); controller.displayPreference(getPreferenceScreen()); }); // Temporarily fix the issue that the page will be automatically scrolled to a wrong // position when entering the page. This will make sure the bluetooth header is shown on top // of the page. Loading src/com/android/settings/bluetooth/BluetoothPairingController.java +2 −22 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.content.Context; import android.content.Intent; import android.provider.DeviceConfig; import android.text.Editable; import android.util.Log; import android.widget.CompoundButton; Loading @@ -30,7 +29,6 @@ import androidx.annotation.VisibleForTesting; import com.android.settings.R; import com.android.settings.bluetooth.BluetoothPairingDialogFragment.BluetoothPairingDialogListener; import com.android.settings.core.SettingsUIDeviceConfig; import com.android.settingslib.bluetooth.BluetoothUtils; import com.android.settingslib.bluetooth.CachedBluetoothDevice; import com.android.settingslib.bluetooth.LocalBluetoothManager; Loading Loading @@ -71,7 +69,6 @@ public class BluetoothPairingController implements OnCheckedChangeListener, private boolean mPbapAllowed; private boolean mIsCoordinatedSetMember; private boolean mIsLeAudio; private boolean mIsLeContactSharingEnabled; private boolean mIsLateBonding; /** Loading Loading @@ -106,7 +103,6 @@ public class BluetoothPairingController implements OnCheckedChangeListener, mIsCoordinatedSetMember = false; mIsLeAudio = false; mIsLeContactSharingEnabled = true; if (cachedDevice != null) { mIsCoordinatedSetMember = cachedDevice.isCoordinatedSetMemberDevice(); Loading @@ -115,13 +111,7 @@ public class BluetoothPairingController implements OnCheckedChangeListener, mIsLeAudio = true; } } mIsLeContactSharingEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SETTINGS_UI, SettingsUIDeviceConfig.BT_LE_AUDIO_CONTACT_SHARING_ENABLED, true); Log.d(TAG, "BT_LE_AUDIO_CONTACT_SHARING_ENABLED is " + mIsLeContactSharingEnabled + " isCooridnatedSetMember " + mIsCoordinatedSetMember); Log.d(TAG, "isCooridnatedSetMember: " + mIsCoordinatedSetMember); } } Loading Loading @@ -221,23 +211,13 @@ public class BluetoothPairingController implements OnCheckedChangeListener, return mIsLeAudio; } @VisibleForTesting boolean isLeContactSharingEnabled() { return mIsLeContactSharingEnabled; } /** * A method whether the device allows to show the le audio's contact sharing. * * @return A boolean whether the device allows to show the contact sharing. */ public boolean isContactSharingVisible() { boolean isContactSharingVisible = !isProfileReady(); // If device do not support the ContactSharing of LE audio device, hiding ContactSharing UI if (isLeAudio() && !isLeContactSharingEnabled()) { isContactSharingVisible = false; } return isContactSharingVisible; return !isProfileReady(); } /** Loading Loading
aconfig/settings_bluetooth_declarations.aconfig +0 −7 Original line number Diff line number Diff line Loading @@ -8,13 +8,6 @@ flag { bug: "305636727" } flag { name: "enable_bluetooth_profile_toggle_visibility_checker" namespace: "pixel_cross_device_control" description: "Gates whether to enable checker for bluetooth profile toggle visibility" bug: "321178209" } flag { name: "hide_le_audio_toggle_for_le_audio_only_device" namespace: "pixel_cross_device_control" Loading
src/com/android/settings/bluetooth/BluetoothDetailsCompanionAppsController.java +1 −5 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import android.net.Uri; import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; import android.provider.DeviceConfig; import android.text.TextUtils; import android.util.Log; Loading @@ -42,7 +41,6 @@ import androidx.preference.PreferenceFragmentCompat; import androidx.preference.PreferenceScreen; import com.android.settings.R; import com.android.settings.core.SettingsUIDeviceConfig; import com.android.settings.overlay.FeatureFactory; import com.android.settingslib.bluetooth.CachedBluetoothDevice; import com.android.settingslib.core.lifecycle.Lifecycle; Loading Loading @@ -187,11 +185,9 @@ public class BluetoothDetailsCompanionAppsController extends BluetoothDetailsCon // If the device is FastPair, remove CDM companion apps. final BluetoothFeatureProvider bluetoothFeatureProvider = FeatureFactory.getFeatureFactory() .getBluetoothFeatureProvider(); final boolean sliceEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SETTINGS_UI, SettingsUIDeviceConfig.BT_SLICE_SETTINGS_ENABLED, true); final Uri settingsUri = bluetoothFeatureProvider.getBluetoothDeviceSettingsUri( mCachedDevice.getDevice()); if (sliceEnabled && settingsUri != null) { if (settingsUri != null) { container.removeAll(); return; } Loading
src/com/android/settings/bluetooth/BluetoothDetailsProfilesController.java +15 −31 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.content.Context; import android.os.SystemProperties; import android.provider.DeviceConfig; import android.sysprop.BluetoothProperties; import android.text.TextUtils; import android.util.Log; Loading @@ -36,7 +35,6 @@ import androidx.preference.SwitchPreferenceCompat; import androidx.preference.TwoStatePreference; import com.android.settings.R; import com.android.settings.core.SettingsUIDeviceConfig; import com.android.settings.flags.Flags; import com.android.settings.overlay.FeatureFactory; import com.android.settingslib.bluetooth.A2dpProfile; Loading Loading @@ -92,7 +90,6 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll private Set<CachedBluetoothDevice> mCachedDeviceGroup; private Map<String, List<CachedBluetoothDevice>> mProfileDeviceMap = new HashMap<String, List<CachedBluetoothDevice>>(); private boolean mIsLeContactSharingEnabled = false; private boolean mIsLeAudioToggleEnabled = false; private boolean mIsLeAudioOnlyDevice = false; Loading Loading @@ -172,10 +169,6 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll boolean isBusy = deviceList != null && deviceList.stream().anyMatch(item -> item.isBusy()); profilePref.setEnabled(!isBusy); } else if (profile instanceof PbapServerProfile && isLeAudioEnabled && !mIsLeContactSharingEnabled) { profilePref.setEnabled(false); } else { profilePref.setEnabled(!mCachedDevice.isBusy()); } Loading Loading @@ -531,15 +524,12 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll } private void updateLeAudioConfig() { mIsLeContactSharingEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SETTINGS_UI, SettingsUIDeviceConfig.BT_LE_AUDIO_CONTACT_SHARING_ENABLED, true); boolean isLeAudioToggleVisible = SystemProperties.getBoolean( LE_AUDIO_TOGGLE_VISIBLE_PROPERTY, LE_AUDIO_TOGGLE_VISIBLE_DEFAULT_VALUE); boolean isLeEnabledByDefault = SystemProperties.getBoolean(LE_AUDIO_CONNECTION_BY_DEFAULT_PROPERTY, true); mIsLeAudioToggleEnabled = isLeAudioToggleVisible || isLeEnabledByDefault; Log.d(TAG, "BT_LE_AUDIO_CONTACT_SHARING_ENABLED:" + mIsLeContactSharingEnabled + ", LE_AUDIO_TOGGLE_VISIBLE_PROPERTY:" + isLeAudioToggleVisible Log.d(TAG, "LE_AUDIO_TOGGLE_VISIBLE_PROPERTY:" + isLeAudioToggleVisible + ", LE_AUDIO_CONNECTION_BY_DEFAULT_PROPERTY:" + isLeEnabledByDefault); } Loading Loading @@ -572,7 +562,6 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll */ @Override protected void refresh() { if (Flags.enableBluetoothProfileToggleVisibilityChecker()) { ThreadUtils.postOnBackgroundThread( () -> { mInvisiblePreferenceKey.set( Loading @@ -582,9 +571,6 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll mContext, mCachedDevice.getDevice())); ThreadUtils.postOnMainThread(this::refreshUi); }); } else { refreshUi(); } } private void refreshUi() { Loading Loading @@ -619,7 +605,6 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll mProfilesContainer.addPreference(preference); } if (Flags.enableBluetoothProfileToggleVisibilityChecker()) { Set<String> invisibleKeys = mInvisiblePreferenceKey.get(); if (invisibleKeys != null) { for (int i = 0; i < mProfilesContainer.getPreferenceCount(); ++i) { Loading @@ -628,7 +613,6 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll } } } } @Override public String getPreferenceKey() { Loading
src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragment.java +9 −16 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import android.hardware.input.InputManager; import android.net.Uri; import android.os.Bundle; import android.os.UserManager; import android.provider.DeviceConfig; import android.text.TextUtils; import android.util.FeatureFlagUtils; import android.util.Log; Loading @@ -51,7 +50,6 @@ import com.android.settings.R; import com.android.settings.bluetooth.ui.model.FragmentTypeModel; import com.android.settings.bluetooth.ui.view.DeviceDetailsFragmentFormatter; import com.android.settings.connecteddevice.stylus.StylusDevicesController; import com.android.settings.core.SettingsUIDeviceConfig; import com.android.settings.dashboard.RestrictedDashboardFragment; import com.android.settings.flags.Flags; import com.android.settings.inputmethod.KeyboardSettingsPreferenceController; Loading Loading @@ -233,17 +231,13 @@ public class BluetoothDeviceDetailsFragment extends RestrictedDashboardFragment final BluetoothFeatureProvider featureProvider = FeatureFactory.getFeatureFactory().getBluetoothFeatureProvider(); final boolean sliceEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SETTINGS_UI, SettingsUIDeviceConfig.BT_SLICE_SETTINGS_ENABLED, true); getController( BlockingPrefWithSliceController.class, controller -> controller.setSliceUri( sliceEnabled ? featureProvider.getBluetoothDeviceSettingsUri( mCachedDevice.getDevice()) : null)); featureProvider.getBluetoothDeviceSettingsUri( mCachedDevice.getDevice()))); mManager.getEventManager().registerCallback(mBluetoothCallback); mBluetoothAdapter.addOnMetadataChangedListener( Loading Loading @@ -272,8 +266,6 @@ public class BluetoothDeviceDetailsFragment extends RestrictedDashboardFragment private void updateExtraControlUri(int viewWidth) { BluetoothFeatureProvider featureProvider = FeatureFactory.getFeatureFactory().getBluetoothFeatureProvider(); boolean sliceEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SETTINGS_UI, SettingsUIDeviceConfig.BT_SLICE_SETTINGS_ENABLED, true); Uri controlUri = null; String uri = featureProvider.getBluetoothDeviceControlUri(mCachedDevice.getDevice()); if (!TextUtils.isEmpty(uri)) { Loading @@ -286,13 +278,14 @@ public class BluetoothDeviceDetailsFragment extends RestrictedDashboardFragment mExtraControlUriLoaded |= controlUri != null; Uri finalControlUri = controlUri; getController(SlicePreferenceController.class, controller -> { controller.setSliceUri(sliceEnabled ? finalControlUri : null); getController( SlicePreferenceController.class, controller -> { controller.setSliceUri(finalControlUri); controller.onStart(); controller.displayPreference(getPreferenceScreen()); }); // Temporarily fix the issue that the page will be automatically scrolled to a wrong // position when entering the page. This will make sure the bluetooth header is shown on top // of the page. Loading
src/com/android/settings/bluetooth/BluetoothPairingController.java +2 −22 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothProfile; import android.content.Context; import android.content.Intent; import android.provider.DeviceConfig; import android.text.Editable; import android.util.Log; import android.widget.CompoundButton; Loading @@ -30,7 +29,6 @@ import androidx.annotation.VisibleForTesting; import com.android.settings.R; import com.android.settings.bluetooth.BluetoothPairingDialogFragment.BluetoothPairingDialogListener; import com.android.settings.core.SettingsUIDeviceConfig; import com.android.settingslib.bluetooth.BluetoothUtils; import com.android.settingslib.bluetooth.CachedBluetoothDevice; import com.android.settingslib.bluetooth.LocalBluetoothManager; Loading Loading @@ -71,7 +69,6 @@ public class BluetoothPairingController implements OnCheckedChangeListener, private boolean mPbapAllowed; private boolean mIsCoordinatedSetMember; private boolean mIsLeAudio; private boolean mIsLeContactSharingEnabled; private boolean mIsLateBonding; /** Loading Loading @@ -106,7 +103,6 @@ public class BluetoothPairingController implements OnCheckedChangeListener, mIsCoordinatedSetMember = false; mIsLeAudio = false; mIsLeContactSharingEnabled = true; if (cachedDevice != null) { mIsCoordinatedSetMember = cachedDevice.isCoordinatedSetMemberDevice(); Loading @@ -115,13 +111,7 @@ public class BluetoothPairingController implements OnCheckedChangeListener, mIsLeAudio = true; } } mIsLeContactSharingEnabled = DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SETTINGS_UI, SettingsUIDeviceConfig.BT_LE_AUDIO_CONTACT_SHARING_ENABLED, true); Log.d(TAG, "BT_LE_AUDIO_CONTACT_SHARING_ENABLED is " + mIsLeContactSharingEnabled + " isCooridnatedSetMember " + mIsCoordinatedSetMember); Log.d(TAG, "isCooridnatedSetMember: " + mIsCoordinatedSetMember); } } Loading Loading @@ -221,23 +211,13 @@ public class BluetoothPairingController implements OnCheckedChangeListener, return mIsLeAudio; } @VisibleForTesting boolean isLeContactSharingEnabled() { return mIsLeContactSharingEnabled; } /** * A method whether the device allows to show the le audio's contact sharing. * * @return A boolean whether the device allows to show the contact sharing. */ public boolean isContactSharingVisible() { boolean isContactSharingVisible = !isProfileReady(); // If device do not support the ContactSharing of LE audio device, hiding ContactSharing UI if (isLeAudio() && !isLeContactSharingEnabled()) { isContactSharingVisible = false; } return isContactSharingVisible; return !isProfileReady(); } /** Loading