Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android] Check if mCurrentActivity is set according to LifecycleState #23336

Closed
wants to merge 8 commits into from

Conversation

RoJoHub
Copy link
Contributor

@RoJoHub RoJoHub commented Feb 7, 2019

Summary

Issues: Related to #13439
react-native-website:Related to PR #792
solution: #13439 (comment)

When we integration with Existing Android Apps.and set LifecycleState is LifecycleState.RESUMED.
It's lead to mCurrentActivity is null .

At this time , the behave of set mCurrentActivity which is unexpectedly.

Changelog

[Android] [Fixed] - Check if mCurrentActivity is set according to LifecycleState

Test Plan

Everything should run as usual.And Fix this Bug #13439 .

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Feb 7, 2019
@RoJoHub
Copy link
Contributor Author

RoJoHub commented Feb 7, 2019

Also i am confused that setCurrentActivity is not be used.

If setupReactContextRunnable runs faster thanmaybeRecreateReactContextRunnable,the value of activity is null from now on.Because of setupReactContextRunnable and maybeRecreateReactContextRunnable are asynchronous.

Copy link
Contributor

@matthargett matthargett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpojer this alternate approach should avoid the TTI impact mentioned in the internal review.

@RoJoHub
Copy link
Contributor Author

RoJoHub commented Feb 7, 2019

@matthargett

I'm not change iOS.But ci is warming.--->ci/circleci: test_ios

@RoJoHub
Copy link
Contributor Author

RoJoHub commented Feb 7, 2019

@matthargett
Also we should change doc of android.
integration-with-existing-apps

public class MyReactActivity extends Activity implements DefaultHardwareBackBtnHandler {
    private ReactRootView mReactRootView;
    private ReactInstanceManager mReactInstanceManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mReactRootView = new ReactRootView(this);
        mReactInstanceManager = ReactInstanceManager.builder()
                .setApplication(getApplication())
+               .setCurrentActivity(this)
                .setBundleAssetName("index.android.bundle")
                .setJSMainModulePath("index")
                .addPackage(new MainReactPackage())
                .setUseDeveloperSupport(BuildConfig.DEBUG)
                .setInitialLifecycleState(LifecycleState.RESUMED)
                .build();
        // The string here (e.g. "MyReactNativeApp") has to match
        // the string in AppRegistry.registerComponent() in index.js
        mReactRootView.startReactApplication(mReactInstanceManager, "MyReactNativeApp", null);

        setContentView(mReactRootView);
    }

    @Override
    public void invokeDefaultOnBackPressed() {
        super.onBackPressed();
    }
}

@hey99xx
Copy link

hey99xx commented Feb 14, 2019

I didn't review what's the actual bug, but I just want to point out that there are use cases of creating a ReactInstanceManager outside of an activity context. Requiring activity be set initially would break that use case.

For example in a brownfield app where not all activities are in RN, before the user navigates to a ReactActivity to speed things up, we can create ReactInstanceManager on the background, save it in an instance variable, then once the activity is launched we use that ReactInstanceManager already prepared.

@hey99xx
Copy link

hey99xx commented Feb 14, 2019

Similarly I don't understand how HeadlessJsTaskService where you pass null for activity would work after this change. Does it rely on that ReactNativeHost will always be creating a ReactInstanceManager first with an activity and then HeadlessJsTaskService will reuse the same ReactInstanceManager? If so that may not always be true either.

@RoJoHub
Copy link
Contributor Author

RoJoHub commented Feb 14, 2019

@hey99xx


Please observe its running order


    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mReactRootView = new ReactRootView(this);
        mReactInstanceManager = ReactInstanceManager.builder()
                .setApplication(getApplication())
                .setBundleAssetName("index.android.bundle")
                .setJSMainModulePath("index")
                .addPackage(new MainReactPackage())
                .setUseDeveloperSupport(BuildConfig.DEBUG)
                .setInitialLifecycleState(LifecycleState.RESUMED)
                .build();
        // 注意这里的MyReactNativeApp必须对应“index.js”中的
        // “AppRegistry.registerComponent()”的第一个参数
        mReactRootView.startReactApplication(mReactInstanceManager, "MyReactNativeApp", null);

        setContentView(mReactRootView);
    }

