Skip to content

didChangeAppLifecycleState is called with AppLifecycleState.resumed while screen is locked #130055

@ashley-arta

Description

@ashley-arta

Is there an existing issue for this?

Steps to reproduce

On iPhone 14 Pro, OS 16.5.1, didChangeAppLifecycleState is called with AppLifecycleState.resumed while screen is locked by clicking the side button.
This function seems to work as expected when moving App to the background, or pulling down the top menu.

Can be reproduced with a simple flutter project which is provided as Code sample below

This does NOT happen on iPhone 13 Pro Max, OS 16.5.1.

Expected results

AppLifecycleState.resumed should only show up once, after the screen is unlocked.

Actual results

These are printed after screen is locked. AppLifecycleState.resumed should not be printed but it was.

flutter: AppLifecycleState: AppLifecycleState.inactive
flutter: AppLifecycleState: AppLifecycleState.resumed
flutter: AppLifecycleState: AppLifecycleState.inactive
flutter: AppLifecycleState: AppLifecycleState.paused

After screen is unlocked, AppLifecycleState.resumed is printed again.

flutter: AppLifecycleState: AppLifecycleState.inactive
flutter: AppLifecycleState: AppLifecycleState.resumed

Code sample

Code sample
import 'package:flutter/material.dart';

void main() {
  runApp(const MainApp());
}

class MainApp extends StatefulWidget {
  const MainApp({super.key});

  @override
  State<MainApp> createState() => _MainAppState();
}

class _MainAppState extends State<MainApp> with WidgetsBindingObserver {
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
        body: Center(
          child: Text('Hello World!'),
        ),
      ),
    );
  }

  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addObserver(this);
  }

  @override
  void didChangeAppLifecycleState(AppLifecycleState state) {
    debugPrint('AppLifecycleState: $state');
  }
}

Screenshots or Video

Screenshots / Video demonstration

[Upload media here]

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.3, on macOS 13.2 22D49 darwin-arm64, locale
    en-SG)
[✓] Android toolchain - develop for Android devices (Android SDK version
    33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.2.2)
[✓] VS Code (version 1.79.2)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work liste: device-specificOnly manifests on certain devicesengineflutter/engine related. See also e: labels.found in release: 3.10Found to occur in 3.10found in release: 3.12Found to occur in 3.12frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-iosiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-iosOwned by iOS platform teamtriaged-iosTriaged by iOS platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions