1 /*
2  * Copyright 2015 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 #ifndef ANDROID_IRESOURCEMANAGERSERVICE_H
18 #define ANDROID_IRESOURCEMANAGERSERVICE_H
19 
20 #include <utils/Errors.h>  // for status_t
21 #include <utils/KeyedVector.h>
22 #include <utils/RefBase.h>
23 #include <utils/String8.h>
24 #include <binder/IInterface.h>
25 #include <binder/Parcel.h>
26 
27 #include <media/IResourceManagerClient.h>
28 #include <media/MediaResource.h>
29 #include <media/MediaResourcePolicy.h>
30 
31 namespace android {
32 
33 class IResourceManagerService: public IInterface
34 {
35 public:
36     DECLARE_META_INTERFACE(ResourceManagerService);
37 
38     virtual void config(const Vector<MediaResourcePolicy> &policies) = 0;
39 
40     virtual void addResource(
41             int pid,
42             int uid,
43             int64_t clientId,
44             const sp<IResourceManagerClient> client,
45             const Vector<MediaResource> &resources) = 0;
46 
47     virtual void removeResource(int pid, int64_t clientId,
48             const Vector<MediaResource> &resources) = 0;
49 
50     virtual void removeClient(int pid, int64_t clientId) = 0;
51 
52     virtual bool reclaimResource(
53             int callingPid,
54             const Vector<MediaResource> &resources) = 0;
55 };
56 
57 // ----------------------------------------------------------------------------
58 
59 class BnResourceManagerService: public BnInterface<IResourceManagerService>
60 {
61 public:
62     virtual status_t onTransact(uint32_t code,
63                                 const Parcel &data,
64                                 Parcel *reply,
65                                 uint32_t flags = 0);
66 };
67 
68 }; // namespace android
69 
70 #endif // ANDROID_IRESOURCEMANAGERSERVICE_H
71