Merge "Fix NPE caused by config change on a destroyed activity" into sc-v2-dev
This commit is contained in:
@@ -5430,6 +5430,12 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
// behave properly when activity is relaunching.
|
// behave properly when activity is relaunching.
|
||||||
r.window.clearContentView();
|
r.window.clearContentView();
|
||||||
} else {
|
} 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);
|
wm.removeViewImmediate(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5834,10 +5840,9 @@ public final class ActivityThread extends ClientTransactionHandler
|
|||||||
|
|
||||||
final boolean movedToDifferentDisplay = isDifferentDisplay(activity.getDisplayId(),
|
final boolean movedToDifferentDisplay = isDifferentDisplay(activity.getDisplayId(),
|
||||||
displayId);
|
displayId);
|
||||||
final SizeConfigurationBuckets buckets = getActivityClient(activityToken)
|
final ActivityClientRecord r = mActivities.get(activityToken);
|
||||||
.mSizeConfigurations;
|
|
||||||
final int diff = diffPublicWithSizeBuckets(activity.mCurrentConfig,
|
final int diff = diffPublicWithSizeBuckets(activity.mCurrentConfig,
|
||||||
newConfig, buckets);
|
newConfig, r != null ? r.mSizeConfigurations : null);
|
||||||
final boolean hasPublicConfigChange = diff != 0;
|
final boolean hasPublicConfigChange = diff != 0;
|
||||||
// TODO(b/173090263): Use diff instead after the improvement of AssetManager and
|
// TODO(b/173090263): Use diff instead after the improvement of AssetManager and
|
||||||
// ResourcesImpl constructions.
|
// ResourcesImpl constructions.
|
||||||
|
|||||||
Reference in New Issue
Block a user