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

Commit 2d0f79b7 authored by Andy Wickham's avatar Andy Wickham Committed by Android (Google) Code Review
Browse files

Merge "Disables Back gesture while sandbox is running." into ub-launcher3-master

parents bd5048a1 017c8d52
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -16,7 +16,10 @@
package com.android.quickstep.interaction;

import android.graphics.Color;
import android.graphics.Rect;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.View;
import android.view.Window;

@@ -26,6 +29,7 @@ import com.android.launcher3.R;
import com.android.quickstep.interaction.BackGestureTutorialFragment.TutorialStep;
import com.android.quickstep.interaction.BackGestureTutorialFragment.TutorialType;

import java.util.List;
import java.util.Optional;

/** Shows the Back gesture interactive tutorial in full screen mode. */
@@ -46,6 +50,12 @@ public class BackGestureTutorialActivity extends FragmentActivity {
                .commit();
    }

    @Override
    public void onAttachedToWindow() {
        super.onAttachedToWindow();
        disableSystemGestures();
    }

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        super.onWindowFocusChanged(hasFocus);
@@ -70,4 +80,14 @@ public class BackGestureTutorialActivity extends FragmentActivity {
                        | View.SYSTEM_UI_FLAG_FULLSCREEN);
        getWindow().setNavigationBarColor(Color.TRANSPARENT);
    }

    private void disableSystemGestures() {
        Display display = getDisplay();
        if (display != null) {
            DisplayMetrics metrics = new DisplayMetrics();
            display.getMetrics(metrics);
            getWindow().setSystemGestureExclusionRects(
                    List.of(new Rect(0, 0, metrics.widthPixels, metrics.heightPixels)));
        }
    }
}