Loading services/core/java/com/android/server/stats/pull/StatsPullAtomService.java +3 −1 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * Copyright 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. Loading Loading @@ -432,6 +432,7 @@ public class StatsPullAtomService extends SystemService { mContext = context; } private native void initializeNativePullers(); /** * Use of this StatsPullAtomCallbackImpl means we avoid one class per tagId, which we would * get if we used lambdas. Loading Loading @@ -713,6 +714,7 @@ public class StatsPullAtomService extends SystemService { super.onBootPhase(phase); if (phase == PHASE_SYSTEM_SERVICES_READY) { BackgroundThread.getHandler().post(() -> { initializeNativePullers(); // Initialize pullers that need JNI. initializePullersState(); registerPullers(); registerEventListeners(); Loading services/core/jni/Android.bp +3 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ cc_library_static { "gnss/GnssMeasurement.cpp", "gnss/GnssMeasurementCallback.cpp", "gnss/Utils.cpp", "stats/SurfaceFlingerPuller.cpp", "com_android_server_adb_AdbDebuggingManager.cpp", "com_android_server_am_BatteryStatsService.cpp", "com_android_server_biometrics_SurfaceToNativeHandleConverter.cpp", Loading @@ -53,6 +54,7 @@ cc_library_static { "com_android_server_SerialService.cpp", "com_android_server_soundtrigger_middleware_AudioSessionProviderImpl.cpp", "com_android_server_soundtrigger_middleware_ExternalCaptureStateTracker.cpp", "com_android_server_stats_pull_StatsPullAtomService.cpp", "com_android_server_storage_AppFuseBridge.cpp", "com_android_server_SystemServer.cpp", "com_android_server_tv_TvUinputBridge.cpp", Loading Loading @@ -127,6 +129,7 @@ cc_defaults { "libsensorservice", "libsensorservicehidl", "libgui", "libtimestats_atoms_proto", "libusbhost", "libtinyalsa", "libEGL", Loading services/core/jni/com_android_server_stats_pull_StatsPullAtomService.cpp 0 → 100644 +61 −0 Original line number Diff line number Diff line /* * Copyright 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/SurfaceFlingerPuller.h" namespace android { static server::stats::SurfaceFlingerPuller gSurfaceFlingerPuller; static AStatsManager_PullAtomCallbackReturn onSurfaceFlingerPullCallback(int32_t atom_tag, AStatsEventList* data, void* cookie) { return gSurfaceFlingerPuller.pull(atom_tag, data); } static void initializeNativePullers(JNIEnv* env, jobject javaObject) { // Surface flinger layer & global info. gSurfaceFlingerPuller = server::stats::SurfaceFlingerPuller(); AStatsManager_setPullAtomCallback(android::util::SURFACEFLINGER_STATS_GLOBAL_INFO, /* metadata= */ nullptr, onSurfaceFlingerPullCallback, /* cookie= */ nullptr); AStatsManager_setPullAtomCallback(android::util::SURFACEFLINGER_STATS_LAYER_INFO, /* metadata= */ nullptr, onSurfaceFlingerPullCallback, /* cookie= */ nullptr); } static const JNINativeMethod sMethods[] = { {"initializeNativePullers", "()V", (void*)initializeNativePullers}}; 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 No newline at end of file services/core/jni/onload.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ int register_android_server_com_android_server_pm_PackageManagerShellCommandData int register_android_server_AdbDebuggingManager(JNIEnv* env); int register_android_server_FaceService(JNIEnv* env); int register_android_server_GpuService(JNIEnv* env); int register_android_server_stats_pull_StatsPullAtomService(JNIEnv* env); }; using namespace android; Loading Loading @@ -115,5 +116,6 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void* /* reserved */) register_android_server_AdbDebuggingManager(env); register_android_server_FaceService(env); register_android_server_GpuService(env); register_android_server_stats_pull_StatsPullAtomService(env); return JNI_VERSION_1_4; } services/core/jni/stats/OWNERS 0 → 100644 +8 −0 Original line number Diff line number Diff line jeffreyhuang@google.com jtnguyen@google.com muhammadq@google.com sharaieko@google.com singhtejinder@google.com tsaichristine@google.com yaochen@google.com yro@google.com Loading
services/core/java/com/android/server/stats/pull/StatsPullAtomService.java +3 −1 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * Copyright 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. Loading Loading @@ -432,6 +432,7 @@ public class StatsPullAtomService extends SystemService { mContext = context; } private native void initializeNativePullers(); /** * Use of this StatsPullAtomCallbackImpl means we avoid one class per tagId, which we would * get if we used lambdas. Loading Loading @@ -713,6 +714,7 @@ public class StatsPullAtomService extends SystemService { super.onBootPhase(phase); if (phase == PHASE_SYSTEM_SERVICES_READY) { BackgroundThread.getHandler().post(() -> { initializeNativePullers(); // Initialize pullers that need JNI. initializePullersState(); registerPullers(); registerEventListeners(); Loading
services/core/jni/Android.bp +3 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ cc_library_static { "gnss/GnssMeasurement.cpp", "gnss/GnssMeasurementCallback.cpp", "gnss/Utils.cpp", "stats/SurfaceFlingerPuller.cpp", "com_android_server_adb_AdbDebuggingManager.cpp", "com_android_server_am_BatteryStatsService.cpp", "com_android_server_biometrics_SurfaceToNativeHandleConverter.cpp", Loading @@ -53,6 +54,7 @@ cc_library_static { "com_android_server_SerialService.cpp", "com_android_server_soundtrigger_middleware_AudioSessionProviderImpl.cpp", "com_android_server_soundtrigger_middleware_ExternalCaptureStateTracker.cpp", "com_android_server_stats_pull_StatsPullAtomService.cpp", "com_android_server_storage_AppFuseBridge.cpp", "com_android_server_SystemServer.cpp", "com_android_server_tv_TvUinputBridge.cpp", Loading Loading @@ -127,6 +129,7 @@ cc_defaults { "libsensorservice", "libsensorservicehidl", "libgui", "libtimestats_atoms_proto", "libusbhost", "libtinyalsa", "libEGL", Loading
services/core/jni/com_android_server_stats_pull_StatsPullAtomService.cpp 0 → 100644 +61 −0 Original line number Diff line number Diff line /* * Copyright 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/SurfaceFlingerPuller.h" namespace android { static server::stats::SurfaceFlingerPuller gSurfaceFlingerPuller; static AStatsManager_PullAtomCallbackReturn onSurfaceFlingerPullCallback(int32_t atom_tag, AStatsEventList* data, void* cookie) { return gSurfaceFlingerPuller.pull(atom_tag, data); } static void initializeNativePullers(JNIEnv* env, jobject javaObject) { // Surface flinger layer & global info. gSurfaceFlingerPuller = server::stats::SurfaceFlingerPuller(); AStatsManager_setPullAtomCallback(android::util::SURFACEFLINGER_STATS_GLOBAL_INFO, /* metadata= */ nullptr, onSurfaceFlingerPullCallback, /* cookie= */ nullptr); AStatsManager_setPullAtomCallback(android::util::SURFACEFLINGER_STATS_LAYER_INFO, /* metadata= */ nullptr, onSurfaceFlingerPullCallback, /* cookie= */ nullptr); } static const JNINativeMethod sMethods[] = { {"initializeNativePullers", "()V", (void*)initializeNativePullers}}; 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 No newline at end of file
services/core/jni/onload.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ int register_android_server_com_android_server_pm_PackageManagerShellCommandData int register_android_server_AdbDebuggingManager(JNIEnv* env); int register_android_server_FaceService(JNIEnv* env); int register_android_server_GpuService(JNIEnv* env); int register_android_server_stats_pull_StatsPullAtomService(JNIEnv* env); }; using namespace android; Loading Loading @@ -115,5 +116,6 @@ extern "C" jint JNI_OnLoad(JavaVM* vm, void* /* reserved */) register_android_server_AdbDebuggingManager(env); register_android_server_FaceService(env); register_android_server_GpuService(env); register_android_server_stats_pull_StatsPullAtomService(env); return JNI_VERSION_1_4; }
services/core/jni/stats/OWNERS 0 → 100644 +8 −0 Original line number Diff line number Diff line jeffreyhuang@google.com jtnguyen@google.com muhammadq@google.com sharaieko@google.com singhtejinder@google.com tsaichristine@google.com yaochen@google.com yro@google.com