Loading services/core/jni/Android.bp +3 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,7 @@ cc_defaults { "libaudioclient", "libbase", "libappfuse", "libbinder_ndk", "libbinder", "libcutils", "libcrypto", Loading @@ -110,6 +111,7 @@ cc_defaults { "libhardware", "libhardware_legacy", "libhidlbase", "libmemtrackproxy", "libmtp", "libnativehelper", "libprocessgroup", Loading Loading @@ -154,6 +156,7 @@ cc_defaults { "android.hardware.input.classifier@1.0", "android.hardware.ir@1.0", "android.hardware.light@2.0", "android.hardware.memtrack-V1-ndk_platform", "android.hardware.power@1.0", "android.hardware.power@1.1", "android.hardware.power-V1-cpp", Loading services/core/jni/com_android_server_SystemServer.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -23,11 +23,14 @@ #include <jni.h> #include <nativehelper/JNIHelp.h> #include <android/binder_manager.h> #include <android/binder_stability.h> #include <android/hidl/manager/1.2/IServiceManager.h> #include <binder/IServiceManager.h> #include <hidl/HidlTransportSupport.h> #include <incremental_service.h> #include <memtrackproxy/MemtrackProxy.h> #include <schedulerservice/SchedulingPolicyService.h> #include <sensorservice/SensorService.h> #include <sensorservicehidl/SensorManager.h> Loading Loading @@ -57,6 +60,21 @@ static void android_server_SystemServer_startSensorService(JNIEnv* /* env */, jo } static void android_server_SystemServer_startMemtrackProxyService(JNIEnv* env, jobject /* clazz */) { using aidl::android::hardware::memtrack::MemtrackProxy; const char* memtrackProxyService = "memtrack.proxy"; std::shared_ptr<MemtrackProxy> memtrack_proxy = ndk::SharedRefBase::make<MemtrackProxy>(); auto binder = memtrack_proxy->asBinder(); AIBinder_forceDowngradeToLocalStability(binder.get()); const binder_exception_t err = AServiceManager_addService(binder.get(), memtrackProxyService); LOG_ALWAYS_FATAL_IF(err != EX_NONE, "Cannot register %s: %d", memtrackProxyService, err); } static void android_server_SystemServer_startHidlServices(JNIEnv* env, jobject /* clazz */) { using ::android::frameworks::schedulerservice::V1_0::ISchedulingPolicyService; using ::android::frameworks::schedulerservice::V1_0::implementation::SchedulingPolicyService; Loading Loading @@ -121,6 +139,8 @@ static void android_server_SystemServer_setIncrementalServiceSystemReady(JNIEnv* static const JNINativeMethod gMethods[] = { /* name, signature, funcPtr */ {"startSensorService", "()V", (void*)android_server_SystemServer_startSensorService}, {"startMemtrackProxyService", "()V", (void*)android_server_SystemServer_startMemtrackProxyService}, {"startHidlServices", "()V", (void*)android_server_SystemServer_startHidlServices}, {"initZygoteChildHeapProfiling", "()V", (void*)android_server_SystemServer_initZygoteChildHeapProfiling}, Loading services/java/com/android/server/SystemServer.java +11 −0 Original line number Diff line number Diff line Loading @@ -392,6 +392,11 @@ public final class SystemServer { */ private static native void startSensorService(); /** * Start the memtrack proxy service. */ private static native void startMemtrackProxyService(); /** * Start all HIDL services that are run inside the system server. This may take some time. */ Loading Loading @@ -830,6 +835,12 @@ public final class SystemServer { mSystemServiceManager.startService(UriGrantsManagerService.Lifecycle.class); t.traceEnd(); // Start MemtrackProxyService before ActivityManager, so that early calls // to Memtrack::getMemory() don't fail. t.traceBegin("MemtrackProxyService"); startMemtrackProxyService(); t.traceEnd(); // Activity manager runs the show. t.traceBegin("StartActivityManager"); // TODO: Might need to move after migration to WM. Loading Loading
services/core/jni/Android.bp +3 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,7 @@ cc_defaults { "libaudioclient", "libbase", "libappfuse", "libbinder_ndk", "libbinder", "libcutils", "libcrypto", Loading @@ -110,6 +111,7 @@ cc_defaults { "libhardware", "libhardware_legacy", "libhidlbase", "libmemtrackproxy", "libmtp", "libnativehelper", "libprocessgroup", Loading Loading @@ -154,6 +156,7 @@ cc_defaults { "android.hardware.input.classifier@1.0", "android.hardware.ir@1.0", "android.hardware.light@2.0", "android.hardware.memtrack-V1-ndk_platform", "android.hardware.power@1.0", "android.hardware.power@1.1", "android.hardware.power-V1-cpp", Loading
services/core/jni/com_android_server_SystemServer.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -23,11 +23,14 @@ #include <jni.h> #include <nativehelper/JNIHelp.h> #include <android/binder_manager.h> #include <android/binder_stability.h> #include <android/hidl/manager/1.2/IServiceManager.h> #include <binder/IServiceManager.h> #include <hidl/HidlTransportSupport.h> #include <incremental_service.h> #include <memtrackproxy/MemtrackProxy.h> #include <schedulerservice/SchedulingPolicyService.h> #include <sensorservice/SensorService.h> #include <sensorservicehidl/SensorManager.h> Loading Loading @@ -57,6 +60,21 @@ static void android_server_SystemServer_startSensorService(JNIEnv* /* env */, jo } static void android_server_SystemServer_startMemtrackProxyService(JNIEnv* env, jobject /* clazz */) { using aidl::android::hardware::memtrack::MemtrackProxy; const char* memtrackProxyService = "memtrack.proxy"; std::shared_ptr<MemtrackProxy> memtrack_proxy = ndk::SharedRefBase::make<MemtrackProxy>(); auto binder = memtrack_proxy->asBinder(); AIBinder_forceDowngradeToLocalStability(binder.get()); const binder_exception_t err = AServiceManager_addService(binder.get(), memtrackProxyService); LOG_ALWAYS_FATAL_IF(err != EX_NONE, "Cannot register %s: %d", memtrackProxyService, err); } static void android_server_SystemServer_startHidlServices(JNIEnv* env, jobject /* clazz */) { using ::android::frameworks::schedulerservice::V1_0::ISchedulingPolicyService; using ::android::frameworks::schedulerservice::V1_0::implementation::SchedulingPolicyService; Loading Loading @@ -121,6 +139,8 @@ static void android_server_SystemServer_setIncrementalServiceSystemReady(JNIEnv* static const JNINativeMethod gMethods[] = { /* name, signature, funcPtr */ {"startSensorService", "()V", (void*)android_server_SystemServer_startSensorService}, {"startMemtrackProxyService", "()V", (void*)android_server_SystemServer_startMemtrackProxyService}, {"startHidlServices", "()V", (void*)android_server_SystemServer_startHidlServices}, {"initZygoteChildHeapProfiling", "()V", (void*)android_server_SystemServer_initZygoteChildHeapProfiling}, Loading
services/java/com/android/server/SystemServer.java +11 −0 Original line number Diff line number Diff line Loading @@ -392,6 +392,11 @@ public final class SystemServer { */ private static native void startSensorService(); /** * Start the memtrack proxy service. */ private static native void startMemtrackProxyService(); /** * Start all HIDL services that are run inside the system server. This may take some time. */ Loading Loading @@ -830,6 +835,12 @@ public final class SystemServer { mSystemServiceManager.startService(UriGrantsManagerService.Lifecycle.class); t.traceEnd(); // Start MemtrackProxyService before ActivityManager, so that early calls // to Memtrack::getMemory() don't fail. t.traceBegin("MemtrackProxyService"); startMemtrackProxyService(); t.traceEnd(); // Activity manager runs the show. t.traceBegin("StartActivityManager"); // TODO: Might need to move after migration to WM. Loading