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

Commit 4fb69695 authored by Michael Mikhail's avatar Michael Mikhail Committed by Android (Google) Code Review
Browse files

Merge "Add setting for volume dialog timeout" into main

parents 36819def 68c2bc12
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -11179,6 +11179,12 @@ public final class Settings {
        @Readable
        public static final String BLUETOOTH_ON_WHILE_DRIVING = "bluetooth_on_while_driving";
        /**
         * Volume dialog timeout in ms.
         * @hide
         */
        public static final String VOLUME_DIALOG_DISMISS_TIMEOUT = "volume_dialog_dismiss_timeout";
        /**
         * What behavior should be invoked when the volume hush gesture is triggered
         * One of VOLUME_HUSH_OFF, VOLUME_HUSH_VIBRATE, VOLUME_HUSH_MUTE.
+1 −0
Original line number Diff line number Diff line
@@ -143,6 +143,7 @@ public class SecureSettings {
        Settings.Secure.SCREENSAVER_ACTIVATE_ON_SLEEP,
        Settings.Secure.SCREENSAVER_HOME_CONTROLS_ENABLED,
        Settings.Secure.SHOW_FIRST_CRASH_DIALOG_DEV_OPTION,
        Settings.Secure.VOLUME_DIALOG_DISMISS_TIMEOUT,
        Settings.Secure.VOLUME_HUSH_GESTURE,
        Settings.Secure.MANUAL_RINGER_TOGGLE_COUNT,
        Settings.Secure.LOW_POWER_WARNING_ACKNOWLEDGED,
+1 −0
Original line number Diff line number Diff line
@@ -212,6 +212,7 @@ public class SecureSettingsValidators {
        VALIDATORS.put(Secure.SCREENSAVER_ACTIVATE_ON_SLEEP, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.SCREENSAVER_HOME_CONTROLS_ENABLED, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.SHOW_FIRST_CRASH_DIALOG_DEV_OPTION, BOOLEAN_VALIDATOR);
        VALIDATORS.put(Secure.VOLUME_DIALOG_DISMISS_TIMEOUT, NON_NEGATIVE_INTEGER_VALIDATOR);
        VALIDATORS.put(Secure.VOLUME_HUSH_GESTURE, NON_NEGATIVE_INTEGER_VALIDATOR);
        VALIDATORS.put(
                Secure.ENABLED_NOTIFICATION_LISTENERS,
+13 −3
Original line number Diff line number Diff line
@@ -135,6 +135,9 @@ 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.RoundedCornerProgressDrawable;
import com.android.systemui.util.settings.SecureSettings;

import dagger.Lazy;

import java.io.PrintWriter;
import java.util.ArrayList;
@@ -304,6 +307,8 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
    private @DevicePostureController.DevicePostureInt int mDevicePosture;
    private int mOrientation;
    private final FeatureFlags mFeatureFlags;
    private final Lazy<SecureSettings> mSecureSettings;
    private int mDialogTimeoutMillis;

    public VolumeDialogImpl(
            Context context,
@@ -320,7 +325,8 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
            DevicePostureController devicePostureController,
            Looper looper,
            DumpManager dumpManager,
            FeatureFlags featureFlags) {
            FeatureFlags featureFlags,
            Lazy<SecureSettings> secureSettings) {
        mFeatureFlags = featureFlags;
        mContext =
                new ContextThemeWrapper(context, R.style.volume_dialog_theme);
@@ -351,6 +357,8 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
        mUseBackgroundBlur =
            mContext.getResources().getBoolean(R.bool.config_volumeDialogUseBackgroundBlur);
        mInteractionJankMonitor = interactionJankMonitor;
        mSecureSettings = secureSettings;
        mDialogTimeoutMillis = DIALOG_TIMEOUT_MILLIS;

        dumpManager.registerDumpable("VolumeDialogImpl", this);

@@ -515,6 +523,8 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
        mDialog.setContentView(R.layout.volume_dialog);
        mDialogView = mDialog.findViewById(R.id.volume_dialog);
        mDialogView.setAlpha(0);
        mDialogTimeoutMillis = mSecureSettings.get().getInt(
                Settings.Secure.VOLUME_DIALOG_DISMISS_TIMEOUT, DIALOG_TIMEOUT_MILLIS);
        mDialog.setCanceledOnTouchOutside(true);
        mDialog.setOnShowListener(dialog -> {
            mDialogView.getViewTreeObserver().addOnComputeInternalInsetsListener(this);
@@ -527,7 +537,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
                    .alpha(1)
                    .translationX(0)
                    .setDuration(mDialogShowAnimationDurationMs)
                    .setListener(getJankListener(getDialogView(), TYPE_SHOW, DIALOG_TIMEOUT_MILLIS))
                    .setListener(getJankListener(getDialogView(), TYPE_SHOW, mDialogTimeoutMillis))
                    .setInterpolator(new SystemUIInterpolators.LogDecelerateInterpolator())
                    .withEndAction(() -> {
                        if (!Prefs.getBoolean(mContext, Prefs.Key.TOUCHED_RINGER_TOGGLE, false)) {
@@ -1514,7 +1524,7 @@ public class VolumeDialogImpl implements VolumeDialog, Dumpable,
                    AccessibilityManager.FLAG_CONTENT_TEXT
                            | AccessibilityManager.FLAG_CONTENT_CONTROLS);
        }
        return mAccessibilityMgr.getRecommendedTimeoutMillis(DIALOG_TIMEOUT_MILLIS,
        return mAccessibilityMgr.getRecommendedTimeoutMillis(mDialogTimeoutMillis,
                AccessibilityManager.FLAG_CONTENT_CONTROLS);
    }

+6 −2
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ 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.settings.SecureSettings;
import com.android.systemui.volume.CsdWarningDialog;
import com.android.systemui.volume.VolumeComponent;
import com.android.systemui.volume.VolumeDialogComponent;
@@ -38,6 +39,7 @@ import com.android.systemui.volume.VolumeDialogImpl;
import com.android.systemui.volume.VolumePanelFactory;

import dagger.Binds;
import dagger.Lazy;
import dagger.Module;
import dagger.Provides;

@@ -63,7 +65,8 @@ public interface VolumeModule {
            CsdWarningDialog.Factory csdFactory,
            DevicePostureController devicePostureController,
            DumpManager dumpManager,
            FeatureFlags featureFlags) {
            FeatureFlags featureFlags,
            Lazy<SecureSettings> secureSettings) {
        VolumeDialogImpl impl = new VolumeDialogImpl(
                context,
                volumeDialogController,
@@ -79,7 +82,8 @@ public interface VolumeModule {
                devicePostureController,
                Looper.getMainLooper(),
                dumpManager,
                featureFlags);
                featureFlags,
                secureSettings);
        impl.setStreamImportant(AudioManager.STREAM_SYSTEM, false);
        impl.setAutomute(true);
        impl.setSilentMode(false);
Loading