1 /*
2 **
3 ** Copyright 2023, The Android Open Source Project
4 **
5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at
8 **
9 **     http://www.apache.org/licenses/LICENSE-2.0
10 **
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
16 */
17 
18 #ifndef ANDROID_MEDIA_IRECLAIMPOLICY_H_
19 #define ANDROID_MEDIA_IRECLAIMPOLICY_H_
20 
21 #include <memory>
22 #include <aidl/android/media/IResourceManagerClient.h>
23 
24 namespace android {
25 
26 struct ClientInfo;
27 struct ReclaimRequestInfo;
28 
29 /*
30  * Interface that defines Reclaim Policy.
31  *
32  * This provides an interface to select/identify a client based on a specific
33  * Reclaim policy.
34  */
35 class IReclaimPolicy {
36 public:
IReclaimPolicy()37     IReclaimPolicy() {}
38 
~IReclaimPolicy()39     virtual ~IReclaimPolicy() {}
40 
41     /*
42      * Based on the Reclaim policy, identify and return a client from the list
43      * of given clients that satisfy the resource requested.
44      *
45      * @param[in]  reclaimRequestInfo Information about the resource request
46      * @param[in]  client List of clients to select from.
47      * @param[out] targetClients Upon success, this will have the list of identified client(s).
48      *
49      * @return true on success, false otherwise
50      */
51     virtual bool getClients(const ReclaimRequestInfo& reclaimRequestInfo,
52                             const std::vector<ClientInfo>& clients,
53                             std::vector<ClientInfo>& targetClients) = 0;
54 };
55 
56 } // namespace android
57 
58 #endif  // ANDROID_MEDIA_IRECLAIMPOLICY_H_
59