How to find out what data saveInstance stores

got android.os.TransactionTooLargeException say because of

"This exception is thrown when too much data is sent through Parcels at the same time. The underlying Binder transaction buffer has a limited fixed size, currently 1Mb, which is shared by all transactions running for the process. Therefore, this exception can be thrown if there are many transactions. even if most of the individual transactions are of moderate size. "

   android.os.TransactionTooLargeException: data parcel size 593484 bytes
   at android.os.BinderProxy.transactNative(Binder.java)
   at android.os.BinderProxy.transact(Binder.java:628)
   at android.app.ActivityManagerProxy.activityStopped(ActivityManagerNative.java:4132)
   at android.app.ActivityThread$StopInfo.run(ActivityThread.java:4159)
   at android.os.Handler.handleCallback(Handler.java:751)
   at android.os.Handler.dispatchMessage(Handler.java:95)
   at android.os.Looper.loop(Looper.java:154)
   at android.app.ActivityThread.main(ActivityThread.java:6692)
   at java.lang.reflect.Method.invoke(Method.java)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)

      

At the time of failure, the logs show that mainActivity is started in SaveInstanceState () and with multiple fragments it contains.

  583   |   04:46:32:173 (UTC)  | MainActivity:onSaveInstanceState()
  584   |   04:46:32:174 (UTC)  | DataListFragment:onSaveInstanceState()
  585   |   04:46:32:174 (UTC)  | DrawerFragment:onSaveInstanceState()
  586   |   04:46:32:174 (UTC)  | DataContainerFragment:onSaveInstanceState()
  587   |   04:46:32:174 (UTC)  | DataDetailsFragment:onSaveInstanceState()
  588   |   04:46:32:175 (UTC)  | DataDetailsFragment:onSaveInstanceState()
  589   |   04:46:32:175 (UTC)  | DataDetailsFragment:onSaveInstanceState()

      

There is a drawer and a list fragment in mainActivity, clicking on the list item opens a container fragment which has a viewPage and contains three detail fragments.

It seems that the accumulated data has exceeded 1 megabyte of Binder.

Have all the chunks familiar with the stored data in their onSaveInstanceState () call, they are all small (int, boolean, etc.), adding all together less than a few k, say <10k.

Also looked at all slice layout files that use LiniearLayout, TextView, ImageView, WebView, etc. And I made a log to find out what data can be saved as an android.

All these fragments are displayed in the log. Overall views can save less than $ 30k.

So I don't know where this "data size of 593484 bytes" comes from.

Or there must be some other Android systems keep (?) As well.

Is there a way to find out or flush the "base buffer buffer" to find out what they might be from? Does anyone know what (or how to find) is the data that android says for the WebView?

===

Expanded view for logging, similar to the one used for the other view used in snippets

public class LogLinearLayout extends LinearLayout {

public LogLinearLayout(Context context) {
    super(context);
}

public LogLinearLayout(Context context, AttributeSet attrs) {
    super(context, attrs);
}

public LogLinearLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
}

@Override
protected void dispatchSaveInstanceState(SparseArray<Parcelable> container) {

    super.dispatchSaveInstanceState(container);

    for (int i = 0; i < container.size()-1; i++) {
        Parcelable val = (Parcelable)container.get(i);

        byte[] bytes = val != null ? marshall(val) : null;
        String parcelByte = (bytes != null) ? "bytes.length:"+bytes.length : ("val==null");

        if(bytes != null) {
            //Log container level the bytes.length
        }

    }
}

@Override
protected Parcelable onSaveInstanceState() {
    Parcelable pVal = super.onSaveInstanceState();

    byte[] bytes = pVal != null ? marshall(pVal) : null;
    String parcelByte = (bytes != null) ? "bytes.length:"+bytes.length : ("val==null");

    if (bytes != null) {
        //Log the bytes.length of this view
    }

    return pVal;
}

byte[] marshall(Parcelable parceable) {
        Parcel parcel = Parcel.obtain();
        parceable.writeToParcel(parcel, 0);
        byte[] bytes = parcel.marshall();
        parcel.recycle();
        return bytes;
}

      

}

+3


source to share





All Articles