@@ -430,16 +430,18 @@ private boolean execTransact(int code, long dataObj, long replyObj,
430430 } catch (RemoteException e ) {
431431 if ((flags & FLAG_ONEWAY ) != 0 ) {
432432 Log .w (TAG , "Binder call failed." , e );
433+ } else {
434+ reply .setDataPosition (0 );
435+ reply .writeException (e );
433436 }
434- reply .setDataPosition (0 );
435- reply .writeException (e );
436437 res = true ;
437438 } catch (RuntimeException e ) {
438439 if ((flags & FLAG_ONEWAY ) != 0 ) {
439440 Log .w (TAG , "Caught a RuntimeException from the binder stub implementation." , e );
441+ } else {
442+ reply .setDataPosition (0 );
443+ reply .writeException (e );
440444 }
441- reply .setDataPosition (0 );
442- reply .writeException (e );
443445 res = true ;
444446 } catch (OutOfMemoryError e ) {
445447 // Unconditionally log this, since this is generally unrecoverable.
@@ -452,6 +454,14 @@ private boolean execTransact(int code, long dataObj, long replyObj,
452454 checkParcel (this , code , reply , "Unreasonably large binder reply buffer" );
453455 reply .recycle ();
454456 data .recycle ();
457+
458+ // Just in case -- we are done with the IPC, so there should be no more strict
459+ // mode violations that have gathered for this thread. Either they have been
460+ // parceled and are now in transport off to the caller, or we are returning back
461+ // to the main transaction loop to wait for another incoming transaction. Either
462+ // way, strict mode begone!
463+ StrictMode .clearGatheredViolations ();
464+
455465 return res ;
456466 }
457467}
0 commit comments