1 /* 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 21 #include <binder/Parcel.h> 22 #include <binder/Parcelable.h> 23 #include <system/audio.h> 24 #include <utils/String16.h> 25 26 namespace android { 27 28 class AudioClient : public Parcelable { 29 public: AudioClient()30 AudioClient() : 31 clientUid(-1), clientPid(-1), clientTid(-1), packageName("") {} 32 33 uid_t clientUid; 34 pid_t clientPid; 35 pid_t clientTid; 36 String16 packageName; 37 readFromParcel(const Parcel * parcel)38 status_t readFromParcel(const Parcel *parcel) override { 39 clientUid = parcel->readInt32(); 40 clientPid = parcel->readInt32(); 41 clientTid = parcel->readInt32(); 42 packageName = parcel->readString16(); 43 return NO_ERROR; 44 } 45 writeToParcel(Parcel * parcel)46 status_t writeToParcel(Parcel *parcel) const override { 47 parcel->writeInt32(clientUid); 48 parcel->writeInt32(clientPid); 49 parcel->writeInt32(clientTid); 50 parcel->writeString16(packageName); 51 return NO_ERROR; 52 } 53 }; 54 55 }; // namespace android 56 57 #endif // ANDROID_AUDIO_CLIENT_H 58