mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Back out "Add onUserLeaveHint support to ReactActivityDelegate"
Summary: This is causing Twilight Android app to hang and crash on start Original commit changeset: 3f24271405f6 Original Phabricator Diff: D54905564 Reviewed By: sammy-SC Differential Revision: D54960053 fbshipit-source-id: 5c1063f11ae1314e71288905eb6d8da32ddbfadd
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e19d77828d
commit
f2f62cdf54
@@ -99,7 +99,6 @@ public abstract class com/facebook/react/ReactActivity : androidx/appcompat/app/
|
||||
protected fun onPause ()V
|
||||
public fun onRequestPermissionsResult (I[Ljava/lang/String;[I)V
|
||||
protected fun onResume ()V
|
||||
public fun onUserLeaveHint ()V
|
||||
public fun onWindowFocusChanged (Z)V
|
||||
public fun requestPermissions ([Ljava/lang/String;ILcom/facebook/react/modules/core/PermissionListener;)V
|
||||
}
|
||||
@@ -130,7 +129,6 @@ public class com/facebook/react/ReactActivityDelegate {
|
||||
public fun onPause ()V
|
||||
public fun onRequestPermissionsResult (I[Ljava/lang/String;[I)V
|
||||
public fun onResume ()V
|
||||
public fun onUserLeaveHint ()V
|
||||
public fun onWindowFocusChanged (Z)V
|
||||
public fun requestPermissions ([Ljava/lang/String;ILcom/facebook/react/modules/core/PermissionListener;)V
|
||||
}
|
||||
@@ -159,7 +157,6 @@ public class com/facebook/react/ReactDelegate {
|
||||
public fun onKeyDown (ILandroid/view/KeyEvent;)Z
|
||||
public fun onKeyLongPress (I)Z
|
||||
public fun onNewIntent (Landroid/content/Intent;)Z
|
||||
public fun onUserLeaveHint ()V
|
||||
public fun onWindowFocusChanged (Z)V
|
||||
public fun shouldShowDevMenuOrReload (ILandroid/view/KeyEvent;)Z
|
||||
}
|
||||
@@ -209,7 +206,6 @@ public abstract interface class com/facebook/react/ReactHost {
|
||||
public abstract fun onConfigurationChanged (Landroid/content/Context;)V
|
||||
public abstract fun onHostDestroy ()V
|
||||
public abstract fun onHostDestroy (Landroid/app/Activity;)V
|
||||
public abstract fun onHostLeaveHint (Landroid/app/Activity;)V
|
||||
public abstract fun onHostPause ()V
|
||||
public abstract fun onHostPause (Landroid/app/Activity;)V
|
||||
public abstract fun onHostResume (Landroid/app/Activity;)V
|
||||
@@ -253,7 +249,6 @@ public class com/facebook/react/ReactInstanceManager {
|
||||
public fun onHostResume (Landroid/app/Activity;)V
|
||||
public fun onHostResume (Landroid/app/Activity;Lcom/facebook/react/modules/core/DefaultHardwareBackBtnHandler;)V
|
||||
public fun onNewIntent (Landroid/content/Intent;)V
|
||||
public fun onUserLeaveHint (Landroid/app/Activity;)V
|
||||
public fun onWindowFocusChange (Z)V
|
||||
public fun recreateReactContextInBackground ()V
|
||||
public fun removeReactInstanceEventListener (Lcom/facebook/react/ReactInstanceEventListener;)V
|
||||
@@ -488,7 +483,6 @@ public class com/facebook/react/animated/NativeAnimatedNodesManager : com/facebo
|
||||
public abstract interface class com/facebook/react/bridge/ActivityEventListener {
|
||||
public abstract fun onActivityResult (Landroid/app/Activity;IILandroid/content/Intent;)V
|
||||
public abstract fun onNewIntent (Landroid/content/Intent;)V
|
||||
public fun onUserLeaveHint (Landroid/app/Activity;)V
|
||||
}
|
||||
|
||||
public class com/facebook/react/bridge/Arguments {
|
||||
@@ -1115,7 +1109,6 @@ public class com/facebook/react/bridge/ReactContext : android/content/ContextWra
|
||||
public fun onHostPause ()V
|
||||
public fun onHostResume (Landroid/app/Activity;)V
|
||||
public fun onNewIntent (Landroid/app/Activity;Landroid/content/Intent;)V
|
||||
public fun onUserLeaveHint (Landroid/app/Activity;)V
|
||||
public fun onWindowFocusChange (Z)V
|
||||
public fun registerSegment (ILjava/lang/String;Lcom/facebook/react/bridge/Callback;)V
|
||||
public fun removeActivityEventListener (Lcom/facebook/react/bridge/ActivityEventListener;)V
|
||||
@@ -1265,8 +1258,6 @@ public final class com/facebook/react/bridge/ReactMarkerConstants : java/lang/En
|
||||
public static final field ON_HOST_PAUSE_START Lcom/facebook/react/bridge/ReactMarkerConstants;
|
||||
public static final field ON_HOST_RESUME_END Lcom/facebook/react/bridge/ReactMarkerConstants;
|
||||
public static final field ON_HOST_RESUME_START Lcom/facebook/react/bridge/ReactMarkerConstants;
|
||||
public static final field ON_USER_LEAVE_HINT_END Lcom/facebook/react/bridge/ReactMarkerConstants;
|
||||
public static final field ON_USER_LEAVE_HINT_START Lcom/facebook/react/bridge/ReactMarkerConstants;
|
||||
public static final field PRE_REACT_CONTEXT_END Lcom/facebook/react/bridge/ReactMarkerConstants;
|
||||
public static final field PRE_RUN_JS_BUNDLE_START Lcom/facebook/react/bridge/ReactMarkerConstants;
|
||||
public static final field PRE_SETUP_REACT_CONTEXT_END Lcom/facebook/react/bridge/ReactMarkerConstants;
|
||||
@@ -3654,7 +3645,6 @@ public class com/facebook/react/runtime/ReactHostImpl : com/facebook/react/React
|
||||
public fun onConfigurationChanged (Landroid/content/Context;)V
|
||||
public fun onHostDestroy ()V
|
||||
public fun onHostDestroy (Landroid/app/Activity;)V
|
||||
public fun onHostLeaveHint (Landroid/app/Activity;)V
|
||||
public fun onHostPause ()V
|
||||
public fun onHostPause (Landroid/app/Activity;)V
|
||||
public fun onHostResume (Landroid/app/Activity;)V
|
||||
|
||||
@@ -105,12 +105,6 @@ public abstract class ReactActivity extends AppCompatActivity
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUserLeaveHint() {
|
||||
super.onUserLeaveHint();
|
||||
mDelegate.onUserLeaveHint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestPermissions(
|
||||
String[] permissions, int requestCode, PermissionListener listener) {
|
||||
|
||||
-4
@@ -125,10 +125,6 @@ public class ReactActivityDelegate {
|
||||
getPlainActivity().setContentView(mReactDelegate.getReactRootView());
|
||||
}
|
||||
|
||||
public void onUserLeaveHint() {
|
||||
mReactDelegate.onUserLeaveHint();
|
||||
}
|
||||
|
||||
public void onPause() {
|
||||
mReactDelegate.onHostPause();
|
||||
}
|
||||
|
||||
-10
@@ -97,16 +97,6 @@ public class ReactDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
public void onUserLeaveHint() {
|
||||
if (ReactFeatureFlags.enableBridgelessArchitecture) {
|
||||
mReactHost.onHostLeaveHint(mActivity);
|
||||
} else {
|
||||
if (getReactNativeHost().hasInstance()) {
|
||||
getReactNativeHost().getReactInstanceManager().onUserLeaveHint(mActivity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onHostPause() {
|
||||
if (ReactFeatureFlags.enableBridgelessArchitecture) {
|
||||
mReactHost.onHostPause(mActivity);
|
||||
|
||||
@@ -64,12 +64,6 @@ public interface ReactHost {
|
||||
/** To be called when the host activity is resumed. */
|
||||
public fun onHostResume(activity: Activity?)
|
||||
|
||||
/**
|
||||
* To be called when the host activity is about to go into the background as the result of user
|
||||
* choice.
|
||||
*/
|
||||
public fun onHostLeaveHint(activity: Activity?)
|
||||
|
||||
/** To be called when the host activity is paused. */
|
||||
public fun onHostPause(activity: Activity?)
|
||||
|
||||
|
||||
-23
@@ -583,29 +583,6 @@ public class ReactInstanceManager {
|
||||
moveToBeforeResumeLifecycleState();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method should be called from {@link Activity#onUserLeaveHint()}. It notifies all listening
|
||||
* modules that the user is about to leave the activity. The passed Activity is has to be the
|
||||
* current Activity.
|
||||
*
|
||||
* @param activity the activity being backgrounded as a result of user action
|
||||
*/
|
||||
@ThreadConfined(UI)
|
||||
public void onUserLeaveHint(@Nullable Activity activity) {
|
||||
if (mRequireActivity) {
|
||||
Assertions.assertCondition(mCurrentActivity != null);
|
||||
}
|
||||
|
||||
if (mCurrentActivity != null && activity == mCurrentActivity) {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
|
||||
ReactContext currentContext = getCurrentReactContext();
|
||||
if (currentContext != null) {
|
||||
currentContext.onUserLeaveHint(activity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this from {@link Activity#onPause()}. This notifies any listening modules so they can do
|
||||
* any necessary cleanup. The passed Activity is the current Activity being paused. This will
|
||||
|
||||
-3
@@ -22,7 +22,4 @@ public interface ActivityEventListener {
|
||||
|
||||
/** Called when a new intent is passed to the activity */
|
||||
void onNewIntent(Intent intent);
|
||||
|
||||
/** Called when host activity receives an {@link Activity#onUserLeaveHint()} call. */
|
||||
default void onUserLeaveHint(Activity activity) {};
|
||||
}
|
||||
|
||||
-13
@@ -331,19 +331,6 @@ public class ReactContext extends ContextWrapper {
|
||||
ReactMarker.logMarker(ReactMarkerConstants.ON_HOST_RESUME_END);
|
||||
}
|
||||
|
||||
@ThreadConfined(UI)
|
||||
public void onUserLeaveHint(@Nullable Activity activity) {
|
||||
ReactMarker.logMarker(ReactMarkerConstants.ON_USER_LEAVE_HINT_START);
|
||||
for (ActivityEventListener listener : mActivityEventListeners) {
|
||||
try {
|
||||
listener.onUserLeaveHint(activity);
|
||||
} catch (RuntimeException e) {
|
||||
handleException(e);
|
||||
}
|
||||
}
|
||||
ReactMarker.logMarker(ReactMarkerConstants.ON_USER_LEAVE_HINT_END);
|
||||
}
|
||||
|
||||
@ThreadConfined(UI)
|
||||
public void onNewIntent(@Nullable Activity activity, Intent intent) {
|
||||
UiThreadUtil.assertOnUiThread();
|
||||
|
||||
-2
@@ -52,8 +52,6 @@ public enum ReactMarkerConstants {
|
||||
INITIALIZE_MODULE_END,
|
||||
ON_HOST_RESUME_START,
|
||||
ON_HOST_RESUME_END,
|
||||
ON_USER_LEAVE_HINT_START,
|
||||
ON_USER_LEAVE_HINT_END,
|
||||
ON_HOST_PAUSE_START,
|
||||
ON_HOST_PAUSE_END,
|
||||
CONVERT_CONSTANTS_START,
|
||||
|
||||
-12
@@ -290,18 +290,6 @@ public class ReactHostImpl implements ReactHost {
|
||||
mReactLifecycleStateManager.moveToOnHostResume(currentContext, getCurrentActivity());
|
||||
}
|
||||
|
||||
@ThreadConfined(UI)
|
||||
@Override
|
||||
public void onHostLeaveHint(final @Nullable Activity activity) {
|
||||
final String method = "onUserLeaveHint(activity)";
|
||||
log(method);
|
||||
|
||||
ReactContext currentContext = getCurrentReactContext();
|
||||
if (currentContext != null) {
|
||||
currentContext.onUserLeaveHint(activity);
|
||||
}
|
||||
}
|
||||
|
||||
@ThreadConfined(UI)
|
||||
@Override
|
||||
public void onHostPause(final @Nullable Activity activity) {
|
||||
|
||||
Reference in New Issue
Block a user