Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c02fca04 authored by Riddle Hsu's avatar Riddle Hsu Committed by Automerger Merge Worker
Browse files

Merge "Fix NPE caused by config change on a destroyed activity" into sc-v2-dev am: ee37f56c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15183789

Change-Id: I8dcf3e24e13cb89ed9f48049ee3fa6b9ae172200
parents 89f92d85 ee37f56c
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -5430,6 +5430,12 @@ public final class ActivityThread extends ClientTransactionHandler
                    // behave properly when activity is relaunching.
                    r.window.clearContentView();
                } else {
                    final ViewRootImpl viewRoot = v.getViewRootImpl();
                    if (viewRoot != null) {
                        // Clear the callback to avoid the destroyed activity from receiving
                        // configuration changes that are no longer effective.
                        viewRoot.setActivityConfigCallback(null);
                    }
                    wm.removeViewImmediate(v);
                }
            }
@@ -5834,10 +5840,9 @@ public final class ActivityThread extends ClientTransactionHandler

        final boolean movedToDifferentDisplay = isDifferentDisplay(activity.getDisplayId(),
                displayId);
        final SizeConfigurationBuckets buckets = getActivityClient(activityToken)
                .mSizeConfigurations;
        final ActivityClientRecord r = mActivities.get(activityToken);
        final int diff = diffPublicWithSizeBuckets(activity.mCurrentConfig,
                newConfig, buckets);
                newConfig, r != null ? r.mSizeConfigurations : null);
        final boolean hasPublicConfigChange = diff != 0;
        // TODO(b/173090263): Use diff instead after the improvement of AssetManager and
        // ResourcesImpl constructions.