Merge "Log if parcel size is too large when launching an activity."

This commit is contained in:
Sudheer Shanka
2017-05-23 20:04:57 +00:00
committed by Android (Google) Code Review
2 changed files with 29 additions and 0 deletions

View File

@@ -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.
*/

View File

@@ -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?