Merge "Remove volume_separate_notification flag" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
485a81164f
@@ -37,7 +37,6 @@ import android.os.Handler;
|
|||||||
import android.os.HandlerThread;
|
import android.os.HandlerThread;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.preference.VolumePreference.VolumeStore;
|
import android.preference.VolumePreference.VolumeStore;
|
||||||
import android.provider.DeviceConfig;
|
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.provider.Settings.Global;
|
import android.provider.Settings.Global;
|
||||||
import android.provider.Settings.System;
|
import android.provider.Settings.System;
|
||||||
@@ -47,7 +46,6 @@ import android.widget.SeekBar;
|
|||||||
import android.widget.SeekBar.OnSeekBarChangeListener;
|
import android.widget.SeekBar.OnSeekBarChangeListener;
|
||||||
|
|
||||||
import com.android.internal.annotations.GuardedBy;
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
|
|
||||||
import com.android.internal.os.SomeArgs;
|
import com.android.internal.os.SomeArgs;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -295,14 +293,8 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba
|
|||||||
if (zenMuted) {
|
if (zenMuted) {
|
||||||
mSeekBar.setProgress(mLastAudibleStreamVolume, true);
|
mSeekBar.setProgress(mLastAudibleStreamVolume, true);
|
||||||
} else if (mNotificationOrRing && mRingerMode == AudioManager.RINGER_MODE_VIBRATE) {
|
} else if (mNotificationOrRing && mRingerMode == AudioManager.RINGER_MODE_VIBRATE) {
|
||||||
/**
|
// For ringer-mode affected streams, show volume as zero when ringermode is vibrate
|
||||||
* the first variable above is preserved and the conditions below are made explicit
|
if (mStreamType == AudioManager.STREAM_RING
|
||||||
* 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
|
|
||||||
|| (mStreamType == AudioManager.STREAM_NOTIFICATION && mMuted)) {
|
|| (mStreamType == AudioManager.STREAM_NOTIFICATION && mMuted)) {
|
||||||
mSeekBar.setProgress(0, true);
|
mSeekBar.setProgress(0, true);
|
||||||
}
|
}
|
||||||
@@ -397,9 +389,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba
|
|||||||
// set the time of stop volume
|
// set the time of stop volume
|
||||||
if ((mStreamType == AudioManager.STREAM_VOICE_CALL
|
if ((mStreamType == AudioManager.STREAM_VOICE_CALL
|
||||||
|| mStreamType == AudioManager.STREAM_RING
|
|| mStreamType == AudioManager.STREAM_RING
|
||||||
|| (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI,
|
|| mStreamType == AudioManager.STREAM_NOTIFICATION
|
||||||
SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, false)
|
|
||||||
&& mStreamType == AudioManager.STREAM_NOTIFICATION)
|
|
||||||
|| mStreamType == AudioManager.STREAM_ALARM)) {
|
|| mStreamType == AudioManager.STREAM_ALARM)) {
|
||||||
sStopVolumeTime = java.lang.System.currentTimeMillis();
|
sStopVolumeTime = java.lang.System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
@@ -686,10 +676,7 @@ public class SeekBarVolumizer implements OnSeekBarChangeListener, Handler.Callba
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateVolumeSlider(int streamType, int streamValue) {
|
private void updateVolumeSlider(int streamType, int streamValue) {
|
||||||
final boolean streamMatch = !DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_SYSTEMUI,
|
final boolean streamMatch = (streamType == mStreamType);
|
||||||
SystemUiDeviceConfigFlags.VOLUME_SEPARATE_NOTIFICATION, false)
|
|
||||||
&& mNotificationOrRing ? isNotificationOrRing(streamType) :
|
|
||||||
streamType == mStreamType;
|
|
||||||
if (mSeekBar != null && streamMatch && streamValue != -1) {
|
if (mSeekBar != null && streamMatch && streamValue != -1) {
|
||||||
final boolean muted = mAudioManager.isStreamMute(mStreamType)
|
final boolean muted = mAudioManager.isStreamMute(mStreamType)
|
||||||
|| streamValue == 0;
|
|| streamValue == 0;
|
||||||
|
|||||||
@@ -548,11 +548,6 @@ public final class SystemUiDeviceConfigFlags {
|
|||||||
public static final String TASK_MANAGER_INFORM_JOB_SCHEDULER_OF_PENDING_APP_STOP =
|
public static final String TASK_MANAGER_INFORM_JOB_SCHEDULER_OF_PENDING_APP_STOP =
|
||||||
"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
|
* (boolean) Whether widget provider info would be saved to / loaded from system persistence
|
||||||
* layer as opposed to individual manifests in respective apps.
|
* layer as opposed to individual manifests in respective apps.
|
||||||
|
|||||||
@@ -85,7 +85,7 @@
|
|||||||
android:layout_height="@dimen/volume_ringer_drawer_icon_size"
|
android:layout_height="@dimen/volume_ringer_drawer_icon_size"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:tint="?android:attr/textColorPrimary"
|
android:tint="?android:attr/textColorPrimary"
|
||||||
android:src="@drawable/ic_volume_ringer_mute" />
|
android:src="@drawable/ic_speaker_mute" />
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
android:layout_height="@dimen/volume_ringer_drawer_icon_size"
|
android:layout_height="@dimen/volume_ringer_drawer_icon_size"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:tint="?android:attr/textColorPrimary"
|
android:tint="?android:attr/textColorPrimary"
|
||||||
android:src="@drawable/ic_volume_ringer" />
|
android:src="@drawable/ic_speaker_on" />
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ import android.os.Message;
|
|||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.os.Trace;
|
import android.os.Trace;
|
||||||
import android.os.VibrationEffect;
|
import android.os.VibrationEffect;
|
||||||
import android.provider.DeviceConfig;
|
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.provider.Settings.Global;
|
import android.provider.Settings.Global;
|
||||||
import android.text.InputFilter;
|
import android.text.InputFilter;
|
||||||
@@ -113,7 +112,6 @@ import androidx.annotation.Nullable;
|
|||||||
import com.android.app.animation.Interpolators;
|
import com.android.app.animation.Interpolators;
|
||||||
import com.android.internal.annotations.GuardedBy;
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
|
|
||||||
import com.android.internal.graphics.drawable.BackgroundBlurDrawable;
|
import com.android.internal.graphics.drawable.BackgroundBlurDrawable;
|
||||||
import com.android.internal.jank.InteractionJankMonitor;
|
import com.android.internal.jank.InteractionJankMonitor;
|
||||||
import com.android.internal.view.RotationPolicy;
|
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.DevicePostureController;
|
||||||
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
|
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
|
||||||
import com.android.systemui.util.AlphaTintDrawableWrapper;
|
import com.android.systemui.util.AlphaTintDrawableWrapper;
|
||||||
import com.android.systemui.util.DeviceConfigProxy;
|
|
||||||
import com.android.systemui.util.RoundedCornerProgressDrawable;
|
import com.android.systemui.util.RoundedCornerProgressDrawable;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.concurrent.Executor;
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -198,9 +192,6 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
|
|||||||
private ViewGroup mDialogRowsView;
|
private ViewGroup mDialogRowsView;
|
||||||
private ViewGroup mRinger;
|
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
|
* 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.
|
* 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 BackgroundBlurDrawable mDialogRowsViewBackground;
|
||||||
private final InteractionJankMonitor mInteractionJankMonitor;
|
private final InteractionJankMonitor mInteractionJankMonitor;
|
||||||
|
|
||||||
private boolean mSeparateNotification;
|
|
||||||
|
|
||||||
private int mWindowGravity;
|
private int mWindowGravity;
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
int mVolumeRingerIconDrawableId;
|
final int mVolumeRingerIconDrawableId = R.drawable.ic_speaker_on;
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
int mVolumeRingerMuteIconDrawableId;
|
final int mVolumeRingerMuteIconDrawableId = R.drawable.ic_speaker_mute;
|
||||||
|
|
||||||
private int mOriginalGravity;
|
private int mOriginalGravity;
|
||||||
private final DevicePostureController.Callback mDevicePostureControllerCallback;
|
private final DevicePostureController.Callback mDevicePostureControllerCallback;
|
||||||
@@ -315,8 +304,6 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
|
|||||||
VolumePanelFactory volumePanelFactory,
|
VolumePanelFactory volumePanelFactory,
|
||||||
ActivityStarter activityStarter,
|
ActivityStarter activityStarter,
|
||||||
InteractionJankMonitor interactionJankMonitor,
|
InteractionJankMonitor interactionJankMonitor,
|
||||||
DeviceConfigProxy deviceConfigProxy,
|
|
||||||
Executor executor,
|
|
||||||
CsdWarningDialog.Factory csdWarningDialogFactory,
|
CsdWarningDialog.Factory csdWarningDialogFactory,
|
||||||
DevicePostureController devicePostureController,
|
DevicePostureController devicePostureController,
|
||||||
Looper looper,
|
Looper looper,
|
||||||
@@ -374,12 +361,6 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
|
|||||||
} else {
|
} else {
|
||||||
mDevicePostureControllerCallback = null;
|
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;
|
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
|
@Override
|
||||||
public void onUiModeChanged() {
|
public void onUiModeChanged() {
|
||||||
mContext.getTheme().applyStyle(mContext.getThemeResId(), true);
|
mContext.getTheme().applyStyle(mContext.getThemeResId(), true);
|
||||||
@@ -454,9 +397,6 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
|
|||||||
|
|
||||||
mConfigurationController.addCallback(this);
|
mConfigurationController.addCallback(this);
|
||||||
|
|
||||||
mDeviceConfigProxy.addOnPropertiesChangedListener(DeviceConfig.NAMESPACE_SYSTEMUI,
|
|
||||||
mExecutor, this::onDeviceConfigChange);
|
|
||||||
|
|
||||||
if (mDevicePostureController != null) {
|
if (mDevicePostureController != null) {
|
||||||
mDevicePostureController.addCallback(mDevicePostureControllerCallback);
|
mDevicePostureController.addCallback(mDevicePostureControllerCallback);
|
||||||
}
|
}
|
||||||
@@ -467,28 +407,11 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
|
|||||||
mController.removeCallback(mControllerCallbackH);
|
mController.removeCallback(mControllerCallbackH);
|
||||||
mHandler.removeCallbacksAndMessages(null);
|
mHandler.removeCallbacksAndMessages(null);
|
||||||
mConfigurationController.removeCallback(this);
|
mConfigurationController.removeCallback(this);
|
||||||
mDeviceConfigProxy.removeOnPropertiesChangedListener(this::onDeviceConfigChange);
|
|
||||||
if (mDevicePostureController != null) {
|
if (mDevicePostureController != null) {
|
||||||
mDevicePostureController.removeCallback(mDevicePostureControllerCallback);
|
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
|
@Override
|
||||||
public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo internalInsetsInfo) {
|
public void onComputeInternalInsets(ViewTreeObserver.InternalInsetsInfo internalInsetsInfo) {
|
||||||
// Set touchable region insets on the root dialog view. This tells WindowManager that
|
// 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);
|
mRingerDrawerNormalIcon = mDialog.findViewById(R.id.volume_drawer_normal_icon);
|
||||||
mRingerDrawerNewSelectionBg = mDialog.findViewById(R.id.volume_drawer_selection_background);
|
mRingerDrawerNewSelectionBg = mDialog.findViewById(R.id.volume_drawer_selection_background);
|
||||||
|
|
||||||
updateRingerModeIconSet();
|
if (mRingerDrawerMuteIcon != null) {
|
||||||
|
mRingerDrawerMuteIcon.setImageResource(mVolumeRingerMuteIconDrawableId);
|
||||||
|
}
|
||||||
|
if (mRingerDrawerNormalIcon != null) {
|
||||||
|
mRingerDrawerNormalIcon.setImageResource(mVolumeRingerIconDrawableId);
|
||||||
|
}
|
||||||
|
|
||||||
setupRingerDrawer();
|
setupRingerDrawer();
|
||||||
|
|
||||||
@@ -724,13 +652,10 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
|
|||||||
addRow(AudioManager.STREAM_MUSIC,
|
addRow(AudioManager.STREAM_MUSIC,
|
||||||
R.drawable.ic_volume_media, R.drawable.ic_volume_media_mute, true, true);
|
R.drawable.ic_volume_media, R.drawable.ic_volume_media_mute, true, true);
|
||||||
if (!AudioSystem.isSingleVolume(mContext)) {
|
if (!AudioSystem.isSingleVolume(mContext)) {
|
||||||
if (mSeparateNotification) {
|
|
||||||
addRow(AudioManager.STREAM_RING, R.drawable.ic_ring_volume,
|
addRow(AudioManager.STREAM_RING, R.drawable.ic_ring_volume,
|
||||||
R.drawable.ic_ring_volume_off, true, false);
|
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(STREAM_ALARM,
|
addRow(STREAM_ALARM,
|
||||||
R.drawable.ic_alarm, R.drawable.ic_volume_alarm_mute, true, false);
|
R.drawable.ic_alarm, R.drawable.ic_volume_alarm_mute, true, false);
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import android.media.AudioManager;
|
|||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
|
||||||
import com.android.internal.jank.InteractionJankMonitor;
|
import com.android.internal.jank.InteractionJankMonitor;
|
||||||
import com.android.systemui.dagger.qualifiers.Main;
|
|
||||||
import com.android.systemui.dump.DumpManager;
|
import com.android.systemui.dump.DumpManager;
|
||||||
import com.android.systemui.media.dialog.MediaOutputDialogFactory;
|
import com.android.systemui.media.dialog.MediaOutputDialogFactory;
|
||||||
import com.android.systemui.plugins.ActivityStarter;
|
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.ConfigurationController;
|
||||||
import com.android.systemui.statusbar.policy.DevicePostureController;
|
import com.android.systemui.statusbar.policy.DevicePostureController;
|
||||||
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
|
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
|
||||||
import com.android.systemui.util.DeviceConfigProxy;
|
|
||||||
import com.android.systemui.volume.CsdWarningDialog;
|
import com.android.systemui.volume.CsdWarningDialog;
|
||||||
import com.android.systemui.volume.VolumeComponent;
|
import com.android.systemui.volume.VolumeComponent;
|
||||||
import com.android.systemui.volume.VolumeDialogComponent;
|
import com.android.systemui.volume.VolumeDialogComponent;
|
||||||
@@ -42,8 +40,6 @@ import dagger.Binds;
|
|||||||
import dagger.Module;
|
import dagger.Module;
|
||||||
import dagger.Provides;
|
import dagger.Provides;
|
||||||
|
|
||||||
import java.util.concurrent.Executor;
|
|
||||||
|
|
||||||
/** Dagger Module for code in the volume package. */
|
/** Dagger Module for code in the volume package. */
|
||||||
@Module
|
@Module
|
||||||
public interface VolumeModule {
|
public interface VolumeModule {
|
||||||
@@ -63,8 +59,6 @@ public interface VolumeModule {
|
|||||||
VolumePanelFactory volumePanelFactory,
|
VolumePanelFactory volumePanelFactory,
|
||||||
ActivityStarter activityStarter,
|
ActivityStarter activityStarter,
|
||||||
InteractionJankMonitor interactionJankMonitor,
|
InteractionJankMonitor interactionJankMonitor,
|
||||||
DeviceConfigProxy deviceConfigProxy,
|
|
||||||
@Main Executor executor,
|
|
||||||
CsdWarningDialog.Factory csdFactory,
|
CsdWarningDialog.Factory csdFactory,
|
||||||
DevicePostureController devicePostureController,
|
DevicePostureController devicePostureController,
|
||||||
DumpManager dumpManager) {
|
DumpManager dumpManager) {
|
||||||
@@ -78,8 +72,6 @@ public interface VolumeModule {
|
|||||||
volumePanelFactory,
|
volumePanelFactory,
|
||||||
activityStarter,
|
activityStarter,
|
||||||
interactionJankMonitor,
|
interactionJankMonitor,
|
||||||
deviceConfigProxy,
|
|
||||||
executor,
|
|
||||||
csdFactory,
|
csdFactory,
|
||||||
devicePostureController,
|
devicePostureController,
|
||||||
Looper.getMainLooper(),
|
Looper.getMainLooper(),
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ import android.app.KeyguardManager;
|
|||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
import android.media.AudioManager;
|
import android.media.AudioManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.provider.DeviceConfig;
|
|
||||||
import android.testing.AndroidTestingRunner;
|
import android.testing.AndroidTestingRunner;
|
||||||
import android.testing.TestableLooper;
|
import android.testing.TestableLooper;
|
||||||
import android.view.Gravity;
|
import android.view.Gravity;
|
||||||
@@ -47,7 +46,6 @@ import android.view.accessibility.AccessibilityManager;
|
|||||||
|
|
||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
|
|
||||||
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
|
|
||||||
import com.android.internal.jank.InteractionJankMonitor;
|
import com.android.internal.jank.InteractionJankMonitor;
|
||||||
import com.android.systemui.Prefs;
|
import com.android.systemui.Prefs;
|
||||||
import com.android.systemui.R;
|
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.DevicePostureController;
|
||||||
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
|
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
|
||||||
import com.android.systemui.statusbar.policy.FakeConfigurationController;
|
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.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
@@ -88,8 +83,6 @@ public class VolumeDialogImplTest extends SysuiTestCase {
|
|||||||
View mDrawerVibrate;
|
View mDrawerVibrate;
|
||||||
View mDrawerMute;
|
View mDrawerMute;
|
||||||
View mDrawerNormal;
|
View mDrawerNormal;
|
||||||
private DeviceConfigProxyFake mDeviceConfigProxy;
|
|
||||||
private FakeExecutor mExecutor;
|
|
||||||
private TestableLooper mTestableLooper;
|
private TestableLooper mTestableLooper;
|
||||||
private ConfigurationController mConfigurationController;
|
private ConfigurationController mConfigurationController;
|
||||||
private int mOriginalOrientation;
|
private int mOriginalOrientation;
|
||||||
@@ -131,8 +124,6 @@ public class VolumeDialogImplTest extends SysuiTestCase {
|
|||||||
getContext().addMockSystemService(KeyguardManager.class, mKeyguard);
|
getContext().addMockSystemService(KeyguardManager.class, mKeyguard);
|
||||||
|
|
||||||
mTestableLooper = TestableLooper.get(this);
|
mTestableLooper = TestableLooper.get(this);
|
||||||
mDeviceConfigProxy = new DeviceConfigProxyFake();
|
|
||||||
mExecutor = new FakeExecutor(new FakeSystemClock());
|
|
||||||
|
|
||||||
when(mPostureController.getDevicePosture())
|
when(mPostureController.getDevicePosture())
|
||||||
.thenReturn(DevicePostureController.DEVICE_POSTURE_CLOSED);
|
.thenReturn(DevicePostureController.DEVICE_POSTURE_CLOSED);
|
||||||
@@ -151,8 +142,6 @@ public class VolumeDialogImplTest extends SysuiTestCase {
|
|||||||
mVolumePanelFactory,
|
mVolumePanelFactory,
|
||||||
mActivityStarter,
|
mActivityStarter,
|
||||||
mInteractionJankMonitor,
|
mInteractionJankMonitor,
|
||||||
mDeviceConfigProxy,
|
|
||||||
mExecutor,
|
|
||||||
mCsdWarningDialogFactory,
|
mCsdWarningDialogFactory,
|
||||||
mPostureController,
|
mPostureController,
|
||||||
mTestableLooper.getLooper(),
|
mTestableLooper.getLooper(),
|
||||||
@@ -173,9 +162,6 @@ public class VolumeDialogImplTest extends SysuiTestCase {
|
|||||||
VolumePrefs.SHOW_RINGER_TOAST_COUNT + 1);
|
VolumePrefs.SHOW_RINGER_TOAST_COUNT + 1);
|
||||||
|
|
||||||
Prefs.putBoolean(mContext, Prefs.Key.HAS_SEEN_ODI_CAPTIONS_TOOLTIP, false);
|
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() {
|
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.
|
* API does not exist. So we do the next best thing; we check the cached icon id.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void notificationVolumeSeparated_theRingerIconChanges() {
|
public void notificationVolumeSeparated_theRingerIconChangesToSpeakerIcon() {
|
||||||
mDeviceConfigProxy.setProperty(DeviceConfig.NAMESPACE_SYSTEMUI,
|
// already separated. assert icon is new based on res id
|
||||||
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,
|
assertEquals(mDialog.mVolumeRingerIconDrawableId,
|
||||||
R.drawable.ic_speaker_on);
|
R.drawable.ic_speaker_on);
|
||||||
assertEquals(mDialog.mVolumeRingerMuteIconDrawableId,
|
assertEquals(mDialog.mVolumeRingerMuteIconDrawableId,
|
||||||
R.drawable.ic_speaker_mute);
|
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
|
@Test
|
||||||
public void testDialogDismissAnimation_notifyVisibleIsNotCalledBeforeAnimation() {
|
public void testDialogDismissAnimation_notifyVisibleIsNotCalledBeforeAnimation() {
|
||||||
mDialog.dismissH(DISMISS_REASON_UNKNOWN);
|
mDialog.dismissH(DISMISS_REASON_UNKNOWN);
|
||||||
@@ -408,8 +378,6 @@ public class VolumeDialogImplTest extends SysuiTestCase {
|
|||||||
mVolumePanelFactory,
|
mVolumePanelFactory,
|
||||||
mActivityStarter,
|
mActivityStarter,
|
||||||
mInteractionJankMonitor,
|
mInteractionJankMonitor,
|
||||||
mDeviceConfigProxy,
|
|
||||||
mExecutor,
|
|
||||||
mCsdWarningDialogFactory,
|
mCsdWarningDialogFactory,
|
||||||
devicePostureController,
|
devicePostureController,
|
||||||
mTestableLooper.getLooper(),
|
mTestableLooper.getLooper(),
|
||||||
@@ -447,8 +415,6 @@ public class VolumeDialogImplTest extends SysuiTestCase {
|
|||||||
mVolumePanelFactory,
|
mVolumePanelFactory,
|
||||||
mActivityStarter,
|
mActivityStarter,
|
||||||
mInteractionJankMonitor,
|
mInteractionJankMonitor,
|
||||||
mDeviceConfigProxy,
|
|
||||||
mExecutor,
|
|
||||||
mCsdWarningDialogFactory,
|
mCsdWarningDialogFactory,
|
||||||
devicePostureController,
|
devicePostureController,
|
||||||
mTestableLooper.getLooper(),
|
mTestableLooper.getLooper(),
|
||||||
@@ -485,8 +451,6 @@ public class VolumeDialogImplTest extends SysuiTestCase {
|
|||||||
mVolumePanelFactory,
|
mVolumePanelFactory,
|
||||||
mActivityStarter,
|
mActivityStarter,
|
||||||
mInteractionJankMonitor,
|
mInteractionJankMonitor,
|
||||||
mDeviceConfigProxy,
|
|
||||||
mExecutor,
|
|
||||||
mCsdWarningDialogFactory,
|
mCsdWarningDialogFactory,
|
||||||
devicePostureController,
|
devicePostureController,
|
||||||
mTestableLooper.getLooper(),
|
mTestableLooper.getLooper(),
|
||||||
@@ -525,8 +489,6 @@ public class VolumeDialogImplTest extends SysuiTestCase {
|
|||||||
mVolumePanelFactory,
|
mVolumePanelFactory,
|
||||||
mActivityStarter,
|
mActivityStarter,
|
||||||
mInteractionJankMonitor,
|
mInteractionJankMonitor,
|
||||||
mDeviceConfigProxy,
|
|
||||||
mExecutor,
|
|
||||||
mCsdWarningDialogFactory,
|
mCsdWarningDialogFactory,
|
||||||
mPostureController,
|
mPostureController,
|
||||||
mTestableLooper.getLooper(),
|
mTestableLooper.getLooper(),
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ import android.annotation.SuppressLint;
|
|||||||
import android.annotation.UserIdInt;
|
import android.annotation.UserIdInt;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
import android.app.ActivityManagerInternal;
|
import android.app.ActivityManagerInternal;
|
||||||
import android.app.ActivityThread;
|
|
||||||
import android.app.AppGlobals;
|
import android.app.AppGlobals;
|
||||||
import android.app.AppOpsManager;
|
import android.app.AppOpsManager;
|
||||||
import android.app.BroadcastOptions;
|
import android.app.BroadcastOptions;
|
||||||
@@ -167,7 +166,6 @@ import android.os.VibrationAttributes;
|
|||||||
import android.os.VibrationEffect;
|
import android.os.VibrationEffect;
|
||||||
import android.os.Vibrator;
|
import android.os.Vibrator;
|
||||||
import android.os.VibratorManager;
|
import android.os.VibratorManager;
|
||||||
import android.provider.DeviceConfig;
|
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.provider.Settings.System;
|
import android.provider.Settings.System;
|
||||||
import android.service.notification.ZenModeConfig;
|
import android.service.notification.ZenModeConfig;
|
||||||
@@ -187,10 +185,8 @@ import android.view.KeyEvent;
|
|||||||
import android.view.accessibility.AccessibilityManager;
|
import android.view.accessibility.AccessibilityManager;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
|
||||||
import com.android.internal.annotations.GuardedBy;
|
import com.android.internal.annotations.GuardedBy;
|
||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
|
|
||||||
import com.android.internal.os.SomeArgs;
|
import com.android.internal.os.SomeArgs;
|
||||||
import com.android.internal.util.DumpUtils;
|
import com.android.internal.util.DumpUtils;
|
||||||
import com.android.internal.util.Preconditions;
|
import com.android.internal.util.Preconditions;
|
||||||
@@ -252,7 +248,6 @@ public class AudioService extends IAudioService.Stub
|
|||||||
AudioSystemAdapter.OnVolRangeInitRequestListener {
|
AudioSystemAdapter.OnVolRangeInitRequestListener {
|
||||||
|
|
||||||
private static final String TAG = "AS.AudioService";
|
private static final String TAG = "AS.AudioService";
|
||||||
private static final boolean CONFIG_DEFAULT_VAL = false;
|
|
||||||
|
|
||||||
private final AudioSystemAdapter mAudioSystem;
|
private final AudioSystemAdapter mAudioSystem;
|
||||||
private final SystemServerAdapter mSystemServer;
|
private final SystemServerAdapter mSystemServer;
|
||||||
@@ -309,7 +304,7 @@ public class AudioService extends IAudioService.Stub
|
|||||||
* indicates whether STREAM_NOTIFICATION is aliased to STREAM_RING
|
* indicates whether STREAM_NOTIFICATION is aliased to STREAM_RING
|
||||||
* not final due to test method, see {@link #setNotifAliasRingForTest(boolean)}.
|
* 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,
|
* 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(
|
mUseVolumeGroupAliases = mContext.getResources().getBoolean(
|
||||||
com.android.internal.R.bool.config_handleVolumeAliasesUsingVolumeGroups);
|
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
|
// Initialize volume
|
||||||
// Priority 1 - Android Property
|
// Priority 1 - Android Property
|
||||||
// Priority 2 - Audio Policy Service
|
// 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
|
* Called by handling of MSG_INIT_STREAMS_VOLUMES
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user