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

Commit 5d1911a2 authored by Behnam Heydarshahi's avatar Behnam Heydarshahi
Browse files

Ring volume icon stuck at normal

Fix the bug where dragging ring volume slider all the way to left
would not trigger an icon change, on devices that do not have
a vibrator.

Solution: offer a boolean config for volumeDownToEnterSilent.

Bug: 265459313

Test: Manual. Slide ring volume to left in settings. Ring volume
icon should switch to mute/vibrate and not get stuck at normal.

Change-Id: I0d5f71a86703eda61c0d831046b2e0c3f5dabb84
parent 78108c10
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2074,6 +2074,9 @@
         STREAM_MUSIC as if it's on TV platform. -->
    <bool name="config_single_volume">false</bool>

    <!-- Volume policy -->
    <bool name="config_volume_down_to_enter_silent">false</bool>

    <!-- The number of volume steps for the notification stream -->
    <integer name="config_audio_notif_vol_steps">7</integer>

+1 −0
Original line number Diff line number Diff line
@@ -321,6 +321,7 @@
  <java-symbol type="bool" name="config_use_strict_phone_number_comparation_for_kazakhstan" />
  <java-symbol type="integer" name="config_phonenumber_compare_min_match" />
  <java-symbol type="bool" name="config_single_volume" />
  <java-symbol type="bool" name="config_volume_down_to_enter_silent" />
  <java-symbol type="bool" name="config_voice_capable" />
  <java-symbol type="bool" name="config_requireCallCapableAccountForHandle" />
  <java-symbol type="bool" name="config_user_notification_of_restrictied_mobile_access" />
+17 −8
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.os.Bundle;
import android.provider.Settings;
import android.view.WindowManager.LayoutParams;

import com.android.internal.R;
import com.android.settingslib.applications.InterestingConfigChanges;
import com.android.systemui.dagger.SysUISingleton;
import com.android.systemui.demomode.DemoMode;
@@ -55,7 +56,7 @@ public class VolumeDialogComponent implements VolumeComponent, TunerService.Tuna
    public static final String VOLUME_UP_SILENT = "sysui_volume_up_silent";
    public static final String VOLUME_SILENT_DO_NOT_DISTURB = "sysui_do_not_disturb";

    public static final boolean DEFAULT_VOLUME_DOWN_TO_ENTER_SILENT = false;
    private final boolean mDefaultVolumeDownToEnterSilent;
    public static final boolean DEFAULT_VOLUME_UP_TO_EXIT_SILENT = false;
    public static final boolean DEFAULT_DO_NOT_DISTURB_WHEN_SILENT = false;

@@ -72,12 +73,7 @@ public class VolumeDialogComponent implements VolumeComponent, TunerService.Tuna
    private final KeyguardViewMediator mKeyguardViewMediator;
    private final ActivityStarter mActivityStarter;
    private VolumeDialog mDialog;
    private VolumePolicy mVolumePolicy = new VolumePolicy(
            DEFAULT_VOLUME_DOWN_TO_ENTER_SILENT,  // volumeDownToEnterSilent
            DEFAULT_VOLUME_UP_TO_EXIT_SILENT,  // volumeUpToExitSilent
            DEFAULT_DO_NOT_DISTURB_WHEN_SILENT,  // doNotDisturbWhenSilent
            400    // vibrateToSilentDebounce
    );
    private VolumePolicy mVolumePolicy;

    @Inject
    public VolumeDialogComponent(
@@ -107,7 +103,20 @@ public class VolumeDialogComponent implements VolumeComponent, TunerService.Tuna
                    mDialog = dialog;
                    mDialog.init(LayoutParams.TYPE_VOLUME_OVERLAY, mVolumeDialogCallback);
                }).build();


        mDefaultVolumeDownToEnterSilent = mContext.getResources()
                .getBoolean(R.bool.config_volume_down_to_enter_silent);

        mVolumePolicy = new VolumePolicy(
                mDefaultVolumeDownToEnterSilent,  // volumeDownToEnterSilent
                DEFAULT_VOLUME_UP_TO_EXIT_SILENT,  // volumeUpToExitSilent
                DEFAULT_DO_NOT_DISTURB_WHEN_SILENT,  // doNotDisturbWhenSilent
                400    // vibrateToSilentDebounce
        );

        applyConfiguration();

        tunerService.addTunable(this, VOLUME_DOWN_SILENT, VOLUME_UP_SILENT,
                VOLUME_SILENT_DO_NOT_DISTURB);
        demoModeController.addCallback(this);
@@ -121,7 +130,7 @@ public class VolumeDialogComponent implements VolumeComponent, TunerService.Tuna

        if (VOLUME_DOWN_SILENT.equals(key)) {
            volumeDownToEnterSilent =
                TunerService.parseIntegerSwitch(newValue, DEFAULT_VOLUME_DOWN_TO_ENTER_SILENT);
                TunerService.parseIntegerSwitch(newValue, mDefaultVolumeDownToEnterSilent);
        } else if (VOLUME_UP_SILENT.equals(key)) {
            volumeUpToExitSilent =
                TunerService.parseIntegerSwitch(newValue, DEFAULT_VOLUME_UP_TO_EXIT_SILENT);