mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 21:35:59 +00:00
Session logs: record clocks, thermal status and battery temperature in every session
ClockLogComponent was only created inside startVkBridge(), so it never ran on Adreno. Create it for every session (clocks.log, was vkbridge-clocks.log) and append the battery temperature from ACTION_BATTERY_CHANGED to each sample. Part 1 of #1837.
This commit is contained in:
1 parent
baf7d90df9
commit
5805631be5
3 files changed
+45
-4
No files matched your search
@@ -1,6 +1,9 @@
|
||||
package com.droiddeck.launcher.gpu
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.os.BatteryManager
|
||||
import android.os.Build
|
||||
import android.os.PowerManager
|
||||
import android.util.Log
|
||||
@@ -65,6 +68,7 @@ class ClockLogComponent(private val logFile: File) : SessionPart() {
|
||||
if (!h.isNaN()) line.append(String.format(Locale.US, " headroom %.2f", h))
|
||||
}
|
||||
}
|
||||
batteryTenths()?.let { line.append(String.format(Locale.US, " | battery %.1f C", it / 10.0)) }
|
||||
w.write(line.append('\n').toString())
|
||||
w.flush()
|
||||
try { Thread.sleep(PERIOD_MS) } catch (e: InterruptedException) { break }
|
||||
@@ -75,6 +79,10 @@ class ClockLogComponent(private val logFile: File) : SessionPart() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun batteryTenths(): Int? =
|
||||
app().registerReceiver(null, IntentFilter(Intent.ACTION_BATTERY_CHANGED))
|
||||
?.getIntExtra(BatteryManager.EXTRA_TEMPERATURE, Int.MIN_VALUE)?.takeIf { it != Int.MIN_VALUE }
|
||||
|
||||
companion object {
|
||||
private const val TAG = "SessionService"
|
||||
private const val PERIOD_MS = 2000L
|
||||
|
||||
Reference in new issue
Block a user