diff --git a/packages/SystemUI/res/drawable/ic_ring_volume.xml b/packages/SystemUI/res/drawable/ic_ring_volume.xml deleted file mode 100644 index 343fe5d4cb698..0000000000000 --- a/packages/SystemUI/res/drawable/ic_ring_volume.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - \ No newline at end of file diff --git a/packages/SystemUI/res/drawable/ic_ring_volume_off.xml b/packages/SystemUI/res/drawable/ic_ring_volume_off.xml deleted file mode 100644 index 74f30d1a44d25..0000000000000 --- a/packages/SystemUI/res/drawable/ic_ring_volume_off.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - diff --git a/packages/SystemUI/res/drawable/ic_speaker_mute.xml b/packages/SystemUI/res/drawable/ic_speaker_mute.xml deleted file mode 100644 index 4e402cf530e4b..0000000000000 --- a/packages/SystemUI/res/drawable/ic_speaker_mute.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - \ No newline at end of file diff --git a/packages/SystemUI/res/drawable/ic_speaker_on.xml b/packages/SystemUI/res/drawable/ic_speaker_on.xml deleted file mode 100644 index 2a90e051b83bc..0000000000000 --- a/packages/SystemUI/res/drawable/ic_speaker_on.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - \ No newline at end of file diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java index 63b98bb841358..0d9627248a287 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogImpl.java @@ -72,7 +72,6 @@ import android.os.Message; import android.os.SystemClock; import android.os.Trace; import android.os.VibrationEffect; -import android.provider.DeviceConfig; import android.provider.Settings; import android.provider.Settings.Global; import android.text.InputFilter; @@ -109,8 +108,6 @@ import android.widget.Toast; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import com.android.internal.annotations.VisibleForTesting; -import com.android.internal.config.sysui.SystemUiDeviceConfigFlags; import com.android.internal.graphics.drawable.BackgroundBlurDrawable; import com.android.internal.jank.InteractionJankMonitor; import com.android.internal.view.RotationPolicy; @@ -128,15 +125,11 @@ import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.util.AlphaTintDrawableWrapper; -import com.android.systemui.util.DeviceConfigProxy; import com.android.systemui.util.RoundedCornerProgressDrawable; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; -import java.util.Optional; -import java.util.Set; -import java.util.concurrent.Executor; import java.util.function.Consumer; /** @@ -193,9 +186,6 @@ public class VolumeDialogImpl implements VolumeDialog, private ViewGroup mDialogRowsView; private ViewGroup mRinger; - private DeviceConfigProxy mDeviceConfigProxy; - private Executor mExecutor; - /** * Container for the top part of the dialog, which contains the ringer, the ringer drawer, the * volume rows, and the ellipsis button. This does not include the live caption button. @@ -284,13 +274,6 @@ public class VolumeDialogImpl implements VolumeDialog, private BackgroundBlurDrawable mDialogRowsViewBackground; private final InteractionJankMonitor mInteractionJankMonitor; - private boolean mSeparateNotification; - - @VisibleForTesting - int mVolumeRingerIconDrawableId; - @VisibleForTesting - int mVolumeRingerMuteIconDrawableId; - public VolumeDialogImpl( Context context, VolumeDialogController volumeDialogController, @@ -300,9 +283,7 @@ public class VolumeDialogImpl implements VolumeDialog, MediaOutputDialogFactory mediaOutputDialogFactory, VolumePanelFactory volumePanelFactory, ActivityStarter activityStarter, - InteractionJankMonitor interactionJankMonitor, - DeviceConfigProxy deviceConfigProxy, - Executor executor) { + InteractionJankMonitor interactionJankMonitor) { mContext = new ContextThemeWrapper(context, R.style.volume_dialog_theme); mController = volumeDialogController; @@ -342,50 +323,6 @@ public class VolumeDialogImpl implements VolumeDialog, } initDimens(); - - mDeviceConfigProxy = deviceConfigProxy; - mExecutor = executor; - mSeparateNotification = mDeviceConfigProxy.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, false); - updateRingerModeIconSet(); - } - - /** - * If ringer and notification are the same stream (T and earlier), use notification-like bell - * icon set. - * If ringer and notification are separated, then use generic speaker icons. - */ - private void updateRingerModeIconSet() { - if (mSeparateNotification) { - mVolumeRingerIconDrawableId = R.drawable.ic_speaker_on; - mVolumeRingerMuteIconDrawableId = R.drawable.ic_speaker_mute; - } else { - mVolumeRingerIconDrawableId = R.drawable.ic_volume_ringer; - mVolumeRingerMuteIconDrawableId = R.drawable.ic_volume_ringer_mute; - } - - if (mRingerDrawerMuteIcon != null) { - mRingerDrawerMuteIcon.setImageResource(mVolumeRingerMuteIconDrawableId); - } - if (mRingerDrawerNormalIcon != null) { - mRingerDrawerNormalIcon.setImageResource(mVolumeRingerIconDrawableId); - } - } - - /** - * Change icon for ring stream (not ringer mode icon) - */ - private void updateRingRowIcon() { - Optional volumeRow = mRows.stream().filter(row -> row.stream == STREAM_RING) - .findFirst(); - if (volumeRow.isPresent()) { - VolumeRow volRow = volumeRow.get(); - volRow.iconRes = mSeparateNotification ? R.drawable.ic_ring_volume - : R.drawable.ic_volume_ringer; - volRow.iconMuteRes = mSeparateNotification ? R.drawable.ic_ring_volume_off - : R.drawable.ic_volume_ringer_mute; - volRow.setIcon(volRow.iconRes, mContext.getTheme()); - } } @Override @@ -402,9 +339,6 @@ public class VolumeDialogImpl implements VolumeDialog, mController.getState(); mConfigurationController.addCallback(this); - - mDeviceConfigProxy.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_SYSTEMUI, - mExecutor, this::onDeviceConfigChange); } @Override @@ -412,24 +346,6 @@ public class VolumeDialogImpl implements VolumeDialog, mController.removeCallback(mControllerCallbackH); mHandler.removeCallbacksAndMessages(null); mConfigurationController.removeCallback(this); - mDeviceConfigProxy.removeOnPropertiesChangedListener(this::onDeviceConfigChange); - } - - /** - * Update ringer mode icon based on the config - */ - private void onDeviceConfigChange(DeviceConfig.Properties properties) { - Set changeSet = properties.getKeyset(); - if (changeSet.contains(SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION)) { - boolean newVal = properties.getBoolean( - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, false); - if (newVal != mSeparateNotification) { - mSeparateNotification = newVal; - updateRingerModeIconSet(); - updateRingRowIcon(); - - } - } } @Override @@ -636,9 +552,6 @@ public class VolumeDialogImpl implements VolumeDialog, mRingerDrawerNormalIcon = mDialog.findViewById(R.id.volume_drawer_normal_icon); mRingerDrawerNewSelectionBg = mDialog.findViewById(R.id.volume_drawer_selection_background); - mRingerDrawerMuteIcon.setImageResource(mVolumeRingerMuteIconDrawableId); - mRingerDrawerNormalIcon.setImageResource(mVolumeRingerIconDrawableId); - setupRingerDrawer(); mODICaptionsView = mDialog.findViewById(R.id.odi_captions); @@ -662,14 +575,8 @@ public class VolumeDialogImpl implements VolumeDialog, addRow(AudioManager.STREAM_MUSIC, R.drawable.ic_volume_media, R.drawable.ic_volume_media_mute, true, true); if (!AudioSystem.isSingleVolume(mContext)) { - if (mSeparateNotification) { - addRow(AudioManager.STREAM_RING, R.drawable.ic_ring_volume, - R.drawable.ic_ring_volume_off, true, false); - } else { - addRow(AudioManager.STREAM_RING, R.drawable.ic_volume_ringer, - R.drawable.ic_volume_ringer, true, false); - } - + addRow(AudioManager.STREAM_RING, + R.drawable.ic_volume_ringer, R.drawable.ic_volume_ringer_mute, true, false); addRow(STREAM_ALARM, R.drawable.ic_alarm, R.drawable.ic_volume_alarm_mute, true, false); addRow(AudioManager.STREAM_VOICE_CALL, @@ -1625,8 +1532,8 @@ public class VolumeDialogImpl implements VolumeDialog, mRingerIcon.setTag(Events.ICON_STATE_VIBRATE); break; case AudioManager.RINGER_MODE_SILENT: - mRingerIcon.setImageResource(mVolumeRingerMuteIconDrawableId); - mSelectedRingerIcon.setImageResource(mVolumeRingerMuteIconDrawableId); + mRingerIcon.setImageResource(R.drawable.ic_volume_ringer_mute); + mSelectedRingerIcon.setImageResource(R.drawable.ic_volume_ringer_mute); mRingerIcon.setTag(Events.ICON_STATE_MUTE); addAccessibilityDescription(mRingerIcon, RINGER_MODE_SILENT, mContext.getString(R.string.volume_ringer_hint_unmute)); @@ -1635,14 +1542,14 @@ public class VolumeDialogImpl implements VolumeDialog, default: boolean muted = (mAutomute && ss.level == 0) || ss.muted; if (!isZenMuted && muted) { - mRingerIcon.setImageResource(mVolumeRingerMuteIconDrawableId); - mSelectedRingerIcon.setImageResource(mVolumeRingerMuteIconDrawableId); + mRingerIcon.setImageResource(R.drawable.ic_volume_ringer_mute); + mSelectedRingerIcon.setImageResource(R.drawable.ic_volume_ringer_mute); addAccessibilityDescription(mRingerIcon, RINGER_MODE_NORMAL, mContext.getString(R.string.volume_ringer_hint_unmute)); mRingerIcon.setTag(Events.ICON_STATE_MUTE); } else { - mRingerIcon.setImageResource(mVolumeRingerIconDrawableId); - mSelectedRingerIcon.setImageResource(mVolumeRingerIconDrawableId); + mRingerIcon.setImageResource(R.drawable.ic_volume_ringer); + mSelectedRingerIcon.setImageResource(R.drawable.ic_volume_ringer); if (mController.hasVibrator()) { addAccessibilityDescription(mRingerIcon, RINGER_MODE_NORMAL, mContext.getString(R.string.volume_ringer_hint_vibrate)); diff --git a/packages/SystemUI/src/com/android/systemui/volume/dagger/VolumeModule.java b/packages/SystemUI/src/com/android/systemui/volume/dagger/VolumeModule.java index 8f10fa619c140..c5792b923e485 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/dagger/VolumeModule.java +++ b/packages/SystemUI/src/com/android/systemui/volume/dagger/VolumeModule.java @@ -20,7 +20,6 @@ import android.content.Context; import android.media.AudioManager; import com.android.internal.jank.InteractionJankMonitor; -import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.media.dialog.MediaOutputDialogFactory; import com.android.systemui.plugins.ActivityStarter; import com.android.systemui.plugins.VolumeDialog; @@ -28,14 +27,11 @@ import com.android.systemui.plugins.VolumeDialogController; import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.DeviceProvisionedController; -import com.android.systemui.util.DeviceConfigProxy; import com.android.systemui.volume.VolumeComponent; import com.android.systemui.volume.VolumeDialogComponent; import com.android.systemui.volume.VolumeDialogImpl; import com.android.systemui.volume.VolumePanelFactory; -import java.util.concurrent.Executor; - import dagger.Binds; import dagger.Module; import dagger.Provides; @@ -59,9 +55,7 @@ public interface VolumeModule { MediaOutputDialogFactory mediaOutputDialogFactory, VolumePanelFactory volumePanelFactory, ActivityStarter activityStarter, - InteractionJankMonitor interactionJankMonitor, - DeviceConfigProxy deviceConfigProxy, - @Main Executor executor) { + InteractionJankMonitor interactionJankMonitor) { VolumeDialogImpl impl = new VolumeDialogImpl( context, volumeDialogController, @@ -71,9 +65,7 @@ public interface VolumeModule { mediaOutputDialogFactory, volumePanelFactory, activityStarter, - interactionJankMonitor, - deviceConfigProxy, - executor); + interactionJankMonitor); impl.setStreamImportant(AudioManager.STREAM_SYSTEM, false); impl.setAutomute(true); impl.setSilentMode(false); diff --git a/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java b/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java index a0b4eab1d5df7..2e74bf5474f98 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/volume/VolumeDialogImplTest.java @@ -18,7 +18,6 @@ package com.android.systemui.volume; import static com.android.systemui.volume.VolumeDialogControllerImpl.STREAMS; -import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertTrue; import static org.mockito.ArgumentMatchers.any; @@ -29,7 +28,6 @@ import static org.mockito.Mockito.verify; import android.app.KeyguardManager; import android.media.AudioManager; import android.os.SystemClock; -import android.provider.DeviceConfig; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import android.view.InputDevice; @@ -40,7 +38,6 @@ import android.view.accessibility.AccessibilityManager; import androidx.test.filters.SmallTest; -import com.android.internal.config.sysui.SystemUiDeviceConfigFlags; import com.android.internal.jank.InteractionJankMonitor; import com.android.systemui.Prefs; import com.android.systemui.R; @@ -52,9 +49,6 @@ import com.android.systemui.plugins.VolumeDialogController.State; import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper; import com.android.systemui.statusbar.policy.ConfigurationController; import com.android.systemui.statusbar.policy.DeviceProvisionedController; -import com.android.systemui.util.DeviceConfigProxyFake; -import com.android.systemui.util.concurrency.FakeExecutor; -import com.android.systemui.util.time.FakeSystemClock; import org.junit.Before; import org.junit.Test; @@ -77,8 +71,6 @@ public class VolumeDialogImplTest extends SysuiTestCase { View mDrawerVibrate; View mDrawerMute; View mDrawerNormal; - private DeviceConfigProxyFake mDeviceConfigProxy; - private FakeExecutor mExecutor; @Mock VolumeDialogController mVolumeDialogController; @@ -105,9 +97,6 @@ public class VolumeDialogImplTest extends SysuiTestCase { getContext().addMockSystemService(KeyguardManager.class, mKeyguard); - mDeviceConfigProxy = new DeviceConfigProxyFake(); - mExecutor = new FakeExecutor(new FakeSystemClock()); - mDialog = new VolumeDialogImpl( getContext(), mVolumeDialogController, @@ -117,9 +106,7 @@ public class VolumeDialogImplTest extends SysuiTestCase { mMediaOutputDialogFactory, mVolumePanelFactory, mActivityStarter, - mInteractionJankMonitor, - mDeviceConfigProxy, - mExecutor); + mInteractionJankMonitor); mDialog.init(0, null); State state = createShellState(); mDialog.onStateChangedH(state); @@ -136,9 +123,6 @@ public class VolumeDialogImplTest extends SysuiTestCase { VolumePrefs.SHOW_RINGER_TOAST_COUNT + 1); Prefs.putBoolean(mContext, Prefs.Key.HAS_SEEN_ODI_CAPTIONS_TOOLTIP, false); - - mDeviceConfigProxy.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "false", false); } private State createShellState() { @@ -308,35 +292,6 @@ public class VolumeDialogImplTest extends SysuiTestCase { AudioManager.RINGER_MODE_NORMAL, false); } - /** - * Ideally we would look at the ringer ImageView and check its assigned drawable id, but that - * API does not exist. So we do the next best thing; we check the cached icon id. - */ - @Test - public void notificationVolumeSeparated_theRingerIconChanges() { - mDeviceConfigProxy.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "true", false); - - mExecutor.runAllReady(); // for the config change to take effect - - // assert icon is new based on res id - assertEquals(mDialog.mVolumeRingerIconDrawableId, - R.drawable.ic_speaker_on); - assertEquals(mDialog.mVolumeRingerMuteIconDrawableId, - R.drawable.ic_speaker_mute); - } - - @Test - public void notificationVolumeNotSeparated_theRingerIconRemainsTheSame() { - mDeviceConfigProxy.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI, - SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, "false", false); - - mExecutor.runAllReady(); - - assertEquals(mDialog.mVolumeRingerIconDrawableId, R.drawable.ic_volume_ringer); - assertEquals(mDialog.mVolumeRingerMuteIconDrawableId, R.drawable.ic_volume_ringer_mute); - } - /* @Test public void testContentDescriptions() {