diff options
| -rw-r--r-- | packages/SystemUI/aconfig/systemui.aconfig | 10 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java | 33 |
2 files changed, 41 insertions, 2 deletions
diff --git a/packages/SystemUI/aconfig/systemui.aconfig b/packages/SystemUI/aconfig/systemui.aconfig index a984b7d43bb6..1c29db128a8c 100644 --- a/packages/SystemUI/aconfig/systemui.aconfig +++ b/packages/SystemUI/aconfig/systemui.aconfig @@ -1559,6 +1559,16 @@ flag { } flag { + name: "hide_ringer_button_in_single_volume_mode" + namespace: "systemui" + description: "When the device is in single volume mode, hide the ringer button because it doesn't work" + bug: "374870615" + metadata { + purpose: PURPOSE_BUGFIX + } +} + +flag { name: "qs_tile_detailed_view" namespace: "systemui" description: "Enables the tile detailed view UI." diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java index 3d2ebf29cbb9..07509e6368fb 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java @@ -64,6 +64,8 @@ import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.graphics.drawable.RotateDrawable; +import android.graphics.drawable.ShapeDrawable; +import android.graphics.drawable.shapes.RoundRectShape; import android.media.AudioManager; import android.media.AudioSystem; import android.os.Debug; @@ -115,6 +117,7 @@ import com.android.internal.jank.InteractionJankMonitor; import com.android.internal.view.RotationPolicy; import com.android.settingslib.Utils; import com.android.systemui.Dumpable; +import com.android.systemui.Flags; import com.android.systemui.Prefs; import com.android.systemui.dump.DumpManager; import com.android.systemui.haptics.slider.HapticSliderViewBinder; @@ -656,6 +659,11 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, mRingerIcon = mRinger.findViewById(R.id.ringer_icon); } + if (Flags.hideRingerButtonInSingleVolumeMode() && AudioSystem.isSingleVolume(mContext)) { + mRingerAndDrawerContainer.setVisibility(INVISIBLE); + mRinger.setVisibility(INVISIBLE); + } + mSelectedRingerIcon = mDialog.findViewById(R.id.volume_new_ringer_active_icon); mSelectedRingerContainer = mDialog.findViewById( R.id.volume_new_ringer_active_icon_container); @@ -2341,10 +2349,31 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable, return; } - final ColorDrawable solidDrawable = new ColorDrawable( + LayerDrawable background; + // mRingerAndDrawerContainer has rounded corner. + // But when it's not visible, mTopContainer needs to have rounded corner. + if (Flags.hideRingerButtonInSingleVolumeMode() + && mRingerAndDrawerContainer.getVisibility() != VISIBLE + ) { + float[] radius = new float[] { + mDialogCornerRadius, mDialogCornerRadius, // Top-left corner + mDialogCornerRadius, mDialogCornerRadius, // Top-right corner + 0, 0, // Bottom-right corner + 0, 0 // Bottom-left corner + }; + + ShapeDrawable roundedDrawable = new ShapeDrawable( + new RoundRectShape(radius, null, null)); + roundedDrawable.getPaint().setColor(Utils.getColorAttrDefaultColor( + mContext, com.android.internal.R.attr.colorSurface)); + + background = new LayerDrawable(new Drawable[] { roundedDrawable }); + } else { + final ColorDrawable solidDrawable = new ColorDrawable( Utils.getColorAttrDefaultColor(mContext, com.android.internal.R.attr.colorSurface)); - final LayerDrawable background = new LayerDrawable(new Drawable[] { solidDrawable }); + background = new LayerDrawable(new Drawable[] { solidDrawable }); + } // Size the solid color to match the primary volume row. In landscape, extend it upwards // slightly so that it fills in the bottom corners of the ringer icon, whose background is |