startReactApplication ->
createReactContextInBackground ->
recreateReactContextInBackgroundInner ->
recreateReactContextInBackgroundFromBundleLoader ->
recreateReactContextInBackground ->
runCreateReactContextOnNewThread ->
mCreateReactContextThread ->
setupReactContext ->
moveReactContextToCurrentLifecycleState ->
moveToResumedLifecycleState(true) ->
currentContext.onHostResume(mCurrentActivity)


In moveToResumedLifecycleState(true) -> currentContext.onHostResume(mCurrentActivity), we will pass mCurrentActivity to currentContext, but what if mCurrentActivity is null at this time?

We can know that setupReactContext is asynchronous.
We set the value of mCurrentActivity through the onHostResume of ReactInstanceManager.


In the past, reactInstanceManager.builder() was not call setCurrentActivity.
So in ReactInstanceManager, the value of mCurrentActivity is always null, and only wait until mReactInstanceManager.onHostResume(this, this) is executed to set value of mCurrentActivity


Set the value of mCurrentActivity of mReactInstanceManager here.
Before this, the value of mCurrentActivity is null.

@Override
protected void onResume() {
    super.onResume();

    if (mReactInstanceManager != null) {
        mReactInstanceManager.onHostResume(this, this);
    }
}

Summary

Sometimes the moveToResumedLifecycleState in startReactApplication is executed faster than mReactInstanceManager.onHostResume(this, this);.
At this time, the value of mCurrentActivity is null.
So it will call currentContext.onHostResume(null)

private synchronized void moveToResumedLifecycleState(boolean force) {
        ...
        // at this time,the value of mCurrentActivity is null
        currentContext.onHostResume(mCurrentActivity);
        ...
    }

So the value obtained by other modules executing getCurrentActivity is null

public @Nullable Activity getCurrentActivity() {
    if (mCurrentActivity == null) {
      return null;
    }
    return mCurrentActivity.get();
  }

@RoJoHub
Copy link
Contributor Author

RoJoHub commented Feb 14, 2019

@hey99xx

We are asynchronous to set the value of mCurrentActivity in ReactInstanceManager!!!!!!


Execute first

@Override
protected void onResume() {
    super.onResume();

    if (mReactInstanceManager != null) {
        mReactInstanceManager.onHostResume(this, this);
    }
}

Post execution

@Override
protected void onResume() {
    super.onResume();

    if (mReactInstanceManager != null) {
        mReactInstanceManager.onHostResume(this, this);
    }
}

@RoJoHub
Copy link
Contributor Author

RoJoHub commented Feb 14, 2019

Two point to set mCurrentActivity

startReactApplication ->
createReactContextInBackground ->
recreateReactContextInBackgroundInner ->
recreateReactContextInBackgroundFromBundleLoader ->
recreateReactContextInBackground ->
runCreateReactContextOnNewThread ->
mCreateReactContextThread ->
setupReactContext ->
moveReactContextToCurrentLifecycleState ->
moveToResumedLifecycleState(true) ->
currentContext.onHostResume(mCurrentActivity)

and

@Override
protected void onResume() {
    super.onResume();

    if (mReactInstanceManager != null) {
        mReactInstanceManager.onHostResume(this, this);
    }
}

My English is very poor, please carefully observe the execution order and changes in mCurrentActivity.

@hey99xx
Copy link

hey99xx commented Feb 14, 2019

I understand onHostResume is called with null and looks like a bug, but regardless of that you should attempt to fix a bug in a way considering other use cases:

For your flow:

moveReactContextToCurrentLifecycleState ->
moveToResumedLifecycleState(true) ->
currentContext.onHostResume(mCurrentActivity)

moveReactContextToCurrentLifecycleState will call moveToResumedLifecycleState only if it's at LifecycleState.RESUME state:

private synchronized void moveReactContextToCurrentLifecycleState() {
if (mLifecycleState == LifecycleState.RESUMED) {
moveToResumedLifecycleState(true);
}
}

