Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ea77fd0 authored by Behnam Heydarshahi's avatar Behnam Heydarshahi Committed by Automerger Merge Worker
Browse files

Merge "Remove volume_separate_notification flag" into udc-dev am: 485a8116...

Merge "Remove volume_separate_notification flag" into udc-dev am: 485a8116 am: 53eb878f am: 220f4cea

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23221865



Change-Id: Iadd710a399ea5d41b38f18bbc8919b013b1fa59c
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 2cb573c0 220f4cea
Loading
Loading
Loading
Loading
+4 −17
Original line number Original line Diff line number Diff line
@@ -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;
+0 −5
Original line number Original line Diff line number Diff line
@@ -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.
+2 −2
Original line number Original line Diff line number Diff line
@@ -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>


+12 −87
Original line number Original line Diff line number Diff line
@@ -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);
+0 −8
Original line number Original line Diff line number Diff line
@@ -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(),
Loading