Add hidden Binder.getCallingUidOrWtf
Binder.getCallingUidOrThrow throws if the caller is NOT: 1) Called from within a binder transaction OR 2) Called from within a Binder.clearCallingIdentity/restoreCallingIdentity block Number 2 was added in I162db933f9e52cd6f9f46796bda11ad6216d3d66 to allow us to migrate from Binder.getCallingUid to it. There are many use cases where callers are not in a Binder transaction, but have set the calling UID "explicitly" by calling clearCallingIdentity. In order to further ease the migration from Binder.getCallingUid to Binder.getCallingUidOrThrow, this hidden API behaves similarly, but logs at WTF level instead of throwing IllegalStateException. The motivation is to first migrate to the WTF version, so that system_server will log and continue. The goal is to only use this in the system (hence @hide). It will provide early signals as to the feasibility of a given migration. For example, its desirable to migrate the permission checking in code generated by the @EnforcePermission annotation (via the AIDL compiler). This call site is widely used, and itself subject to mass migrations to @EnforcePermission instead of manual permission enforcement. Bug: 252975769 Test: TH Change-Id: I11ea3fdf889689d76211506e81420e694238ee68
Loading
Please register or sign in to comment