5package io.flutter.embedding.engine.systemchannels;
7import androidx.annotation.NonNull;
8import androidx.annotation.VisibleForTesting;
10import io.flutter.embedding.engine.dart.DartExecutor;
11import io.flutter.plugin.common.BasicMessageChannel;
12import io.flutter.plugin.common.StringCodec;
13import java.util.Locale;
23 private static final String TAG =
"LifecycleChannel";
24 private static final String CHANNEL_NAME =
"flutter/lifecycle";
41 private boolean lastFocus =
true;
51 this.channel = channel;
70 if (lastAndroidState ==
state && hasFocus == lastFocus) {
74 if (
state ==
null && lastAndroidState ==
null) {
100 lastAndroidState =
state;
101 lastFocus = hasFocus;
102 if (newState == lastFlutterState) {
106 String
message =
"AppLifecycleState." + newState.name().toLowerCase(Locale.ROOT);
107 Log.v(TAG,
"Sending " +
message +
" message.");
109 lastFlutterState = newState;
115 sendState(lastAndroidState,
true);
120 sendState(lastAndroidState,
false);
LifecycleChannel(@NonNull BasicMessageChannel< String > channel)
LifecycleChannel(@NonNull DartExecutor dartExecutor)
void noWindowsAreFocused()
static final StringCodec INSTANCE
void Log(const char *format,...) SK_PRINTF_LIKE(1