Skip to content

Title Widget calling setSystemChromeApplicationSwitcherDescription multiple times causing ANRs #176008

Closed

Description

@kazbeksultanov

Steps to reproduce

  1. Create a normal project using Material or Widget App
  2. Introduce state changes on the top of the App without changing the title
  3. The Title widget build method is executed again, triggering the switcher even when there's no change in the title and color

Expected results

Only trigger setSystemChromeApplicationSwitcherDescription once and only after title of color changes

Actual results

setSystemChromeApplicationSwitcherDescription is called multiple times without being needed. causing ANRs.

Detected ANRs Image
StackTrace
          main (native):tid=1 systid=28345 
#00 pc 0xe42c8 libc.so (__ioctl + 8) (BuildId: 899237b27ce70ad3ff85d806309243c0)
#01 pc 0x9d2dc libc.so (ioctl + 156) (BuildId: 899237b27ce70ad3ff85d806309243c0)
#02 pc 0x71eb0 libbinder.so (android::IPCThreadState::talkWithDriver + 280) (BuildId: 7d0e34af83340709fbee99659190ea9a)
#03 pc 0x733b0 libbinder.so (android::IPCThreadState::waitForResponse + 60) (BuildId: 7d0e34af83340709fbee99659190ea9a)
#04 pc 0x730d4 libbinder.so (android::IPCThreadState::transact + 300) (BuildId: 7d0e34af83340709fbee99659190ea9a)
#05 pc 0x8a5f0 libbinder.so (android::BpBinder::transact + 188) (BuildId: 7d0e34af83340709fbee99659190ea9a)
#06 pc 0x1d0e3c libandroid_runtime.so (android_os_BinderProxy_transact + 152) (BuildId: e205f2989297fb3ba5815631854ad9cc)
       at android.os.BinderProxy.transactNative(Native method)
       at android.os.BinderProxy.transact(BinderProxy.java:606)
       at android.app.IActivityClientController$Stub$Proxy.setTaskDescription(IActivityClientController.java:2108)
       at android.app.ActivityClient.setTaskDescription(ActivityClient.java:432)
       at android.app.Activity.setTaskDescription(Activity.java:7863)
       at io.flutter.plugin.platform.PlatformPlugin.setSystemChromeApplicationSwitcherDescription(PlatformPlugin.java:228)
       at io.flutter.plugin.platform.PlatformPlugin.access$200(PlatformPlugin.java:36)
       at io.flutter.plugin.platform.PlatformPlugin$1.setApplicationSwitcherDescription(PlatformPlugin.java:97)
       at io.flutter.embedding.engine.systemchannels.PlatformChannel$1.onMethodCall(PlatformChannel.java:87)
       at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
       at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:292)
       at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0(DartMessenger.java:319)
       at android.os.Handler.handleCallback(Handler.java:996)
       at android.os.Handler.dispatchMessage(Handler.java:110)
       at android.os.Looper.loopOnce(Looper.java:210)
       at android.os.Looper.loop(Looper.java:302)
       at android.app.ActivityThread.main(ActivityThread.java:9675)
       at java.lang.reflect.Method.invoke(Native method)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:601)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1062)

Code sample

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

void main() {
  runApp(MyApp());
}

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'title',
      home: Scaffold(
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              TextButton(
                onPressed: () {
                  setState(() {});
                },
                child: const Text('Update State'),
              )
            ],
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration Image Image

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.32.8, on macOS 15.6.1 24G90 darwin-arm64, locale en-AE)
[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0)
[!] Xcode - develop for iOS and macOS (Xcode 16.2)
    ! CocoaPods 1.15.2 out of date (1.16.2 is recommended).
        CocoaPods is a package manager for iOS or macOS platform code.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/to/platform-plugins
      To update CocoaPods, see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.3)
[✓] Connected device (3 available)
    ! Error: Browsing on the local area network for Kazbek’s iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources

! Doctor found issues in 1 category.

