cpp_client_telemetry icon indicating copy to clipboard operation
cpp_client_telemetry copied to clipboard

Add nativeSetIntTicketToken JNI implementation in android_build

Open TedaLIEz opened this issue 1 year ago • 2 comments

nativeSetIntTicketToken in LogManagerProvider.java is incomplete in the last PR: #1131

This PR aims:

  1. Implementation of nativeSetIntTicketToken in JNI, which turns out to be the setTicketToken in ILogManager.java
  2. Thread-safe in AuthTokensController.cpp to avoid race condition, we found some crashes because of race condition when using this sdk in Android system: Scudo ERROR: race on chunk header

Why adding locks in AuthTokensController.cpp?

We get the token after the app log in one account (MSA, AAD, etc), and our application is a multi-account application. So currently our solution is we cache the token once we get from the server, then every time client calls the logEvent method, it will set the ticket token internally. We don't have the dependencies on logger instanceswhen we in the process of getting token.

We can't guarantee all the logEvent method will be called only in main thread only, so this introduces the multi-threading issues.

TedaLIEz avatar Oct 11 '23 07:10 TedaLIEz