Log if parcel size is too large when launching an activity.
Bug: 37172206 Test: manual Change-Id: I07ee7a8d1186d25716902eb00697eb9aa94c7629
This commit is contained in:
@@ -259,6 +259,19 @@ public final class Bundle extends BaseBundle implements Cloneable, Parcelable {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the size of {@link #mParcelledData} in bytes if available, otherwise {@code 0}.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public int getSize() {
|
||||
if (mParcelledData != null) {
|
||||
return mParcelledData.dataSize();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports whether the bundle contains any parcelled file descriptors.
|
||||
*/
|
||||
|
||||
@@ -1461,6 +1461,7 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
|
||||
mService.getGlobalConfiguration(), r.getMergedOverrideConfiguration());
|
||||
r.setLastReportedConfiguration(mergedConfiguration);
|
||||
|
||||
logIfTransactionTooLarge(r.intent, r.icicle);
|
||||
app.thread.scheduleLaunchActivity(new Intent(r.intent), r.appToken,
|
||||
System.identityHashCode(r), r.info,
|
||||
// TODO: Have this take the merged configuration instead of separate global and
|
||||
@@ -1546,6 +1547,21 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D
|
||||
return true;
|
||||
}
|
||||
|
||||
private void logIfTransactionTooLarge(Intent intent, Bundle icicle) {
|
||||
int extrasSize = 0;
|
||||
if (intent != null) {
|
||||
final Bundle extras = intent.getExtras();
|
||||
if (extras != null) {
|
||||
extrasSize = extras.getSize();
|
||||
}
|
||||
}
|
||||
int icicleSize = (icicle == null ? 0 : icicle.getSize());
|
||||
if (extrasSize + icicleSize > 200000) {
|
||||
Slog.e(TAG, "Transaction too large, intent: " + intent + ", extras size: " + extrasSize
|
||||
+ ", icicle size: " + icicleSize);
|
||||
}
|
||||
}
|
||||
|
||||
void startSpecificActivityLocked(ActivityRecord r,
|
||||
boolean andResume, boolean checkConfig) {
|
||||
// Is this activity's application already running?
|
||||
|
||||
Reference in New Issue
Block a user