But you can call ReactInstanceManager.builder().setInitialLifecycleState(LifecycleState.BEFORE_CREATE). Then your initial state isn't LifecycleState.RESUMED and will not reach moveToResumedLifecycleState until mReactInstanceManager.onHostResume(this, this); is called.

So maybe you can improve code by:

+ if (mInitialLifecycleState == LifecycleState.RESUMED) {
    Assertions.assertNotNull(
         mCurrentActivity,
-        "activity property has not been set with this builder");
+        "activity needs to be set if initial lifecycle state is resumed");
+ }

@hey99xx
Copy link

hey99xx commented Feb 14, 2019

You can see that by default .setInitialLifecycleState(LifecycleState.BEFORE_CREATE) is already called.

So your problem only happens if you called .setInitialLifecycleState(LifecycleState.RESUMED) manually.

protected ReactInstanceManager createReactInstanceManager() {
ReactMarker.logMarker(ReactMarkerConstants.BUILD_REACT_INSTANCE_MANAGER_START);
ReactInstanceManagerBuilder builder = ReactInstanceManager.builder()
.setApplication(mApplication)
.setJSMainModulePath(getJSMainModuleName())
.setUseDeveloperSupport(getUseDeveloperSupport())
.setRedBoxHandler(getRedBoxHandler())
.setJavaScriptExecutorFactory(getJavaScriptExecutorFactory())
.setUIImplementationProvider(getUIImplementationProvider())
.setJSIModulesPackage(getJSIModulePackage())
.setInitialLifecycleState(LifecycleState.BEFORE_CREATE);

@RoJoHub
Copy link
Contributor Author

RoJoHub commented Feb 15, 2019

I understand onHostResume is called with null and looks like a bug, but regardless of that you should attempt to fix a bug in a way considering other use cases:

For your flow:

moveReactContextToCurrentLifecycleState ->
moveToResumedLifecycleState(true) ->
currentContext.onHostResume(mCurrentActivity)

moveReactContextToCurrentLifecycleState will call moveToResumedLifecycleState only if it's at LifecycleState.RESUME state:
react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java

Lines 693 to 697 in be282b5

private synchronized void moveReactContextToCurrentLifecycleState() {
if (mLifecycleState == LifecycleState.RESUMED) {
moveToResumedLifecycleState(true);
}
}
But you can call ReactInstanceManager.builder().setInitialLifecycleState(LifecycleState.BEFORE_CREATE). Then your initial state isn't LifecycleState.RESUMED and will not reach moveToResumedLifecycleState until mReactInstanceManager.onHostResume(this, this); is called.

So maybe you can improve code by:

+ if (mInitialLifecycleState == LifecycleState.RESUMED) {
    Assertions.assertNotNull(
         mCurrentActivity,
-        "activity property has not been set with this builder");
+        "activity needs to be set if initial lifecycle state is resumed");
+ }

You can see that by default .setInitialLifecycleState(LifecycleState.BEFORE_CREATE) is already called.

So your problem only happens if you called .setInitialLifecycleState(LifecycleState.RESUMED) manually.

react-native/ReactAndroid/src/main/java/com/facebook/react/ReactNativeHost.java

Lines 66 to 76 in b002df9