Activity

  1. darshankawar commented on Sep 26, 2025

    @darshankawar
    Member

    @kazbeksultanov Thanks for the report and potential fix. I tried the code with latest stable and master but didn't receive the reported crash log. I clicked on update state multiple times. Is there any step that I missed to properly replicate the crash ?

    Image
    I/e.new_ios_issue( 4428): Compiler allocated 5174KB to compile void android.view.ViewRootImpl.performTraversals()
    I/Choreographer( 4428): Skipped 92 frames!  The application may be doing too much work on its main thread.
    D/ProfileInstaller( 4428): Installing profile for com.example.new_ios_issue
    I/Choreographer( 4428): Skipped 136 frames!  The application may be doing too much work on its main thread.
    D/EGL_emulation( 4428): app_time_stats: avg=8202.85ms min=28.64ms max=24389.11ms count=3
    D/EGL_emulation( 4428): app_time_stats: avg=822.65ms min=3.34ms max=14501.53ms count=18
    D/EGL_emulation( 4428): app_time_stats: avg=353.32ms min=8.24ms max=4753.50ms count=15
    D/EGL_emulation( 4428): app_time_stats: avg=29.81ms min=3.53ms max=376.06ms count=32
    D/EGL_emulation( 4428): app_time_stats: avg=493.43ms min=2.17ms max=15920.41ms count=33
    D/EGL_emulation( 4428): app_time_stats: avg=27.96ms min=4.15ms max=378.28ms count=33
    D/EGL_emulation( 4428): app_time_stats: avg=126.09ms min=2.11ms max=4063.10ms count=35
    D/EGL_emulation( 4428): app_time_stats: avg=326.83ms min=4.19ms max=7997.41ms count=26
    D/EGL_emulation( 4428): app_time_stats: avg=98.00ms min=11.62ms max=2503.60ms count=32
    D/EGL_emulation( 4428): app_time_stats: avg=25.83ms min=3.75ms max=351.73ms count=38
    D/EGL_emulation( 4428): app_time_stats: avg=23.62ms min=3.26ms max=541.58ms count=35
    D/EGL_emulation( 4428): app_time_stats: avg=48.87ms min=4.29ms max=1095.88ms count=35
    D/EGL_emulation( 4428): app_time_stats: avg=827.89ms min=2.93ms max=31092.97ms count=38
    D/EGL_emulation( 4428): app_time_stats: avg=36.58ms min=2.82ms max=669.68ms count=33
    D/EGL_emulation( 4428): app_time_stats: avg=39.31ms min=2.71ms max=1024.08ms count=38
    
    
  2. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Sep 26, 2025
  3. kazbek-sultanov-t commented on Sep 26, 2025

    @kazbek-sultanov-t
    Contributor

    @darshankawar We can't reproduce the ANR and get exact this logs. But root cause is pretty clear.

    The invocation of setSystemChromeApplicationSwitcherDescription each time when setState is done.

    If you put breakpoint on a method setSystemChromeApplicationSwitcherDescription in Title widget, you will see that it will be triggered each time when the button Update State is tapped. But we don't need to trigger it each time, because title and color did not change, this was just rebuilding of the tree.

    PR is suggesting to make the Title widget stateful and call the setSystemChromeApplicationSwitcherDescription only when we are really changing the title or color in app switcher description.

    Image
  4. darshankawar commented on Sep 26, 2025

    @darshankawar
    Member

    Thanks for the update.

  5. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    c: crashStack traces logged to the console
    needs repro infoAutomated crash report whose cause isn't yet known
    and removed
    in triagePresently being triaged by the triage team
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Sep 26, 2025
  6. added
    P2Important issues not at the top of the work list
    on Sep 30, 2025
  7. added a commit that references this issue on Oct 17, 2025
    0ed3ad9
  8. added
    r: fixedIssue is closed as already fixed in a newer version
    on Oct 27, 2025
  9. github-actions commented on Nov 10, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  10. locked as resolved and limited conversation to collaborators on Nov 10, 2025
  11. added a commit that references this issue on Dec 10, 2025
    94c23d0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P2Important issues not at the top of the work listc: crashStack traces logged to the consoleframeworkflutter/packages/flutter repository. See also f: labels.needs repro infoAutomated crash report whose cause isn't yet knownr: fixedIssue is closed as already fixed in a newer versionteam-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions