blob: 6833fe27041824727e9941c59d7a21ea55331be3 [file] [log] [blame]
Ray Essick3938dc62016-11-01 08:56:56 -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 */
16
Ray Essickd38e1742017-01-23 15:17:06 -080017#define LOG_TAG "mediametrics"
Ray Essick3938dc62016-11-01 08:56:56 -070018//#define LOG_NDEBUG 0
Ray Essick3938dc62016-11-01 08:56:56 -070019#include <utils/Log.h>
Ray Essick3938dc62016-11-01 08:56:56 -070020
Ray Essick3938dc62016-11-01 08:56:56 -070021#include "MediaAnalyticsService.h"
22
Andy Hung17dbaf22019-10-11 14:06:31 -070023#include <binder/IPCThreadState.h>
24#include <binder/IServiceManager.h>
25#include <binder/ProcessState.h>
26
Ray Essick3938dc62016-11-01 08:56:56 -070027
28int main(int argc __unused, char **argv __unused)
29{
Andy Hung17dbaf22019-10-11 14:06:31 -070030 using namespace android;
31
Ray Essick3938dc62016-11-01 08:56:56 -070032 signal(SIGPIPE, SIG_IGN);
33
Ray Essickb5fac8e2016-12-12 11:33:56 -080034 // to match the service name
Ray Essickd38e1742017-01-23 15:17:06 -080035 // we're replacing "/system/bin/mediametrics" with "media.metrics"
Ray Essickb5fac8e2016-12-12 11:33:56 -080036 // we add a ".", but discard the path components: we finish with a shorter string
Andy Hung17dbaf22019-10-11 14:06:31 -070037 strcpy(argv[0], MediaAnalyticsService::kServiceName);
Ray Essickb5fac8e2016-12-12 11:33:56 -080038
Andy Hung17dbaf22019-10-11 14:06:31 -070039 defaultServiceManager()->addService(
40 String16(MediaAnalyticsService::kServiceName), new MediaAnalyticsService());
Ray Essick3938dc62016-11-01 08:56:56 -070041
Andy Hung17dbaf22019-10-11 14:06:31 -070042 sp<ProcessState> processState(ProcessState::self());
43 // processState->setThreadPoolMaxThreadCount(8);
44 processState->startThreadPool();
Ray Essick3938dc62016-11-01 08:56:56 -070045 IPCThreadState::self()->joinThreadPool();
Andy Hung17dbaf22019-10-11 14:06:31 -070046
47 return EXIT_SUCCESS;
Ray Essick3938dc62016-11-01 08:56:56 -070048}