protected ReactInstanceManager createReactInstanceManager() {
ReactMarker.logMarker(ReactMarkerConstants.BUILD_REACT_INSTANCE_MANAGER_START);
ReactInstanceManagerBuilder builder = ReactInstanceManager.builder()
.setApplication(mApplication)
.setJSMainModulePath(getJSMainModuleName())
.setUseDeveloperSupport(getUseDeveloperSupport())
.setRedBoxHandler(getRedBoxHandler())
.setJavaScriptExecutorFactory(getJavaScriptExecutorFactory())
.setUIImplementationProvider(getUIImplementationProvider())
.setJSIModulesPackage(getJSIModulePackage())
.setInitialLifecycleState(LifecycleState.BEFORE_CREATE);

You're right.
But docs is said that integration-with-existing-apps-Android .

public class MyReactActivity extends Activity implements DefaultHardwareBackBtnHandler {
    private ReactRootView mReactRootView;
    private ReactInstanceManager mReactInstanceManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mReactRootView = new ReactRootView(this);
        mReactInstanceManager = ReactInstanceManager.builder()
                .setApplication(getApplication())
                .setBundleAssetName("index.android.bundle")
                .setJSMainModulePath("index")
                .addPackage(new MainReactPackage())
                .setUseDeveloperSupport(BuildConfig.DEBUG)
                .setInitialLifecycleState(LifecycleState.RESUMED)
                .build();
        // The string here (e.g. "MyReactNativeApp") has to match
        // the string in AppRegistry.registerComponent() in index.js
        mReactRootView.startReactApplication(mReactInstanceManager, "MyReactNativeApp", null);

        setContentView(mReactRootView);
    }

    @Override
    public void invokeDefaultOnBackPressed() {
        super.onBackPressed();
    }
}

It's call setInitialLifecycleState(LifecycleState.RESUMED).
So.this bug only happen Integration with Existing Apps-Android

@RoJoHub
Copy link
Contributor Author

RoJoHub commented Feb 15, 2019

@hey99xx

We are asynchronous to set the value of mCurrentActivity in ReactInstanceManager!!!!!!

Execute first

@Override
protected void onResume() {
    super.onResume();

    if (mReactInstanceManager != null) {
        mReactInstanceManager.onHostResume(this, this);
    }
}

Post execution

@Override
protected void onResume() {
    super.onResume();

    if (mReactInstanceManager != null) {
        mReactInstanceManager.onHostResume(this, this);
    }
}

I have a place before I said something wrong.

moveToResumedLifecycleState(true) is run faster than mReactInstanceManager.onHostResume(this, this);

At this time,the state is LifecycleState.RESUMED,and also the value of mCurrentActivityis null.

So it caused this bug.#13439

@RoJoHub
Copy link
Contributor Author

RoJoHub commented Feb 15, 2019

@hey99xx
I have change my pr.
Please review my code again.


Also we should change doc of android.
integration-with-existing-apps-android

public class MyReactActivity extends Activity implements DefaultHardwareBackBtnHandler {
    private ReactRootView mReactRootView;
    private ReactInstanceManager mReactInstanceManager;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        mReactRootView = new ReactRootView(this);
        mReactInstanceManager = ReactInstanceManager.builder()
                .setApplication(getApplication())
+               .setCurrentActivity(this)
                .setBundleAssetName("index.android.bundle")
                .setJSMainModulePath("index")
                .addPackage(new MainReactPackage())
                .setUseDeveloperSupport(BuildConfig.DEBUG)
                .setInitialLifecycleState(LifecycleState.RESUMED)
                .build();
        // The string here (e.g. "MyReactNativeApp") has to match
        // the string in AppRegistry.registerComponent() in index.js
        mReactRootView.startReactApplication(mReactInstanceManager, "MyReactNativeApp", null);

        setContentView(mReactRootView);
    }

    @Override
    public void invokeDefaultOnBackPressed() {
        super.onBackPressed();
    }
}

@hey99xx
Copy link

hey99xx commented Feb 15, 2019

I'll approve the PR but I'm neither working for FB nor a maintainer for react-native so you'll wait for someone else's approval.

Also we should change doc of android.

Agreed. Do you want to send a pull request to https://github.com/facebook/react-native-website/blob/master/docs/integration-with-existing-apps.md too?

@RoJoHub
Copy link
Contributor Author

RoJoHub commented Feb 15, 2019

I'll approve the PR but I'm neither working for FB nor a maintainer for react-native so you'll wait for someone else's approval.

Also we should change doc of android.

Agreed. Do you want to send a pull request to https://github.com/facebook/react-native-website/blob/master/docs/integration-with-existing-apps.md too?

Haha, I just submitted this PR#792.
Please help me see it. Thank you!!!

