diff --git a/res/drawable/ambient_expand_icon_background.xml b/res/drawable/ambient_expand_icon_background.xml
new file mode 100644
index 00000000000..145ea77e8d3
--- /dev/null
+++ b/res/drawable/ambient_expand_icon_background.xml
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/res/drawable/ambient_expand_icon_background_expressive.xml b/res/drawable/ambient_expand_icon_background_expressive.xml
new file mode 100644
index 00000000000..b9acf7c24c9
--- /dev/null
+++ b/res/drawable/ambient_expand_icon_background_expressive.xml
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/res/drawable/ambient_icon_background.xml b/res/drawable/ambient_icon_background.xml
new file mode 100644
index 00000000000..703fd3bf023
--- /dev/null
+++ b/res/drawable/ambient_icon_background.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/drawable/ambient_icon_background_expressive.xml b/res/drawable/ambient_icon_background_expressive.xml
new file mode 100644
index 00000000000..8dcd2a98fb3
--- /dev/null
+++ b/res/drawable/ambient_icon_background_expressive.xml
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout-v36/preference_ambient_volume_expressive.xml b/res/layout-v36/preference_ambient_volume_expressive.xml
new file mode 100644
index 00000000000..cd5e276de20
--- /dev/null
+++ b/res/layout-v36/preference_ambient_volume_expressive.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/res/layout/preference_ambient_volume.xml b/res/layout/preference_ambient_volume.xml
index a8595c64dd4..212dbec354b 100644
--- a/res/layout/preference_ambient_volume.xml
+++ b/res/layout/preference_ambient_volume.xml
@@ -17,6 +17,7 @@
-
+ android:layout_height="48dp"
+ android:gravity="center"
+ android:layout_marginEnd="@dimen/settingslib_expressive_space_extrasmall6"
+ android:filterTouchesWhenObscured="false">
+
+
+ android:src="@drawable/ic_keyboard_arrow_down"
+ android:background="@drawable/ambient_expand_icon_background"/>
\ No newline at end of file
diff --git a/src/com/android/settings/bluetooth/AmbientVolumePreference.java b/src/com/android/settings/bluetooth/AmbientVolumePreference.java
index 0230205ce0d..8e491769953 100644
--- a/src/com/android/settings/bluetooth/AmbientVolumePreference.java
+++ b/src/com/android/settings/bluetooth/AmbientVolumePreference.java
@@ -39,6 +39,7 @@ import androidx.preference.PreferenceViewHolder;
import com.android.settings.R;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.bluetooth.AmbientVolumeUi;
+import com.android.settingslib.widget.SettingsThemeHelper;
import com.android.settingslib.widget.SliderPreference;
import com.google.common.collect.BiMap;
@@ -68,6 +69,8 @@ public class AmbientVolumePreference extends PreferenceGroup implements AmbientV
@Nullable
private View mExpandIcon;
@Nullable
+ private View mVolumeIconFrame;
+ @Nullable
private ImageView mVolumeIcon;
private boolean mExpandable = true;
private boolean mExpanded = false;
@@ -95,7 +98,10 @@ public class AmbientVolumePreference extends PreferenceGroup implements AmbientV
public AmbientVolumePreference(@NonNull Context context) {
super(context, null);
- setLayoutResource(R.layout.preference_ambient_volume);
+ int resId = SettingsThemeHelper.isExpressiveTheme(context)
+ ? R.layout.preference_ambient_volume_expressive
+ : R.layout.preference_ambient_volume;
+ setLayoutResource(resId);
setIcon(com.android.settingslib.R.drawable.ic_ambient_volume);
setTitle(R.string.bluetooth_ambient_volume_control);
setSelectable(false);
@@ -110,8 +116,12 @@ public class AmbientVolumePreference extends PreferenceGroup implements AmbientV
mVolumeIcon = holder.itemView.requireViewById(com.android.internal.R.id.icon);
mVolumeIcon.getDrawable().mutate().setTint(getContext().getColor(
com.android.internal.R.color.materialColorOnPrimaryContainer));
- final View iconView = holder.itemView.requireViewById(R.id.icon_frame);
- iconView.setOnClickListener(v -> {
+ mVolumeIconFrame = holder.itemView.requireViewById(R.id.icon_frame);
+ int volumeIconBackgroundResId = SettingsThemeHelper.isExpressiveTheme(getContext())
+ ? R.drawable.ambient_icon_background_expressive
+ : R.drawable.ambient_icon_background;
+ mVolumeIconFrame.setBackgroundResource(volumeIconBackgroundResId);
+ mVolumeIconFrame.setOnClickListener(v -> {
if (!mMutable) {
return;
}
@@ -313,7 +323,7 @@ public class AmbientVolumePreference extends PreferenceGroup implements AmbientV
}
private void updateVolumeIcon() {
- if (mVolumeIcon == null) {
+ if (mVolumeIcon == null || mVolumeIconFrame == null) {
return;
}
mVolumeIcon.setImageLevel(mMuted ? 0 : mVolumeLevel);
@@ -321,10 +331,10 @@ public class AmbientVolumePreference extends PreferenceGroup implements AmbientV
final int stringRes = mMuted ? R.string.bluetooth_ambient_volume_unmute
: R.string.bluetooth_ambient_volume_mute;
mVolumeIcon.setContentDescription(getContext().getString(stringRes));
- mVolumeIcon.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
+ mVolumeIconFrame.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_YES);
} else {
mVolumeIcon.setContentDescription(null);
- mVolumeIcon.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
+ mVolumeIconFrame.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
}
}
diff --git a/src/com/android/settings/bluetooth/BluetoothDetailsAmbientVolumePreferenceController.java b/src/com/android/settings/bluetooth/BluetoothDetailsAmbientVolumePreferenceController.java
index 0a2b2178c20..123627d18db 100644
--- a/src/com/android/settings/bluetooth/BluetoothDetailsAmbientVolumePreferenceController.java
+++ b/src/com/android/settings/bluetooth/BluetoothDetailsAmbientVolumePreferenceController.java
@@ -20,6 +20,7 @@ import static com.android.settings.bluetooth.BluetoothDetailsHearingDeviceContro
import static com.android.settings.bluetooth.BluetoothDetailsHearingDeviceController.ORDER_AMBIENT_VOLUME;
import android.content.Context;
+import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -133,11 +134,17 @@ public class BluetoothDetailsAmbientVolumePreferenceController extends Bluetooth
@Override
public boolean isAvailable() {
- return mCachedDevice.isHearingDevice()
- && mCachedDevice.getProfiles().stream().anyMatch(
- profile -> profile instanceof VolumeControlProfile)
- && mAmbientUiController != null
- && mAmbientUiController.isAmbientControlAvailable();
+ boolean isHearingDevice = mCachedDevice.isHearingDevice();
+ boolean supportVcp = mCachedDevice.getProfiles().stream().anyMatch(
+ profile -> profile instanceof VolumeControlProfile);
+ boolean hasAmbientControl =
+ mAmbientUiController != null && mAmbientUiController.isAmbientControlAvailable();
+ if (DEBUG) {
+ Log.v(TAG, "isAvailable, isHearingDevice=" + isHearingDevice
+ + ", supportVcp=" + supportVcp
+ + ", hasAmbientControl=" + hasAmbientControl);
+ }
+ return isHearingDevice && supportVcp && hasAmbientControl;
}
@Nullable