1 /*
2  * Copyright (C) 2024 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 package com.android.wallpaper.testing
18 
19 import com.android.wallpaper.model.Category
20 import com.android.wallpaper.model.ImageCategory
21 import com.android.wallpaper.picker.category.client.DefaultWallpaperCategoryClient
22 import javax.inject.Inject
23 import javax.inject.Singleton
24 
25 @Singleton
26 class FakeDefaultWallpaperCategoryClient @Inject constructor() : DefaultWallpaperCategoryClient {
27 
28     private var fakeSystemCategories: List<Category> = emptyList()
29     private var fakeOnDeviceCategory: Category? = null
30     private var fakeThirdPartyAppCategories: List<Category> = emptyList()
31     private var fakeThirdPartyLiveWallpaperCategories: List<Category> = emptyList()
32 
setOnDeviceCategorynull33     fun setOnDeviceCategory(category: Category?) {
34         fakeOnDeviceCategory = category
35     }
36 
setThirdPartyLiveWallpaperCategoriesnull37     fun setThirdPartyLiveWallpaperCategories(categories: List<Category>) {
38         fakeThirdPartyLiveWallpaperCategories = categories
39     }
40 
setSystemCategoriesnull41     fun setSystemCategories(categories: List<Category>) {
42         fakeSystemCategories = categories
43     }
44 
setThirdPartyAppCategoriesnull45     fun setThirdPartyAppCategories(categories: List<Category>) {
46         fakeThirdPartyAppCategories = categories
47     }
48 
getMyPhotosCategorynull49     override suspend fun getMyPhotosCategory(): Category {
50         return ImageCategory(
51             "Fake My Photos",
52             "fake_my_photos_id",
53             1,
54             0, // Placeholder resource ID
55         )
56     }
57 
getSystemCategoriesnull58     override suspend fun getSystemCategories(): List<Category> {
59         return fakeSystemCategories
60     }
61 
getOnDeviceCategorynull62     override suspend fun getOnDeviceCategory(): Category? {
63         return fakeOnDeviceCategory
64     }
65 
getThirdPartyCategorynull66     override suspend fun getThirdPartyCategory(excludedPackageNames: List<String>): List<Category> {
67         return fakeThirdPartyAppCategories
68     }
69 
getExcludedThirdPartyPackageNamesnull70     override fun getExcludedThirdPartyPackageNames(): List<String> {
71         return emptyList()
72     }
73 
getThirdPartyLiveWallpaperCategorynull74     override suspend fun getThirdPartyLiveWallpaperCategory(
75         excludedPackageNames: Set<String>
76     ): List<Category> {
77         return fakeThirdPartyLiveWallpaperCategories
78     }
79 
getExcludedLiveWallpaperPackageNamesnull80     override fun getExcludedLiveWallpaperPackageNames(): Set<String> {
81         return emptySet()
82     }
83 }
84