• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2025 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.systemui.wallpapers.data.repository
18 
19 import android.graphics.PointF
20 import android.graphics.RectF
21 import kotlinx.coroutines.flow.MutableStateFlow
22 import kotlinx.coroutines.flow.StateFlow
23 import kotlinx.coroutines.flow.asStateFlow
24 
25 class FakeWallpaperFocalAreaRepository : WallpaperFocalAreaRepository {
26     private val _shortcutAbsoluteTop = MutableStateFlow(0F)
27     override val shortcutAbsoluteTop = _shortcutAbsoluteTop.asStateFlow()
28 
29     private val _notificationStackAbsoluteBottom = MutableStateFlow(0F)
30     override val notificationStackAbsoluteBottom = _notificationStackAbsoluteBottom.asStateFlow()
31 
32     private val _wallpaperFocalAreaBounds = MutableStateFlow(RectF(0F, 0F, 0F, 0F))
33     override val wallpaperFocalAreaBounds: StateFlow<RectF> =
34         _wallpaperFocalAreaBounds.asStateFlow()
35 
36     private val _wallpaperFocalAreaTapPosition = MutableStateFlow(PointF(0F, 0F))
37     val wallpaperFocalAreaTapPosition: StateFlow<PointF> =
38         _wallpaperFocalAreaTapPosition.asStateFlow()
39 
40     private val _notificationDefaultTop = MutableStateFlow(0F)
41     override val notificationDefaultTop: StateFlow<Float> = _notificationDefaultTop.asStateFlow()
42 
43     private val _hasFocalArea = MutableStateFlow(false)
44     override val hasFocalArea: StateFlow<Boolean> = _hasFocalArea.asStateFlow()
45 
setShortcutAbsoluteTopnull46     override fun setShortcutAbsoluteTop(top: Float) {
47         _shortcutAbsoluteTop.value = top
48     }
49 
setNotificationStackAbsoluteBottomnull50     override fun setNotificationStackAbsoluteBottom(bottom: Float) {
51         _notificationStackAbsoluteBottom.value = bottom
52     }
53 
setNotificationDefaultTopnull54     override fun setNotificationDefaultTop(top: Float) {
55         _notificationDefaultTop.value = top
56     }
57 
setWallpaperFocalAreaBoundsnull58     override fun setWallpaperFocalAreaBounds(bounds: RectF) {
59         _wallpaperFocalAreaBounds.value = bounds
60     }
61 
setTapPositionnull62     override fun setTapPosition(tapPosition: PointF) {
63         _wallpaperFocalAreaTapPosition.value = tapPosition
64     }
65 }
66