@RoJoHub RoJoHub changed the title [Android] Sometimes setupReactContextRunnable is run faster than maybeRecreateR… [Android] Added check of the status of the activity Feb 23, 2019
@RoJoHub RoJoHub changed the title [Android] Added check of the status of the activity [Android] Check if mCurrentActivity is set according to LifecycleState Feb 23, 2019
@RoJoHub
Copy link
Contributor Author

RoJoHub commented Feb 23, 2019

@mdvacca
I update Summary and ChangeLog
Please review again.

Copy link
Contributor

@cpojer cpojer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good.

@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Mar 4, 2019
@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Mar 5, 2019
@cpojer
Copy link
Contributor

cpojer commented Mar 5, 2019

It seems like the only thing in our way is one more internal test that is now failing. I'm unfortunately not an Android expert so I'm unsure how to get the current activity so I can set it on the builder. All I seem to have available is an InstrumentationRegistry (from android.support.test.InstrumentationRegistry) or an InstrumentationTestCase (from android.test.InstrumentationTestCase). Do you have any idea about how I could patch up my test?

It does seem that part of the test is to wait for a ReactContext to be initialized asynchronously, so I'm unsure whether this can be fixed :O

@RoJoHub
Copy link
Contributor Author

RoJoHub commented Mar 5, 2019

InstrumentationTestCase

Maybe is that? @cpojer

    Activity activity = (Activity)InstrumentationRegistry.getTargetContext();
    build.setCurrentActivity(activity);

Related to Get context of test project in Android junit test case

@facebook-github-bot
Copy link
Contributor

I tried to merge this pull request into the Facebook internal repo but some checks failed. To unblock yourself please check the following: Does this pull request pass all open source tests on GitHub? If not please fix those. Does the code still apply cleanly on top of GitHub master? If not can please rebase. In all other cases this means some internal test failed, for example a part of a fb app won't work with this pull request. I've added the Import Failed label to this pull request so it is easy for someone at fb to find the pull request and check what failed. If you don't see anyone comment in a few days feel free to comment mentioning one of the core contributors to the project so they get a notification.

@facebook-github-bot facebook-github-bot added Import Failed and removed Import Started This pull request has been imported. This does not imply the PR has been approved. labels Mar 8, 2019
@RoJoHub
Copy link
Contributor Author

RoJoHub commented Mar 10, 2019

I can't find other info for this pr because The current problem is that this test is internal .

Could you please tell what to do next?

@cpojer
Copy link
Contributor

cpojer commented Mar 13, 2019

