Remove volume_separate_notification flag

Replace it with true. This flag has been true for all UDC devices since
2022-02-17 so this is expected to have no user-visible effect, except
in cases where devices aren't getting server-side flag updates.

Bug: b/255363741

Test: atest VolumeDialogImplTest AudioServiceTest

Change-Id: I036dbe8611bf022c1e7c5878fd17ba5a61aca99d
This commit is contained in:
Behnam Heydarshahi
2023-05-11 13:40:40 +00:00
parent 7c20a56b77
commit 0d92b10cc5
7 changed files with 21 additions and 188 deletions

View File

@@ -37,7 +37,6 @@ import android.os.Handler;
import android.os.HandlerThread;
import android.os.Message;
import android.preference.VolumePreference.VolumeStore;
import android.provider.DeviceConfig;
import android.provider.Settings;
import android.provider.Settings.Global;
import android.provider.Settings.System;
@@ -47,7 +46,6 @@ import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
import com.android.internal.os.SomeArgs;
import java.util.concurrent.TimeUnit;
@@ -295,14 +293,8 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba
if (zenMuted) {
mSeekBar.setProgress(mLastAudibleStreamVolume, true);
} else if (mNotificationOrRing && mRingerMode == AudioManager.RINGER_MODE_VIBRATE) {
/**
* the first variable above is preserved and the conditions below are made explicit
* so that when user attempts to slide the notification seekbar out of vibrate the
* seekbar doesn't wrongly snap back to 0 when the streams aren't aliased
*/
if (!DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI,
SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, false)
|| mStreamType == AudioManager.STREAM_RING
// For ringer-mode affected streams, show volume as zero when ringermode is vibrate
if (mStreamType == AudioManager.STREAM_RING
|| (mStreamType == AudioManager.STREAM_NOTIFICATION && mMuted)) {
mSeekBar.setProgress(0, true);
}
@@ -397,9 +389,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba
// set the time of stop volume
if ((mStreamType == AudioManager.STREAM_VOICE_CALL
|| mStreamType == AudioManager.STREAM_RING
|| (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI,
SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, false)
&& mStreamType == AudioManager.STREAM_NOTIFICATION)
|| mStreamType == AudioManager.STREAM_NOTIFICATION
|| mStreamType == AudioManager.STREAM_ALARM)) {
sStopVolumeTime = java.lang.System.currentTimeMillis();
}
@@ -686,10 +676,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba
}
private void updateVolumeSlider(int streamType, int streamValue) {
final boolean streamMatch = !DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI,
SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, false)
&& mNotificationOrRing ? isNotificationOrRing(streamType) :
streamType == mStreamType;
final boolean streamMatch = (streamType == mStreamType);
if (mSeekBar != null && streamMatch && streamValue != -1) {
final boolean muted = mAudioManager.isStreamMute(mStreamType)
|| streamValue == 0;

View File

@@ -548,11 +548,6 @@ public final class SystemUiDeviceConfigFlags {
public static final String TASK_MANAGER_INFORM_JOB_SCHEDULER_OF_PENDING_APP_STOP =
"task_manager_inform_job_scheduler_of_pending_app_stop";
/**
* (boolean) Whether to show notification volume control slider separate from ring.
*/
public static final String VOLUME_SEPARATE_NOTIFICATION = "volume_separate_notification";
/**
* (boolean) Whether widget provider info would be saved to / loaded from system persistence
* layer as opposed to individual manifests in respective apps.

View File

@@ -85,7 +85,7 @@
android:layout_height="@dimen/volume_ringer_drawer_icon_size"
android:layout_gravity="center"
android:tint="?android:attr/textColorPrimary"
android:src="@drawable/ic_volume_ringer_mute" />
android:src="@drawable/ic_speaker_mute" />
</FrameLayout>
@@ -102,7 +102,7 @@
android:layout_height="@dimen/volume_ringer_drawer_icon_size"
android:layout_gravity="center"
android:tint="?android:attr/textColorPrimary"
android:src="@drawable/ic_volume_ringer" />
android:src="@drawable/ic_speaker_on" />
</FrameLayout>

View File

@@ -73,7 +73,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;
@@ -113,7 +112,6 @@ import androidx.annotation.Nullable;
import com.android.app.animation.Interpolators;
import com.android.internal.annotations.GuardedBy;
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;
@@ -133,15 +131,11 @@ import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.DevicePostureController;
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;
/**
@@ -198,9 +192,6 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
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.
@@ -290,14 +281,12 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
private BackgroundBlurDrawable mDialogRowsViewBackground;
private final InteractionJankMonitor mInteractionJankMonitor;
private boolean mSeparateNotification;
private int mWindowGravity;
@VisibleForTesting
int mVolumeRingerIconDrawableId;
final int mVolumeRingerIconDrawableId = R.drawable.ic_speaker_on;
@VisibleForTesting
int mVolumeRingerMuteIconDrawableId;
final int mVolumeRingerMuteIconDrawableId = R.drawable.ic_speaker_mute;
private int mOriginalGravity;
private final DevicePostureController.Callback mDevicePostureControllerCallback;
@@ -315,8 +304,6 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
VolumePanelFactory volumePanelFactory,
ActivityStarter activityStarter,
InteractionJankMonitor interactionJankMonitor,
DeviceConfigProxy deviceConfigProxy,
Executor executor,
CsdWarningDialog.Factory csdWarningDialogFactory,
DevicePostureController devicePostureController,
Looper looper,
@@ -374,12 +361,6 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
} else {
mDevicePostureControllerCallback = null;
}
mDeviceConfigProxy = deviceConfigProxy;
mExecutor = executor;
mSeparateNotification = mDeviceConfigProxy.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI,
SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, false);
updateRingerModeIconSet();
}
/**
@@ -401,44 +382,6 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
return mWindowGravity;
}
/**
* 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> 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
public void onUiModeChanged() {
mContext.getTheme().applyStyle(mContext.getThemeResId(), true);
@@ -454,9 +397,6 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
mConfigurationController.addCallback(this);
mDeviceConfigProxy.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_SYSTEMUI,
mExecutor, this::onDeviceConfigChange);
if (mDevicePostureController != null) {
mDevicePostureController.addCallback(mDevicePostureControllerCallback);
}
@@ -467,28 +407,11 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
mController.removeCallback(mControllerCallbackH);
mHandler.removeCallbacksAndMessages(null);
mConfigurationController.removeCallback(this);
mDeviceConfigProxy.removeOnPropertiesChangedListener(this::onDeviceConfigChange);
if (mDevicePostureController != null) {
mDevicePostureController.removeCallback(mDevicePostureControllerCallback);
}
}
/**
* Update ringer mode icon based on the config
*/
private void onDeviceConfigChange(DeviceConfig.Properties properties) {
Set<String> 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
public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo internalInsetsInfo) {
// Set touchable region insets on the root dialog view. This tells WindowManager that
@@ -699,7 +622,12 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
mRingerDrawerNormalIcon = mDialog.findViewById(R.id.volume_drawer_normal_icon);
mRingerDrawerNewSelectionBg = mDialog.findViewById(R.id.volume_drawer_selection_background);
updateRingerModeIconSet();
if (mRingerDrawerMuteIcon != null) {
mRingerDrawerMuteIcon.setImageResource(mVolumeRingerMuteIconDrawableId);
}
if (mRingerDrawerNormalIcon != null) {
mRingerDrawerNormalIcon.setImageResource(mVolumeRingerIconDrawableId);
}
setupRingerDrawer();
@@ -724,13 +652,10 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
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_ring_volume,
R.drawable.ic_ring_volume_off, true, false);
addRow(STREAM_ALARM,
R.drawable.ic_alarm, R.drawable.ic_volume_alarm_mute, true, false);

View File

@@ -21,7 +21,6 @@ import android.media.AudioManager;
import android.os.Looper;
import com.android.internal.jank.InteractionJankMonitor;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.dump.DumpManager;
import com.android.systemui.media.dialog.MediaOutputDialogFactory;
import com.android.systemui.plugins.ActivityStarter;
@@ -31,7 +30,6 @@ import com.android.systemui.statusbar.policy.AccessibilityManagerWrapper;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.DevicePostureController;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.util.DeviceConfigProxy;
import com.android.systemui.volume.CsdWarningDialog;
import com.android.systemui.volume.VolumeComponent;
import com.android.systemui.volume.VolumeDialogComponent;
@@ -42,8 +40,6 @@ import dagger.Binds;
import dagger.Module;
import dagger.Provides;
import java.util.concurrent.Executor;
/** Dagger Module for code in the volume package. */
@Module
public interface VolumeModule {
@@ -63,8 +59,6 @@ public interface VolumeModule {
VolumePanelFactory volumePanelFactory,
ActivityStarter activityStarter,
InteractionJankMonitor interactionJankMonitor,
DeviceConfigProxy deviceConfigProxy,
@Main Executor executor,
CsdWarningDialog.Factory csdFactory,
DevicePostureController devicePostureController,
DumpManager dumpManager) {
@@ -78,8 +72,6 @@ public interface VolumeModule {
volumePanelFactory,
activityStarter,
interactionJankMonitor,
deviceConfigProxy,
executor,
csdFactory,
devicePostureController,
Looper.getMainLooper(),

View File

@@ -35,7 +35,6 @@ import android.app.KeyguardManager;
import android.content.res.Configuration;
import android.media.AudioManager;
import android.os.SystemClock;
import android.provider.DeviceConfig;
import android.testing.AndroidTestingRunner;
import android.testing.TestableLooper;
import android.view.Gravity;
@@ -47,7 +46,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;
@@ -62,9 +60,6 @@ import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.DevicePostureController;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
import com.android.systemui.statusbar.policy.FakeConfigurationController;
import com.android.systemui.util.DeviceConfigProxyFake;
import com.android.systemui.util.concurrency.FakeExecutor;
import com.android.systemui.util.time.FakeSystemClock;
import org.junit.After;
import org.junit.Before;
@@ -88,8 +83,6 @@ public class VolumeDialogImplTest extends SysuiTestCase {
View mDrawerVibrate;
View mDrawerMute;
View mDrawerNormal;
private DeviceConfigProxyFake mDeviceConfigProxy;
private FakeExecutor mExecutor;
private TestableLooper mTestableLooper;
private ConfigurationController mConfigurationController;
private int mOriginalOrientation;
@@ -131,8 +124,6 @@ public class VolumeDialogImplTest extends SysuiTestCase {
getContext().addMockSystemService(KeyguardManager.class, mKeyguard);
mTestableLooper = TestableLooper.get(this);
mDeviceConfigProxy = new DeviceConfigProxyFake();
mExecutor = new FakeExecutor(new FakeSystemClock());
when(mPostureController.getDevicePosture())
.thenReturn(DevicePostureController.DEVICE_POSTURE_CLOSED);
@@ -151,8 +142,6 @@ public class VolumeDialogImplTest extends SysuiTestCase {
mVolumePanelFactory,
mActivityStarter,
mInteractionJankMonitor,
mDeviceConfigProxy,
mExecutor,
mCsdWarningDialogFactory,
mPostureController,
mTestableLooper.getLooper(),
@@ -173,9 +162,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() {
@@ -351,30 +337,14 @@ public class VolumeDialogImplTest extends SysuiTestCase {
* 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
public void notificationVolumeSeparated_theRingerIconChangesToSpeakerIcon() {
// already separated. 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 testDialogDismissAnimation_notifyVisibleIsNotCalledBeforeAnimation() {
mDialog.dismissH(DISMISS_REASON_UNKNOWN);
@@ -408,8 +378,6 @@ public class VolumeDialogImplTest extends SysuiTestCase {
mVolumePanelFactory,
mActivityStarter,
mInteractionJankMonitor,
mDeviceConfigProxy,
mExecutor,
mCsdWarningDialogFactory,
devicePostureController,
mTestableLooper.getLooper(),
@@ -447,8 +415,6 @@ public class VolumeDialogImplTest extends SysuiTestCase {
mVolumePanelFactory,
mActivityStarter,
mInteractionJankMonitor,
mDeviceConfigProxy,
mExecutor,
mCsdWarningDialogFactory,
devicePostureController,
mTestableLooper.getLooper(),
@@ -485,8 +451,6 @@ public class VolumeDialogImplTest extends SysuiTestCase {
mVolumePanelFactory,
mActivityStarter,
mInteractionJankMonitor,
mDeviceConfigProxy,
mExecutor,
mCsdWarningDialogFactory,
devicePostureController,
mTestableLooper.getLooper(),
@@ -525,8 +489,6 @@ public class VolumeDialogImplTest extends SysuiTestCase {
mVolumePanelFactory,
mActivityStarter,
mInteractionJankMonitor,
mDeviceConfigProxy,
mExecutor,
mCsdWarningDialogFactory,
mPostureController,
mTestableLooper.getLooper(),

View File

@@ -45,7 +45,6 @@ import android.annotation.SuppressLint;
import android.annotation.UserIdInt;
import android.app.ActivityManager;
import android.app.ActivityManagerInternal;
import android.app.ActivityThread;
import android.app.AppGlobals;
import android.app.AppOpsManager;
import android.app.BroadcastOptions;
@@ -167,7 +166,6 @@ import android.os.VibrationAttributes;
import android.os.VibrationEffect;
import android.os.Vibrator;
import android.os.VibratorManager;
import android.provider.DeviceConfig;
import android.provider.Settings;
import android.provider.Settings.System;
import android.service.notification.ZenModeConfig;
@@ -187,10 +185,8 @@ import android.view.KeyEvent;
import android.view.accessibility.AccessibilityManager;
import android.widget.Toast;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
import com.android.internal.os.SomeArgs;
import com.android.internal.util.DumpUtils;
import com.android.internal.util.Preconditions;
@@ -252,7 +248,6 @@ public class AudioService extends IAudioService.Stub
AudioSystemAdapter.OnVolRangeInitRequestListener {
private static final String TAG = "AS.AudioService";
private static final boolean CONFIG_DEFAULT_VAL = false;
private final AudioSystemAdapter mAudioSystem;
private final SystemServerAdapter mSystemServer;
@@ -309,7 +304,7 @@ public class AudioService extends IAudioService.Stub
* indicates whether STREAM_NOTIFICATION is aliased to STREAM_RING
* not final due to test method, see {@link #setNotifAliasRingForTest(boolean)}.
*/
private boolean mNotifAliasRing;
private boolean mNotifAliasRing = false;
/**
* Test method to temporarily override whether STREAM_NOTIFICATION is aliased to STREAM_RING,
@@ -1057,13 +1052,6 @@ public class AudioService extends IAudioService.Stub
mUseVolumeGroupAliases = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_handleVolumeAliasesUsingVolumeGroups);
mNotifAliasRing = !DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI,
SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, false);
DeviceConfig.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_SYSTEMUI,
ActivityThread.currentApplication().getMainExecutor(),
this::onDeviceConfigChange);
// Initialize volume
// Priority 1 - Android Property
// Priority 2 - Audio Policy Service
@@ -1276,22 +1264,6 @@ public class AudioService extends IAudioService.Stub
}
}
/**
* Separating notification volume from ring is NOT of aliasing the corresponding streams
* @param properties
*/
private void onDeviceConfigChange(DeviceConfig.Properties properties) {
Set<String> changeSet = properties.getKeyset();
if (changeSet.contains(SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION)) {
boolean newNotifAliasRing = !properties.getBoolean(
SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, CONFIG_DEFAULT_VAL);
if (mNotifAliasRing != newNotifAliasRing) {
mNotifAliasRing = newNotifAliasRing;
updateStreamVolumeAlias(true, TAG);
}
}
}
/**
* Called by handling of MSG_INIT_STREAMS_VOLUMES
*/