Loading cmds/statsd/Android.bp +0 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,6 @@ cc_defaults { "src/config/ConfigManager.cpp", "src/external/GpuStatsPuller.cpp", "src/external/Perfetto.cpp", "src/external/PowerStatsPuller.cpp", "src/external/PullResultReceiver.cpp", "src/external/puller_util.cpp", "src/external/StatsCallbackPuller.cpp", Loading cmds/statsd/src/external/StatsPullerManager.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ #include "../stats_log_util.h" #include "../statscompanion_util.h" #include "GpuStatsPuller.h" #include "PowerStatsPuller.h" #include "StatsCallbackPuller.h" #include "SubsystemSleepStatePuller.h" #include "TrainInfoPuller.h" Loading @@ -58,9 +57,6 @@ StatsPullerManager::StatsPullerManager() // subsystem_sleep_state {{.atomTag = android::util::SUBSYSTEM_SLEEP_STATE}, new SubsystemSleepStatePuller()}, // on_device_power_measurement {{.atomTag = android::util::ON_DEVICE_POWER_MEASUREMENT}, new PowerStatsPuller()}, // TrainInfo. {{.atomTag = android::util::TRAIN_INFO}, new TrainInfoPuller()}, Loading services/core/java/com/android/server/stats/pull/StatsPullAtomService.java +3 −0 Original line number Diff line number Diff line Loading @@ -256,6 +256,8 @@ public class StatsPullAtomService extends SystemService { mContext = context; } private native void nativeInit(); /** * Use of this StatsPullAtomCallbackImpl means we avoid one class per tagId, which we would * get if we used lambdas. Loading Loading @@ -399,6 +401,7 @@ public class StatsPullAtomService extends SystemService { super.onBootPhase(phase); if (phase == PHASE_SYSTEM_SERVICES_READY) { BackgroundThread.getHandler().post(() -> { nativeInit(); initializePullersState(); registerAllPullers(); registerEventListeners(); Loading services/core/jni/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ cc_library_static { "BroadcastRadio/TunerCallback.cpp", "BroadcastRadio/convert.cpp", "BroadcastRadio/regions.cpp", "stats/PowerStatsPuller.cpp", "com_android_server_am_BatteryStatsService.cpp", "com_android_server_connectivity_Vpn.cpp", "com_android_server_ConsumerIrService.cpp", Loading @@ -37,6 +38,7 @@ cc_library_static { "com_android_server_security_VerityUtils.cpp", "com_android_server_SerialService.cpp", "com_android_server_soundtrigger_middleware_AudioSessionProviderImpl.cpp", "com_android_server_stats_pull_StatsPullAtomService.cpp", "com_android_server_storage_AppFuseBridge.cpp", "com_android_server_SystemServer.cpp", "com_android_server_TestNetworkService.cpp", Loading services/core/jni/com_android_server_stats_pull_StatsPullAtomService.cpp 0 → 100644 +58 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "StatsPullAtomService" #include <jni.h> #include <log/log.h> #include <nativehelper/JNIHelp.h> #include <stats_event.h> #include <stats_pull_atom_callback.h> #include <statslog.h> #include "stats/PowerStatsPuller.h" namespace android { static server::stats::PowerStatsPuller gPowerStatsPuller; static status_pull_atom_return_t onDevicePowerMeasurementCallback(int32_t atom_tag, pulled_stats_event_list* data, void* cookie) { return gPowerStatsPuller.Pull(atom_tag, data); } static void nativeInit(JNIEnv* env, jobject javaObject) { // on device power measurement gPowerStatsPuller = server::stats::PowerStatsPuller(); register_stats_pull_atom_callback(android::util::ON_DEVICE_POWER_MEASUREMENT, onDevicePowerMeasurementCallback, /* metadata= */ nullptr, /* cookie= */ nullptr); } static const JNINativeMethod sMethods[] = {{"nativeInit", "()V", (void*)nativeInit}}; int register_android_server_stats_pull_StatsPullAtomService(JNIEnv* env) { int res = jniRegisterNativeMethods(env, "com/android/server/stats/pull/StatsPullAtomService", sMethods, NELEM(sMethods)); if (res < 0) { ALOGE("failed to register native methods"); } return res; } } // namespace android Loading
cmds/statsd/Android.bp +0 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,6 @@ cc_defaults { "src/config/ConfigManager.cpp", "src/external/GpuStatsPuller.cpp", "src/external/Perfetto.cpp", "src/external/PowerStatsPuller.cpp", "src/external/PullResultReceiver.cpp", "src/external/puller_util.cpp", "src/external/StatsCallbackPuller.cpp", Loading
cmds/statsd/src/external/StatsPullerManager.cpp +0 −4 Original line number Diff line number Diff line Loading @@ -33,7 +33,6 @@ #include "../stats_log_util.h" #include "../statscompanion_util.h" #include "GpuStatsPuller.h" #include "PowerStatsPuller.h" #include "StatsCallbackPuller.h" #include "SubsystemSleepStatePuller.h" #include "TrainInfoPuller.h" Loading @@ -58,9 +57,6 @@ StatsPullerManager::StatsPullerManager() // subsystem_sleep_state {{.atomTag = android::util::SUBSYSTEM_SLEEP_STATE}, new SubsystemSleepStatePuller()}, // on_device_power_measurement {{.atomTag = android::util::ON_DEVICE_POWER_MEASUREMENT}, new PowerStatsPuller()}, // TrainInfo. {{.atomTag = android::util::TRAIN_INFO}, new TrainInfoPuller()}, Loading
services/core/java/com/android/server/stats/pull/StatsPullAtomService.java +3 −0 Original line number Diff line number Diff line Loading @@ -256,6 +256,8 @@ public class StatsPullAtomService extends SystemService { mContext = context; } private native void nativeInit(); /** * Use of this StatsPullAtomCallbackImpl means we avoid one class per tagId, which we would * get if we used lambdas. Loading Loading @@ -399,6 +401,7 @@ public class StatsPullAtomService extends SystemService { super.onBootPhase(phase); if (phase == PHASE_SYSTEM_SERVICES_READY) { BackgroundThread.getHandler().post(() -> { nativeInit(); initializePullersState(); registerAllPullers(); registerEventListeners(); Loading
services/core/jni/Android.bp +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ cc_library_static { "BroadcastRadio/TunerCallback.cpp", "BroadcastRadio/convert.cpp", "BroadcastRadio/regions.cpp", "stats/PowerStatsPuller.cpp", "com_android_server_am_BatteryStatsService.cpp", "com_android_server_connectivity_Vpn.cpp", "com_android_server_ConsumerIrService.cpp", Loading @@ -37,6 +38,7 @@ cc_library_static { "com_android_server_security_VerityUtils.cpp", "com_android_server_SerialService.cpp", "com_android_server_soundtrigger_middleware_AudioSessionProviderImpl.cpp", "com_android_server_stats_pull_StatsPullAtomService.cpp", "com_android_server_storage_AppFuseBridge.cpp", "com_android_server_SystemServer.cpp", "com_android_server_TestNetworkService.cpp", Loading
services/core/jni/com_android_server_stats_pull_StatsPullAtomService.cpp 0 → 100644 +58 −0 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #define LOG_TAG "StatsPullAtomService" #include <jni.h> #include <log/log.h> #include <nativehelper/JNIHelp.h> #include <stats_event.h> #include <stats_pull_atom_callback.h> #include <statslog.h> #include "stats/PowerStatsPuller.h" namespace android { static server::stats::PowerStatsPuller gPowerStatsPuller; static status_pull_atom_return_t onDevicePowerMeasurementCallback(int32_t atom_tag, pulled_stats_event_list* data, void* cookie) { return gPowerStatsPuller.Pull(atom_tag, data); } static void nativeInit(JNIEnv* env, jobject javaObject) { // on device power measurement gPowerStatsPuller = server::stats::PowerStatsPuller(); register_stats_pull_atom_callback(android::util::ON_DEVICE_POWER_MEASUREMENT, onDevicePowerMeasurementCallback, /* metadata= */ nullptr, /* cookie= */ nullptr); } static const JNINativeMethod sMethods[] = {{"nativeInit", "()V", (void*)nativeInit}}; int register_android_server_stats_pull_StatsPullAtomService(JNIEnv* env) { int res = jniRegisterNativeMethods(env, "com/android/server/stats/pull/StatsPullAtomService", sMethods, NELEM(sMethods)); if (res < 0) { ALOGE("failed to register native methods"); } return res; } } // namespace android