blob: 247af9eafad71f08fa761b7b55d09ab0d1f81092 [file] [log] [blame]
Eric Laurenta54f1282017-07-01 19:39:32 -07001/*
2 * Copyright (C) 2017 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
18#ifndef ANDROID_AUDIO_CLIENT_H
19#define ANDROID_AUDIO_CLIENT_H
20
Eric Laurent21da6472017-11-09 16:29:26 -080021#include <binder/Parcel.h>
Eric Laurentf14db3c2017-12-08 14:20:36 -080022#include <binder/Parcelable.h>
Eric Laurenta54f1282017-07-01 19:39:32 -070023#include <system/audio.h>
24#include <utils/String16.h>
25
26namespace android {
27
Eric Laurentf14db3c2017-12-08 14:20:36 -080028class AudioClient : public Parcelable {
Eric Laurenta54f1282017-07-01 19:39:32 -070029 public:
30 AudioClient() :
Eric Laurent21da6472017-11-09 16:29:26 -080031 clientUid(-1), clientPid(-1), clientTid(-1), packageName("") {}
Eric Laurenta54f1282017-07-01 19:39:32 -070032
33 uid_t clientUid;
34 pid_t clientPid;
Eric Laurent21da6472017-11-09 16:29:26 -080035 pid_t clientTid;
Eric Laurenta54f1282017-07-01 19:39:32 -070036 String16 packageName;
Eric Laurent21da6472017-11-09 16:29:26 -080037
Eric Laurentf14db3c2017-12-08 14:20:36 -080038 status_t readFromParcel(const Parcel *parcel) override {
Eric Laurent21da6472017-11-09 16:29:26 -080039 clientUid = parcel->readInt32();
40 clientPid = parcel->readInt32();
41 clientTid = parcel->readInt32();
42 packageName = parcel->readString16();
43 return NO_ERROR;
44 }
45
Eric Laurentf14db3c2017-12-08 14:20:36 -080046 status_t writeToParcel(Parcel *parcel) const override {
Eric Laurent21da6472017-11-09 16:29:26 -080047 parcel->writeInt32(clientUid);
48 parcel->writeInt32(clientPid);
49 parcel->writeInt32(clientTid);
50 parcel->writeString16(packageName);
51 return NO_ERROR;
52 }
Eric Laurenta54f1282017-07-01 19:39:32 -070053};
54
55}; // namespace android
56
57#endif // ANDROID_AUDIO_CLIENT_H