blob: 3b439e17e7e5c3fa1ae79051952b1e33c0805374 [file] [log] [blame]
Vitalii Tomkiv901c0242016-08-19 13:13:16 -07001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package com.android.car.monitoring;
17
18import android.annotation.SystemApi;
19import android.content.Context;
20import android.util.Log;
21
22import com.android.car.CarLog;
23import com.android.car.CarServiceBase;
24import com.android.car.SystemActivityMonitoringService;
25
26import java.io.PrintWriter;
27
28/**
29 * Service that monitors applications resource usage.
30 * @hide
31 */
32@SystemApi
33public class CarMonitoringService implements CarServiceBase {
34 private static final String TAG = CarLog.TAG_MONITORING;
35 private static final Boolean DBG = true;
36
37 private static final int MONITORING_SLEEP_TIME_MS = 30000; // Run monitoring every 30s.
38
39 private final Context mContext;
40
41 private final SystemActivityMonitoringService mSystemActivityMonitoringService;
42
43 public CarMonitoringService(Context context,
44 SystemActivityMonitoringService systemActivityMonitoringService) {
45 mContext = context;
46 mSystemActivityMonitoringService = systemActivityMonitoringService;
47 }
48
49 @Override
50 public void init() {
51 if (DBG) {
52 Log.d(TAG, "init");
53 }
54 // TODO: add periodic update to setAppPriority to monitoring native service.
55 }
56
57 @Override
58 public void release() {
59 if (DBG) {
60 Log.d(TAG, "release");
61 }
62 }
63
64 @Override
65 public void dump(PrintWriter writer) {
66 writer.println("**" + getClass().getSimpleName() + "**");
67 // TODO
68 }
69}