@@ -626,12 +626,22 @@ void IPCThreadState::flushCommands()
626626{
627627 if (mProcess ->mDriverFD < 0 )
628628 return ;
629- talkWithDriver (false );
629+
630+ if (status_t res = talkWithDriver (false ); res != OK) {
631+ // TODO: we may want to abort for some of these cases
632+ ALOGW (" 1st call to talkWithDriver returned error in flushCommands: %s" ,
633+ statusToString (res).c_str ());
634+ }
635+
630636 // The flush could have caused post-write refcount decrements to have
631637 // been executed, which in turn could result in BC_RELEASE/BC_DECREFS
632638 // being queued in mOut. So flush again, if we need to.
633639 if (mOut .dataSize () > 0 ) {
634- talkWithDriver (false );
640+ if (status_t res = talkWithDriver (false ); res != OK) {
641+ // TODO: we may want to abort for some of these cases
642+ ALOGW (" 2nd call to talkWithDriver returned error in flushCommands: %s" ,
643+ statusToString (res).c_str ());
644+ }
635645 }
636646 if (mOut .dataSize () > 0 ) {
637647 ALOGW (" mOut.dataSize() > 0 after flushCommands()" );
@@ -803,7 +813,11 @@ void IPCThreadState::joinThreadPool(bool isMain)
803813
804814 mOut .writeInt32 (BC_EXIT_LOOPER);
805815 mIsLooper = false ;
806- talkWithDriver (false );
816+ if (status_t res = talkWithDriver (false ); res != OK) {
817+ // TODO: we may want to abort for some of these cases
818+ ALOGW (" call to talkWithDriver in joinThreadPool returned error: %s, FD: %d" ,
819+ statusToString (res).c_str (), mProcess ->mDriverFD );
820+ }
807821 size_t oldCount = mProcess ->mCurrentThreads .fetch_sub (1 );
808822 LOG_ALWAYS_FATAL_IF (oldCount == 0 ,
809823 " Threadpool thread count underflowed. Thread cannot exist and exit in "
@@ -839,12 +853,8 @@ status_t IPCThreadState::handlePolledCommands()
839853
840854void IPCThreadState::stopProcess (bool /* immediate*/ )
841855{
842- // ALOGI("**** STOPPING PROCESS");
843- flushCommands ();
844- int fd = mProcess ->mDriverFD ;
845- mProcess ->mDriverFD = -1 ;
846- close (fd);
847- // kill(getpid(), SIGKILL);
856+ ALOGI (" IPCThreadState::stopProcess() (deprecated) called. Exiting process." );
857+ exit (0 );
848858}
849859
850860status_t IPCThreadState::transact (int32_t handle,
@@ -1494,7 +1504,14 @@ status_t IPCThreadState::executeCommand(int32_t cmd)
14941504 buffer.setDataSize (0 );
14951505
14961506 constexpr uint32_t kForwardReplyFlags = TF_CLEAR_BUF;
1497- sendReply (reply, (tr.flags & kForwardReplyFlags ));
1507+
1508+ // TODO: we may want to abort if there is an error here, or return as 'error'
1509+ // from this function, but the impact needs to be measured
1510+ status_t error2 = sendReply (reply, (tr.flags & kForwardReplyFlags ));
1511+ if (error2 != OK) {
1512+ ALOGE (" error in sendReply for synchronous call: %s" ,
1513+ statusToString (error2).c_str ());
1514+ }
14981515 } else {
14991516 if (error != OK) {
15001517 std::ostringstream logStream;
0 commit comments