)]}'
{
  "commit": "7d23780c7f3b5eca9f07c0b974e6c19bb37c38c1",
  "tree": "4ca7a3d91cf8de671b116127df17fae5f94c5b1b",
  "parents": [
    "57c13944e6aa7fff8cb10fd8d8c308d39959e86f"
  ],
  "author": {
    "name": "Gray Mackall",
    "email": "34871572+gmackall@users.noreply.github.com",
    "time": "Fri Feb 21 14:22:24 2025 -0800"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Fri Feb 21 22:22:24 2025 +0000"
  },
  "message": "[remake] Restore old back handling for FlutterFragmentActivity (#161545)\n\nRemake of https://github.com/flutter/engine/pull/56565. Quoting from an\nold comment, slightly edited:\n\n------------ \n\nhttps://github.com/flutter/engine/pull/52302 seems to have\nunintentionally had the effect of not allowing people to \"opt out\" of\npredictive back. This is actually aligned with what the android docs say\nshould happen:\n\nhttps://developer.android.com/guide/navigation/custom-back/predictive-back-gesture\n\u003e Note: OnBackPressedCallback is always called regardless of the value\nof android:enableOnBackInvokedCallback. In other words, disabling the\nsystem animation doesn\u0027t affect your app\u0027s back handling logic if it\nuses OnBackPressedCallback.\n\nBut this wasn\u0027t actually true for flutter apps before\nhttps://github.com/flutter/engine/pull/52302, because we were not\ncalling `super`, and `FlutterFragmentActivity` extends a\n`FragmentActivity` which in turn extends a `ComponentActivity`, which\nuses the old `onBackPressed` to [invoke the new back\nhandling](https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:activity/activity/src/main/java/androidx/activity/ComponentActivity.kt;l\u003d587?q\u003dComponentActivity):\n```kotlin\n   override fun onBackPressed() {\n        onBackPressedDispatcher.onBackPressed()\n    }\n```\n\nSo while the docs imply that removing the `onBackPressed` in\n`FlutterFragmentActivity` shouldn\u0027t have had an effect, that wasn\u0027t true\nbecause in our case we were consuming the back event and ignoring the\nwarning\n```java\n  @Override\n  @SuppressWarnings(\"MissingSuperCall\")\n  public void onBackPressed() {\n    flutterFragment.onBackPressed();\n  }\n```\n\nWhat all this means is that apps that _aren\u0027t_ opting in to predictive\nback had their back handling migrated to the new code path\nautomatically. FlutterFragmentActivity was uniquely is forced into the\nnew back handling codepath by\nhttps://github.com/flutter/engine/pull/52302, which this PR fixes.\n\n------------ \n\n## Pre-launch Checklist\n\n- [x] I read the [Contributor Guide] and followed the process outlined\nthere for submitting PRs.\n- [x] I read the [Tree Hygiene] wiki page, which explains my\nresponsibilities.\n- [x] I read and followed the [Flutter Style Guide], including [Features\nwe expect every widget to implement].\n- [x] I signed the [CLA].\n- [x] I listed at least one issue that this PR fixes in the description\nabove.\n- [x] I updated/added relevant documentation (doc comments with `///`).\n- [x] I added new tests to check the change I am making, or this PR is\n[test-exempt].\n- [x] I followed the [breaking change policy] and added [Data Driven\nFixes] where supported.\n- [ ] All existing and new tests are passing.\n\nIf you need help, consider asking for advice on the #hackers-new channel\non [Discord].\n\n\u003c!-- Links --\u003e\n[Contributor Guide]:\nhttps://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview\n[Tree Hygiene]:\nhttps://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md\n[test-exempt]:\nhttps://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests\n[Flutter Style Guide]:\nhttps://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md\n[Features we expect every widget to implement]:\nhttps://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement\n[CLA]: https://cla.developers.google.com/\n[flutter/tests]: https://github.com/flutter/tests\n[breaking change policy]:\nhttps://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes\n[Discord]:\nhttps://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md\n[Data Driven Fixes]:\nhttps://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md\n\n---------\n\nCo-authored-by: Gray Mackall \u003cmackall@google.com\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "d0562be102b990c327ff5110bd25f8c170f328ae",
      "old_mode": 33188,
      "old_path": "engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragmentActivity.java",
      "new_id": "033ea576b1558b3867fddb1c96078a78da337883",
      "new_mode": 33188,
      "new_path": "engine/src/flutter/shell/platform/android/io/flutter/embedding/android/FlutterFragmentActivity.java"
    },
    {
      "type": "modify",
      "old_id": "73274cbce9766369cef11951f1669f781992aad0",
      "old_mode": 33188,
      "old_path": "engine/src/flutter/shell/platform/android/test/io/flutter/embedding/android/FlutterFragmentActivityTest.java",
      "new_id": "f25b1341376fbd09986399c67130912fa95ea8a5",
      "new_mode": 33188,
      "new_path": "engine/src/flutter/shell/platform/android/test/io/flutter/embedding/android/FlutterFragmentActivityTest.java"
    }
  ]
}
