Inspectopedia Help

Incorrect usage of getCallingUid() or getCallingPid()

Incorrect usage of getCallingUid() or getCallingPid()

Binder.getCallingUid() and Binder.getCallingPid() will return information about the current process if called inside a thread that is not handling a binder transaction. This can cause security issues. If you still want to use your own uid/pid, use Process.myUid() or Process.myPid().

Issue id: BinderGetCallingInMainThread

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for Android 2023.3, Qodana for JVM 2023.3

Plugin:

Android, 2022.3.1 Beta 2

Last modified: 13 July 2023