Android - Outgoing transactions from this process must be FLAG_ONEWAY

zdenda.online picture zdenda.online · Oct 17, 2018 · Viewed 8.5k times · Source

I'm facing two issues when running my Android application on Moto G6 device (on another devices or emulator there is no such problem). In my app, there is a simple LoginActivity that after successful login starts MainActivity (in onPostExecute of AsyncTask):

val intent = Intent(this@LoginActivity, MainActivity::class.java)
startActivity(intent)

However on Moto G6 (not happening on Sony Xperia), there is an error that transaction should be ONEWAY:

10-17 07:50:45.058 1878-2153/? W/Binder: Outgoing transactions from this process must be FLAG_ONEWAY
java.lang.Throwable
    at android.os.BinderProxy.transact(Binder.java:736)
    at android.app.assist.AssistStructure$ParcelTransferReader.fetchData(AssistStructure.java:407)
    at android.app.assist.AssistStructure$ParcelTransferReader.go(AssistStructure.java:343)
    at android.app.assist.AssistStructure.ensureData(AssistStructure.java:2110)
    at com.android.server.autofill.Session$1.send(Session.java:200)
    at com.android.server.am.ActivityManagerService.reportAssistContextExtras(ActivityManagerService.java:13475)
    at android.app.IActivityManager$Stub.onTransact(IActivityManager.java:2467)
    at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:3082)
    at android.os.Binder.execTransact(Binder.java:674)

Any suggestion or help appreciated, thank you.

Answer

minsk picture minsk · Dec 21, 2020

For functional purposes, this is just a warning that inter-process (via binder) call is blocking, AOSP source for this warning.

By default, inter-process calls are blocking but when it is marked oneway (via AIDL), it's executed as fire & forget (non-blocking). It is important for system processes to use non-blocking calls when calling into other (potentially unknown user code) to avoid stalling the whole system. So this warning is meant to flag dangerous calls like this: see android developer AIDL documentation regarding oneway.

In this example, there is a call into ActivityManagerService reportAssistContextExtras (AM runs in primary system process), which in turn invokes another IPC (inter-process) call AssistStructure$ParcelTransferReader.fetchData, and the latter is not marked oneway (which triggers this warning).

on Moto G6 (not happening on Sony Xperia)

They might have different implementation/android versions or different call sequence (so it's not invoked)..

Bottom line, it's android implementation oversight; might be already resolved for this particular case, see latest source of activity manager .

If doesn't create functional problems, ignore the warning if it's not relevant to your code. If such call (fetchData in this example) resolves to your code, ensure not to block (return quickly).

However, it might lead to system watchdog kill, search for other logs to understand the consequences, like:

W Watchdog: *** WATCHDOG KILLING SYSTEM PROCESS: Blocked in handler on main thread (main)
W Watchdog: main annotated stack trace:
W Watchdog:     at android.os.BinderProxy.transactNative(Native Method)

Ultimately, it might need to be filed with Google if it's not your code..