@RoJoHub sorry I was away last week so I couldn't get to this. I just tried your proposed change but now it causes an issue when destroying the instance manager: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.facebook.react.ReactInstanceManager.destroy()' on a null object reference :(

@RoJoHub
Copy link
Contributor Author

RoJoHub commented Mar 13, 2019

@RoJoHub sorry I was away last week so I couldn't get to this. I just tried your proposed change but now it causes an issue when destroying the instance manager: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.facebook.react.ReactInstanceManager.destroy()' on a null object reference :(

Now the error prompts that the onDestory method is called on a null object.

The current information can't make me locate the error.

java.lang.NullPointerException: Attempt to invoke virtual method 'void com.facebook.react.ReactInstanceManager.destroy()' on a null object reference

By the way ,It's hard to locate where the error is.
Beacause I don't know what happened to the internal test.

@cpojer
Copy link
Contributor

cpojer commented Mar 13, 2019

I'm sorry for making this hard but I'm not an expert on this part of the codebase so it's a bit hard. I did the cast as you suggested but maybe it didn't work properly and it is now setting the wrong thing as the activity, that then later crashes? Do you have any suggestions on how I could figure this out properly?

@RoJoHub
Copy link
Contributor Author

RoJoHub commented Mar 14, 2019

@cpojer
I don't know which class is used for internal testing.But I have three ways to solve.

Case 1: ActivityInstrumentationTestCase2

If We extend ActivityInstrumentationTestCase2.The generics is class of activity.
For example :extends ActivityInstrumentationTestCase2<ReactAppTestActivity>

public abstract class ReactInstrumentationTest
extends ActivityInstrumentationTestCase2<ReactAppTestActivity> implements IdleWaiter {
protected StringRecordingModule mRecordingModule;
@Nullable protected FabricUIManagerFactory mFabricUIManagerFactory = null;
@Nullable protected JavaScriptExecutorFactory mJavaScriptExecutorFactory = null;
public ReactInstrumentationTest() {
super(ReactAppTestActivity.class);
}
@Override
protected void setUp() throws Exception {
super.setUp();
Intent intent = new Intent();
intent.putExtra(ReactAppTestActivity.EXTRA_IS_FABRIC_TEST, isFabricTest());
setActivityIntent(intent);
mRecordingModule = new StringRecordingModule();
final ReactAppTestActivity activity = getActivity();
activity.loadBundle(createReactInstanceSpecForTest(), getBundleName(), getEnableDevSupport());
}

If we want get activity,just call getActivity()

Activity activity = getActivity();

Case 2: AndroidJUnit4.class

If an annotation is AndroidJUnit4.class.

we should set a activity that we want to test.

@Rule public ActivityTestRule<Activity> mActivityRule = new ActivityTestRule<>(Activity.class);

If we want get activity,just call mActivityRule.getActivity()

Activity activity = mActivityRule.getActivity();

public class ReactInstanceManagerTest {
private static final String TEST_MODULE = "ViewLayoutTestApp";
private ReactInstanceManager mReactInstanceManager;
private ReactRootView mReactRootView;
@Rule public ActivityTestRule<Activity> mActivityRule = new ActivityTestRule<>(Activity.class);
@Before
public void setup() {
Activity activity = mActivityRule.getActivity();
mReactRootView = new ReactRootView(activity);

Case 3: InstrumentationTestCase & InstrumentationRegistry

It's from [developer.android.com->startActivitySync]
public Activity startActivitySync (Intent intent)

(https://developer.android.com/reference/android/app/Instrumentation.html#startActivitySync(android.content.Intent))

        Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
        Intent intent = new Intent();
        intent.setClass(instrumentation.getTargetContext(), Activity.class);
        Activity activity =InstrumentationRegistry.getInstrumentation().startActivitySync(intent);

Finally,we get activity.

@RoJoHub
Copy link
Contributor Author

RoJoHub commented Mar 23, 2019

@cpojer

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@cpojer
Copy link
Contributor

cpojer commented Jun 12, 2019

Thanks to @makovkastar who fixed the internal issue we were having I was finally able to land this Pull Request. I want to apologize again for how long it took.

@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @RoJoHub in fb550e9.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added Merged This PR has been merged. and removed Import Failed labels Jun 12, 2019
kelset pushed a commit that referenced this pull request Jul 3, 2019
Summary:
Issues: Related to  #13439
react-native-website:Related to PR [#792](facebook/react-native-website#792)
solution: #13439 (comment)

When we integration with Existing  Android Apps.and set LifecycleState  is `LifecycleState.RESUMED`.
It's lead to `mCurrentActivity`  is null .

At this time , the behave of set `mCurrentActivity ` which  is unexpectedly.

## Changelog
[Android] [Fixed] - Check if mCurrentActivity is set according to LifecycleState
Pull Request resolved: #23336

Differential Revision: D14298654

Pulled By: cpojer

fbshipit-source-id: 5cc17539a51154faeb838349b068d92511946f79
M-i-k-e-l pushed a commit to M-i-k-e-l/react-native that referenced this pull request Mar 10, 2020
…k#23336)

Summary:
Issues: Related to  facebook#13439
react-native-website:Related to PR [facebook#792](facebook/react-native-website#792)
solution: facebook#13439 (comment)

When we integration with Existing  Android Apps.and set LifecycleState  is `LifecycleState.RESUMED`.
It's lead to `mCurrentActivity`  is null .

At this time , the behave of set `mCurrentActivity ` which  is unexpectedly.

## Changelog
[Android] [Fixed] - Check if mCurrentActivity is set according to LifecycleState
Pull Request resolved: facebook#23336

Differential Revision: D14298654

Pulled By: cpojer

fbshipit-source-id: 5cc17539a51154faeb838349b068d92511946f79
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. Platform: Android Android applications.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants