Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e9eae39b authored by Pablo Gamito's avatar Pablo Gamito
Browse files

Update docs

We now support Kotlin code in ProtoLog although not processed.

Flag: DOCS_ONLY
Test: n/a
Change-Id: I5457550f468c277382a1b876dd162b0f6fdaa8ad
parent 72cf68b6
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -27,10 +27,13 @@ building to check the log state (is enabled) before printing the print format st
  traces in Winscope)

### Kotlin
Kotlin protologging is supported but not as optimized as in Java.

Protolog tool does not yet have support for Kotlin code (see [b/168581922](https://b.corp.google.com/issues/168581922)).
For logging in Kotlin, use the [KtProtoLog](/libs/WindowManager/Shell/src/com/android/wm/shell/util/KtProtoLog.kt)
class which has a similar API to the Java ProtoLog class.
The Protolog tool does not yet have support for Kotlin code ([b/168581922](https://b.corp.google.com/issues/168581922)).

What this implies is that ProtoLogs are not pre-processed to extract the static strings out when used in Kotlin. So,
there is no memory gain when using ProtoLogging in Kotlin. The logs will still be traced to Perfetto, but with a subtly
worse performance due to the additional string interning that needs to be done at run time instead of at build time.

### Enabling ProtoLog command line logging
Run these commands to enable protologs (in logcat) for WM Core ([list of all core tags](/core/java/com/android/internal/protolog/ProtoLogGroup.java)):