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

Commit 2e3d63ae authored by Nicolò Mazzucato's avatar Nicolò Mazzucato Committed by Android (Google) Code Review
Browse files

Merge changes If8ea2a83,I3bbf16d6 into main

* changes:
  Fix shade header Clock sizing on display move
  Explicitly use Main thread context for a few view models
parents 297d06d9 7f07319d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2391,7 +2391,7 @@ public class GlobalActionsDialogLite implements DialogInterface.OnDismissListene
        }
    };

    private ContentObserver mGlobalActionsTimeoutObserver = new ContentObserver(new Handler()) {
    private ContentObserver mGlobalActionsTimeoutObserver = new ContentObserver(mMainHandler) {
        @Override
        public void onChange(boolean selfChange) {
            onGlobalActionsTimeoutChanged();
+4 −5
Original line number Diff line number Diff line
@@ -343,8 +343,11 @@ constructor(
                lastInsets?.let { updateConstraintsForInsets(header, it) }
                updateResources()
                updateCarrierGroupPadding()
                if (!ShadeWindowGoesAround.isEnabled) {
                    // the clock handles the config change itself.
                    clock.onDensityOrFontScaleChanged()
                }
            }

            override fun onThemeChanged() {
                updateColors()
@@ -353,10 +356,6 @@ constructor(
            override fun onUiModeChanged() {
                updateColors()
            }

            override fun onLocaleListChanged() {
                clock.onLocaleListChanged()
            }
        }

    private val nextAlarmCallback =
+4 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import androidx.compose.runtime.getValue
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.compose.animation.scene.ContentKey
import com.android.compose.animation.scene.ObservableTransitionState
import com.android.systemui.dagger.qualifiers.Main
import com.android.systemui.dump.DumpManager
import com.android.systemui.flags.FeatureFlagsClassic
import com.android.systemui.flags.Flags
@@ -44,6 +45,7 @@ import com.android.systemui.util.kotlin.ActivatableFlowDumperImpl
import dagger.assisted.AssistedFactory
import dagger.assisted.AssistedInject
import java.util.function.Consumer
import kotlin.coroutines.CoroutineContext
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.filter
@@ -64,6 +66,7 @@ constructor(
    remoteInputInteractor: RemoteInputInteractor,
    featureFlags: FeatureFlagsClassic,
    dumpManager: DumpManager,
    @Main private val mainContext: CoroutineContext,
) :
    ExclusiveActivatable(),
    ActivatableFlowDumper by ActivatableFlowDumperImpl(
@@ -110,7 +113,7 @@ constructor(
        coroutineScope {
            launch { hydrator.activate() }

            launch {
            launch(context = mainContext) {
                shadeInteractor.isAnyExpanded
                    .filter { it }
                    .collect { headsUpNotificationInteractor.unpinAll(true) }
+8 −2
Original line number Diff line number Diff line
@@ -124,6 +124,7 @@ private constructor(
    private val configurationListener =
        object : ConfigurationController.ConfigurationListener {
            override fun onDensityOrFontScaleChanged() {
                ShadeWindowGoesAround.assertInLegacyMode()
                clock.onDensityOrFontScaleChanged()
            }
        }
@@ -154,8 +155,11 @@ private constructor(
        }

        progressProvider?.setReadyToHandleTransition(true)
        if (!ShadeWindowGoesAround.isEnabled) {
            // the clock handles the config change itself.
            configurationController.addCallback(configurationListener)
        }
    }

    private fun addCursorSupportToIconContainers() {
        endSideContainer = mView.requireViewById(R.id.system_icons)
@@ -191,8 +195,10 @@ private constructor(
        startSideContainer.setOnHoverListener(null)
        endSideContainer.setOnHoverListener(null)
        progressProvider?.setReadyToHandleTransition(false)
        if (!ShadeWindowGoesAround.isEnabled) {
            configurationController.removeCallback(configurationListener)
        }
    }

    init {
        // These should likely be done in `onInit`, not `init`.
+29 −8
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.graphics.Rect;
import android.icu.lang.UCharacter;
@@ -52,10 +53,10 @@ import com.android.systemui.plugins.DarkIconDispatcher;
import com.android.systemui.plugins.DarkIconDispatcher.DarkReceiver;
import com.android.systemui.res.R;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.shade.shared.flag.ShadeWindowGoesAround;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.core.StatusBarRootModernization;
import com.android.systemui.statusbar.phone.ui.StatusBarIconController;
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
import com.android.systemui.tuner.TunerService;
import com.android.systemui.tuner.TunerService.Tunable;

@@ -72,7 +73,7 @@ public class Clock extends TextView implements
        DemoModeCommandReceiver,
        Tunable,
        CommandQueue.Callbacks,
        DarkReceiver, ConfigurationListener {
        DarkReceiver {

    public static final String CLOCK_SECONDS = "clock_seconds";
    private static final String CLOCK_SUPER_PARCELABLE = "clock_super_parcelable";
@@ -97,6 +98,7 @@ public class Clock extends TextView implements
    private SimpleDateFormat mContentDescriptionFormat;
    private Locale mLocale;
    private DateTimePatternGenerator mDateTimePatternGenerator;
    private Configuration oldConfig = new Configuration();

    private static final int AM_PM_STYLE_NORMAL  = 0;
    private static final int AM_PM_STYLE_SMALL   = 1;
@@ -367,8 +369,10 @@ public class Clock extends TextView implements
        setTextColor(Utils.getColorAttrDefaultColor(context, R.attr.wallpaperTextColor));
    }

    @Override
    public void onDensityOrFontScaleChanged() {
        ShadeWindowGoesAround.assertInLegacyMode();
        // Note that this class is not being registered as configuration listener when used
        // from compose. It will instead receive a normal "View#onConfigurationChanged".
        reloadDimens();
    }

@@ -386,6 +390,23 @@ public class Clock extends TextView implements
                0);
    }


    @Override
    protected void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
        if (ShadeWindowGoesAround.isEnabled()) {
            if (densityOrFontScaleChanged(oldConfig, newConfig)) {
                reloadDimens();
            }
            oldConfig = newConfig;
        }
    }

    private boolean densityOrFontScaleChanged(Configuration oldConfig, Configuration newConfig) {
        return (oldConfig.densityDpi != newConfig.densityDpi)
                || oldConfig.fontScale != newConfig.fontScale;
    }

    private void updateShowSeconds() {
        if (mShowSeconds) {
            // Wait until we have a display to start trying to show seconds.
Loading