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

Commit 458ed926 authored by Sunny Shao's avatar Sunny Shao
Browse files

Handle the Edge to Edge problem

- Fix the navigation bar overlapped problem in sub-pages.
- Use a workaround solution to handle Homepage statusbar problem.

Bug: 328622648
Fixes: 330217912
Test: manual test
Change-Id: I67a65e2af10def84bf743d4d3cd0047098423ffe
parent 88feeec3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -192,6 +192,9 @@

        <!-- Define this color for material design -->
        <item name="colorPrimaryVariant">@android:color/white</item>
        <!-- Workaround for E2E modification. -->
        <!-- TODO (b/328622648) waiting for new method instead of this attribute. -->
        <item name="android:windowOptOutEdgeToEdgeEnforcement">true</item>
    </style>

    <style name="Theme.Settings.Home" parent="Theme.Settings.HomeBase">
+25 −0
Original line number Diff line number Diff line
@@ -103,10 +103,14 @@ import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.core.graphics.Insets;
import androidx.core.graphics.drawable.IconCompat;
import androidx.core.graphics.drawable.RoundedBitmapDrawable;
import androidx.core.graphics.drawable.RoundedBitmapDrawableFactory;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.Lifecycle;

import com.android.internal.app.UnlaunchableAppActivity;
@@ -1375,6 +1379,27 @@ public final class Utils extends com.android.settingslib.Utils {
                && userManager.isQuietModeEnabled(userHandle);
    }

    /**
     * Enable new edge to edge feature.
     *
     * @param activity the Activity need to setup the edge to edge feature.
     */
    public static void setupEdgeToEdge(@NonNull FragmentActivity activity) {
        if (com.android.window.flags.Flags.edgeToEdgeByDefault()) {
            ViewCompat.setOnApplyWindowInsetsListener(activity.findViewById(android.R.id.content),
                    (v, windowInsets) -> {
                        Insets insets = windowInsets.getInsets(
                                WindowInsetsCompat.Type.systemBars());
                        // Apply the insets paddings to the view.
                        v.setPadding(insets.left, insets.top, insets.right, insets.bottom);

                        // Return CONSUMED if you don't want the window insets to keep being
                        // passed down to descendant views.
                        return WindowInsetsCompat.CONSUMED;
                    });
        }
    }

    private static FaceManager.RemovalCallback faceManagerRemovalCallback(int userId) {
        return new FaceManager.RemovalCallback() {
            @Override
+2 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import androidx.fragment.app.FragmentActivity;
import com.android.settings.R;
import com.android.settings.SetupWizardUtils;
import com.android.settings.SubSettings;
import com.android.settings.Utils;
import com.android.settings.core.CategoryMixin.CategoryHandler;
import com.android.settingslib.core.lifecycle.HideNonSystemOverlayMixin;
import com.android.settingslib.transition.SettingsTransitionHelper.TransitionType;
@@ -91,6 +92,7 @@ public class SettingsBaseActivity extends FragmentActivity implements CategoryHa
            Log.w(TAG, "Devices lock task mode pinned.");
            finish();
        }
        Utils.setupEdgeToEdge(this);
        final long startTime = System.currentTimeMillis();
        getLifecycle().addObserver(new HideNonSystemOverlayMixin(this));
        TextAppearanceConfig.setShouldLoadFontSynchronously(true);