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

Commit 67ae5a08 authored by Alejandro Nijamkin's avatar Alejandro Nijamkin
Browse files

[flexiglass] Adds predictive_back_sysui as a flag dependency.

Flexiglass now requires this flag to be on.

Fix: 332741685
Test: with cl/621645064, made sure that turning flexiglass on using the script at
go/flexiglass-script also makes back work on the bouncer and QS scenes
in flexiglass
Flag: N/A

Change-Id: Ic2a61032bc28b9434222a3604a46b2228b317765
parent ff0df2ec
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import com.android.systemui.keyguard.KeyguardWmStateRefactor
import com.android.systemui.keyguard.MigrateClocksToBlueprint
import com.android.systemui.keyguard.shared.ComposeLockscreen
import com.android.systemui.media.controls.util.MediaInSceneContainerFlag
import com.android.systemui.statusbar.phone.PredictiveBackSysUiFlag
import dagger.Module
import dagger.Provides

@@ -44,7 +45,8 @@ object SceneContainerFlag {
                MigrateClocksToBlueprint.isEnabled &&
                ComposeLockscreen.isEnabled &&
                MediaInSceneContainerFlag.isEnabled &&
                KeyguardWmStateRefactor.isEnabled
                KeyguardWmStateRefactor.isEnabled &&
                PredictiveBackSysUiFlag.isEnabled
    // NOTE: Changes should also be made in getSecondaryFlags and @EnableSceneContainer

    /** The main aconfig flag. */
+2 −3
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ import static androidx.lifecycle.Lifecycle.State.RESUMED;
import static com.android.systemui.Dependency.TIME_TICK_HANDLER_NAME;
import static com.android.systemui.Flags.lightRevealMigration;
import static com.android.systemui.Flags.newAodTransition;
import static com.android.systemui.Flags.predictiveBackSysui;
import static com.android.systemui.Flags.truncatedStatusBarIconsFix;
import static com.android.systemui.charging.WirelessChargingAnimation.UNKNOWN_BATTERY_LEVEL;
import static com.android.systemui.statusbar.NotificationLockscreenUserManager.PERMISSION_SELF;
@@ -837,7 +836,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        mLightRevealScrimViewModelLazy = lightRevealScrimViewModelLazy;
        mLightRevealScrim = lightRevealScrim;

        if (predictiveBackSysui()) {
        if (PredictiveBackSysUiFlag.isEnabled()) {
            mContext.getApplicationInfo().setEnableOnBackInvokedCallback(true);
        }
    }
@@ -3061,7 +3060,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
        public void onConfigChanged(Configuration newConfig) {
            updateResources();
            updateDisplaySize(); // populates mDisplayMetrics
            if (predictiveBackSysui()) {
            if (PredictiveBackSysUiFlag.isEnabled()) {
                mContext.getApplicationInfo().setEnableOnBackInvokedCallback(true);
            }

+53 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.statusbar.phone

import com.android.systemui.Flags
import com.android.systemui.flags.FlagToken
import com.android.systemui.flags.RefactorFlagUtils

/** Helper for reading or using the predictive back flag state. */
@Suppress("NOTHING_TO_INLINE")
object PredictiveBackSysUiFlag {
    /** The aconfig flag name */
    const val FLAG_NAME = Flags.FLAG_PREDICTIVE_BACK_SYSUI

    /** A token used for dependency declaration */
    val token: FlagToken
        get() = FlagToken(FLAG_NAME, isEnabled)

    /** Is the refactor enabled */
    @JvmStatic
    inline val isEnabled
        get() = Flags.predictiveBackSysui()

    /**
     * Called to ensure code is only run when the flag is enabled. This protects users from the
     * unintended behaviors caused by accidentally running new logic, while also crashing on an eng
     * build to ensure that the refactor author catches issues in testing.
     */
    @JvmStatic
    inline fun isUnexpectedlyInLegacyMode() =
        RefactorFlagUtils.isUnexpectedlyInLegacyMode(isEnabled, FLAG_NAME)

    /**
     * Called to ensure code is only run when the flag is disabled. This will throw an exception if
     * the flag is enabled to ensure that the refactor author catches issues in testing.
     */
    @JvmStatic
    inline fun assertInLegacyMode() = RefactorFlagUtils.assertInLegacyMode(isEnabled, FLAG_NAME)
}
+2 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import com.android.systemui.Flags.FLAG_KEYGUARD_BOTTOM_AREA_REFACTOR
import com.android.systemui.Flags.FLAG_KEYGUARD_WM_STATE_REFACTOR
import com.android.systemui.Flags.FLAG_MEDIA_IN_SCENE_CONTAINER
import com.android.systemui.Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT
import com.android.systemui.Flags.FLAG_PREDICTIVE_BACK_SYSUI
import com.android.systemui.Flags.FLAG_SCENE_CONTAINER

/**
@@ -35,6 +36,7 @@ import com.android.systemui.Flags.FLAG_SCENE_CONTAINER
    FLAG_COMPOSE_LOCKSCREEN,
    FLAG_MEDIA_IN_SCENE_CONTAINER,
    FLAG_KEYGUARD_WM_STATE_REFACTOR,
    FLAG_PREDICTIVE_BACK_SYSUI,
)
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CLASS)