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

Commit 953ad86c authored by Tej Singh's avatar Tej Singh
Browse files

Create StatsPullAtomService

This creates an empty systeme service for the java pullers that are
curreently in StatsCompanionService to live. StatsPullAtomService will
not live in the statsd apex.

Test: builds, boots
Bug: 141697961
Change-Id: Ifc8ed9903d414ada665875a44254e602decf6495
parent 55447e37
Loading
Loading
Loading
Loading
+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.
 */

package com.android.server.stats;

import android.content.Context;
import android.util.Slog;

import com.android.internal.os.BackgroundThread;
import com.android.server.SystemService;

/**
 * SystemService containing PullAtomCallbacks that are registered with statsd.
 *
 * @hide
 */
public class StatsPullAtomService extends SystemService {
    private static final String TAG = "StatsPullAtomService";
    private static final boolean DEBUG = true;

    public StatsPullAtomService(Context context) {
        super(context);
    }

    @Override
    public void onStart() {
        // No op.
    }

    @Override
    public void onBootPhase(int phase) {
        super.onBootPhase(phase);
        if (phase == PHASE_SYSTEM_SERVICES_READY) {
            BackgroundThread.getHandler().post(() -> {
                registerAllPullers();
            });
        }
    }

    void registerAllPullers() {
        if (DEBUG) {
            Slog.d(TAG, "Registering all pullers with statsd");
        }
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -214,6 +214,8 @@ public final class SystemServer {
            "com.android.server.companion.CompanionDeviceManagerService";
    private static final String STATS_COMPANION_LIFECYCLE_CLASS =
            "com.android.server.stats.StatsCompanion$Lifecycle";
    private static final String STATS_PULL_ATOM_SERVICE_CLASS =
            "com.android.server.stats.StatsPullAtomService";
    private static final String USB_SERVICE_CLASS =
            "com.android.server.usb.UsbService$Lifecycle";
    private static final String MIDI_SERVICE_CLASS =
@@ -1975,6 +1977,11 @@ public final class SystemServer {
        mSystemServiceManager.startService(STATS_COMPANION_LIFECYCLE_CLASS);
        t.traceEnd();

        // Statsd pulled atoms
        t.traceBegin("StartStatsPullAtomService");
        mSystemServiceManager.startService(STATS_PULL_ATOM_SERVICE_CLASS);
        t.traceEnd();

        // Incidentd and dumpstated helper
        t.traceBegin("StartIncidentCompanionService");
        mSystemServiceManager.startService(IncidentCompanionService.class);