This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed
shell/platform/android/io/flutter Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -666,14 +666,21 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
666666 public void registerOnBackInvokedCallback () {
667667 if (Build .VERSION .SDK_INT >= 33 ) {
668668 // TODO(justinmc): This is really the one and only thing that stops root
669- // pback for me.
669+ // pback for me. There are probably other places you need to mess with
670+ // this for other embedding strategies!
670671 Log .e ("justin" , "registerOnBackInvokedCallback" );
671672 getOnBackInvokedDispatcher ()
672673 .registerOnBackInvokedCallback (
673674 OnBackInvokedDispatcher .PRIORITY_DEFAULT , onBackInvokedCallback );
674675 }
675676 }
676677
678+ @ Override
679+ public void navigatorIsEmpty () {
680+ Log .e ("justin" , "navigatorIsEmpty in embedding FlutterActivity" );
681+ unregisterOnBackInvokedCallback ();
682+ }
683+
677684 /**
678685 * Unregisters the callback from OnBackInvokedDispatcher.
679686 *
Original file line number Diff line number Diff line change @@ -1661,6 +1661,13 @@ public boolean popSystemNavigator() {
16611661 return false ;
16621662 }
16631663
1664+ @ Override
1665+ public void navigatorIsEmpty () {
1666+ // TODO(justinmc): Implement. Implementing in FlutterActivity first.
1667+ // unregisterOnBackInvokedCallback();
1668+ Log .e ("justin" , "navigatorIsEmpty in embedding FlutterFragment" );
1669+ }
1670+
16641671 @ VisibleForTesting
16651672 @ NonNull
16661673 boolean shouldDelayFirstAndroidViewDraw () {
Original file line number Diff line number Diff line change @@ -56,6 +56,8 @@ public interface PlatformPluginDelegate {
5656 * androidx.activity.OnBackPressedDispatcher} will be executed.
5757 */
5858 boolean popSystemNavigator ();
59+
60+ void navigatorIsEmpty ();
5961 }
6062
6163 @ VisibleForTesting
@@ -111,6 +113,7 @@ public void setSystemUiOverlayStyle(
111113
112114 @ Override
113115 public void navigatorIsEmpty () {
116+ Log .e ("justin" , "navigatorIsEmpty in PlatformHandler.PlatformMessageChannel." );
114117 PlatformPlugin .this .navigatorIsEmpty ();
115118 }
116119
@@ -482,8 +485,7 @@ private void setSystemChromeSystemUIOverlayStyle(
482485
483486 private void navigatorIsEmpty () {
484487 Log .e ("justin" , "navigatorIsEmpty in PlatformPlugin" );
485- // TODO(justinmc): Can't quite call it like this, need FlutterActivity.
486- // activity.unregisterOnBackInvokedCallback();
488+ platformPluginDelegate .navigatorIsEmpty ();
487489 }
488490
489491 private void popSystemNavigator () {
You can’t perform that action at this time.
0 commit comments