Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3b18d752 authored by Vova Sharaienko's avatar Vova Sharaienko Committed by Android (Google) Code Review
Browse files

Merge "Stats: updated the order of service registration" into sc-dev

parents 90450ec7 e785c01e
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ static void startStatsAidlService() {
    const std::string instance = std::string() + IStats::descriptor + "/default";
    const binder_exception_t err =
            AServiceManager_addService(statsService->asBinder().get(), instance.c_str());
    LOG_ALWAYS_FATAL_IF(err != EX_NONE, "Cannot register %s: %d", instance.c_str(), err);
    LOG_ALWAYS_FATAL_IF(err != EX_NONE, "Cannot register AIDL %s: %d", instance.c_str(), err);
}

static void startStatsHidlService() {
@@ -69,13 +69,18 @@ static void startStatsHidlService() {

    android::sp<IStats> statsHal = new StatsHal();
    const android::status_t err = statsHal->registerAsService();
    LOG_ALWAYS_FATAL_IF(err != android::OK, "Cannot register %s: %d", IStats::descriptor, err);
    LOG_ALWAYS_FATAL_IF(err != android::OK, "Cannot register HIDL %s: %d", IStats::descriptor, err);
}

} // namespace

namespace android {

static void android_server_SystemServer_startIStatsService(JNIEnv* /* env */, jobject /* clazz */) {
    startStatsHidlService();
    startStatsAidlService();
}

static void android_server_SystemServer_startSensorService(JNIEnv* /* env */, jobject /* clazz */) {
    char propBuf[PROPERTY_VALUE_MAX];
    property_get("system_init.startsensorservice", propBuf, "1");
@@ -129,9 +134,6 @@ static void android_server_SystemServer_startHidlServices(JNIEnv* env, jobject /
    } else {
        ALOGW("%s is deprecated. Skipping registration.", ISchedulingPolicyService::descriptor);
    }

    startStatsAidlService();
    startStatsHidlService();
}

static void android_server_SystemServer_initZygoteChildHeapProfiling(JNIEnv* /* env */,
@@ -160,6 +162,7 @@ static void android_server_SystemServer_setIncrementalServiceSystemReady(JNIEnv*
 */
static const JNINativeMethod gMethods[] = {
        /* name, signature, funcPtr */
        {"startIStatsService", "()V", (void*)android_server_SystemServer_startIStatsService},
        {"startSensorService", "()V", (void*)android_server_SystemServer_startSensorService},
        {"startMemtrackProxyService", "()V",
         (void*)android_server_SystemServer_startMemtrackProxyService},
+8 −4
Original line number Diff line number Diff line
@@ -442,15 +442,15 @@ public final class SystemServer implements Dumpable {

    private final SystemServerDumper mDumper = new SystemServerDumper();


    /**
     * The pending WTF to be logged into dropbox.
     */
    private static LinkedList<Pair<String, ApplicationErrorReport.CrashInfo>> sPendingWtfs;

    /**
     * Start the sensor service. This is a blocking call and can take time.
     */
    /** Start the IStats services. This is a blocking call and can take time. */
    private static native void startIStatsService();

    /** Start the sensor service. This is a blocking call and can take time. */
    private static native void startSensorService();

    /**
@@ -1029,6 +1029,10 @@ public final class SystemServer implements Dumpable {
        mSystemServiceManager.startService(PowerStatsService.class);
        t.traceEnd();

        t.traceBegin("StartIStatsService");
        startIStatsService();
        t.traceEnd();

        // Start MemtrackProxyService before ActivityManager, so that early calls
        // to Memtrack::getMemory() don't fail.
        t.traceBegin("MemtrackProxyService");