Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make all Android scenario_app activities full-screen, even on older Android versions. #50666

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@

package dev.flutter.scenarios;

import android.os.Bundle;
import android.view.WindowManager;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import io.flutter.embedding.android.FlutterActivity;
import io.flutter.embedding.engine.FlutterEngine;
import java.util.concurrent.atomic.AtomicBoolean;
Expand All @@ -22,6 +25,20 @@ public void configureFlutterEngine(@NonNull FlutterEngine flutterEngine) {
.setMessageHandler("take_screenshot", (byteBuffer, binaryReply) -> notifyFlutterRendered());
}

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

// On newer versions of Android, this is the default. Because these tests are being used to take
// screenshots on Skia Gold, we don't want any of the System UI to show up, even for older API
// versions (i.e. 28).
//
// See also:
// https://github.com/flutter/engine/blob/a9081cce1f0dd730577a36ee1ca6d7af5cdc5a9b/shell/platform/android/io/flutter/embedding/android/FlutterView.java#L696
// https://github.com/flutter/flutter/issues/143471
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}

protected void notifyFlutterRendered() {
synchronized (flutterUiRenderedLock) {
isScenarioReady.set(true);
Expand Down