diff --git a/packages/core/ui/frame/frame-common.ts b/packages/core/ui/frame/frame-common.ts index b6d090a755..71b3b3c13c 100644 --- a/packages/core/ui/frame/frame-common.ts +++ b/packages/core/ui/frame/frame-common.ts @@ -134,6 +134,15 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition { @profile public onLoaded() { + /** + * In android 12 and newer, back press can exit app without finishing activity but still removes the frame from stack. + * In that case, we rely on loaded lifecycle to add the frame back. + * Also, make sure the loaded lifecycle does not attempt to push the frame when it's already in the stack but is not the topmost. + */ + if (this._currentEntry && !this._isInFrameStack) { + this._pushInFrameStack(); + } + super.onLoaded(); this._processNextNavigationEntry(); } diff --git a/packages/core/ui/frame/index.android.ts b/packages/core/ui/frame/index.android.ts index d98f76ab91..c2340b926f 100644 --- a/packages/core/ui/frame/index.android.ts +++ b/packages/core/ui/frame/index.android.ts @@ -547,14 +547,6 @@ export class Frame extends FrameBase { super.disposeNativeView(); } - public _popFromFrameStack() { - if (!this._isInFrameStack) { - return; - } - - super._popFromFrameStack(); - } - public _getNavBarVisible(page: Page): boolean { switch (this.actionBarVisibility) { case 'never':