GpuService.cpp revision fc038bd8fc77998a436d43027919f4500c4291e6
1/*
2 * Copyright 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
17#include "GpuService.h"
18
19#include <binder/Parcel.h>
20
21namespace android {
22
23// ----------------------------------------------------------------------------
24
25class BpGpuService : public BpInterface<IGpuService>
26{
27public:
28    BpGpuService(const sp<IBinder>& impl) : BpInterface<IGpuService>(impl) {}
29};
30
31IMPLEMENT_META_INTERFACE(GpuService, "android.ui.IGpuService");
32
33status_t BnGpuService::onTransact(uint32_t code, const Parcel& data,
34        Parcel* reply, uint32_t flags)
35{
36    switch (code) {
37    case SHELL_COMMAND_TRANSACTION: {
38        int in = data.readFileDescriptor();
39        int out = data.readFileDescriptor();
40        int err = data.readFileDescriptor();
41        int argc = data.readInt32();
42        Vector<String16> args;
43        for (int i = 0; i < argc && data.dataAvail() > 0; i++) {
44           args.add(data.readString16());
45        }
46        return shellCommand(in, out, err, args);
47    }
48
49    default:
50        return BBinder::onTransact(code, data, reply, flags);
51    }
52}
53
54// ----------------------------------------------------------------------------
55
56const char* const GpuService::SERVICE_NAME = "gpu";
57
58GpuService::GpuService() {}
59
60status_t GpuService::shellCommand(int /*in*/, int /*out*/, int /*err*/,
61        Vector<String16>& /*args*/)
62{
63    ALOGD("GpuService::shellCommand");
64    return NO_ERROR;
65}
66
67} // namespace android
68