Moving the name getter of latency action to LatencyTracker

Test: compiling
Bug: 131859447
Change-Id: I150e50d1ec33260ba8de9c71a11938850b74ecc0
This commit is contained in:
vadimt
2020-11-12 13:41:52 -08:00
parent b8608e3693
commit 660729d4da

View File

@@ -139,6 +139,38 @@ public class LatencyTracker {
BackgroundThread.getHandler().post(this::readSettings);
}
/**
* A helper method to translate action type to name.
*
* @param action the action type defined in AtomsProto.java
* @return the name of the action
*/
public static String getNameOfAction(int action) {
// Defined in AtomsProto.java
switch (action) {
case 0:
return "UNKNOWN";
case 1:
return "ACTION_EXPAND_PANEL";
case 2:
return "ACTION_TOGGLE_RECENTS";
case 3:
return "ACTION_FINGERPRINT_WAKE_AND_UNLOCK";
case 4:
return "ACTION_CHECK_CREDENTIAL";
case 5:
return "ACTION_CHECK_CREDENTIAL_UNLOCKED";
case 6:
return "ACTION_TURN_ON_SCREEN";
case 7:
return "ACTION_ROTATE_SCREEN";
case 8:
return "ACTION_FACE_WAKE_AND_UNLOCK";
default:
throw new IllegalArgumentException("Invalid action");
}
}
private void registerSettingsObserver() {
Uri settingsUri = Settings.Global.getUriFor(Settings.Global.LATENCY_TRACKER);
mContext.getContentResolver().registerContentObserver(