Revert "Use libaoc to provide consistent timestamp calculations" am: 33552445b8

Original change: https://googleplex-android-review.googlesource.com/c/device/google/gs-common/+/18817091

Change-Id: I6804f84f5155da711012620a4a7f2ff223eec11b
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/powerstats/Android.bp b/powerstats/Android.bp
index 2dbf8db..74935c7 100644
--- a/powerstats/Android.bp
+++ b/powerstats/Android.bp
@@ -20,6 +20,5 @@
 
     shared_libs: [
         "android.hardware.power.stats-impl.pixel",
-        "libaoc",
     ],
 }
diff --git a/powerstats/AocStateResidencyDataProvider.cpp b/powerstats/AocStateResidencyDataProvider.cpp
index 6ab54db..c64496d 100644
--- a/powerstats/AocStateResidencyDataProvider.cpp
+++ b/powerstats/AocStateResidencyDataProvider.cpp
@@ -18,8 +18,6 @@
 
 #include <android-base/logging.h>
 
-#include <aoc.h>
-
 namespace aidl {
 namespace android {
 namespace hardware {
@@ -28,8 +26,11 @@
 
 AocStateResidencyDataProvider::AocStateResidencyDataProvider(std::vector<std::pair<std::string,
         std::string>> ids, std::vector<std::pair<std::string, std::string>> states) {
-    // AoC stats are reported in ticks
-    std::function<uint64_t(uint64_t)> aocTickToMs = [](uint64_t a) { return aoc_ticks_to_nanoseconds(a) / 1000000; };
+    // AoC stats are reported in ticks of 244.140625ns. The transform
+    // function converts ticks to milliseconds.
+    // 1000000 / 244.140625 = 4096.
+    static const uint64_t AOC_CLK = 4096;
+    std::function<uint64_t(uint64_t)> aocTickToMs = [](uint64_t a) { return a / AOC_CLK; };
     GenericStateResidencyDataProvider::StateResidencyConfig config = {
             .entryCountSupported = true,
             .entryCountPrefix = "Counter:",