1 /*
2  * Copyright (C) 2021 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.statusbar.gesture
18 
19 import com.android.systemui.log.LogBuffer
20 import com.android.systemui.log.LogLevel
21 import com.android.systemui.log.dagger.SwipeStatusBarAwayLog
22 import javax.inject.Inject
23 
24 /** Log messages for [SwipeStatusBarAwayGestureHandler]. */
25 class SwipeStatusBarAwayGestureLogger @Inject constructor(
26     @SwipeStatusBarAwayLog private val buffer: LogBuffer
27 ) {
28     fun logGestureDetectionStarted(y: Int) {
29         buffer.log(
30             TAG,
31             LogLevel.DEBUG,
32             { int1 = y },
33             { "Beginning gesture detection. y=$int1" }
34         )
35     }
36 
37     fun logGestureDetectionEndedWithoutTriggering(y: Int) {
38         buffer.log(
39             TAG,
40             LogLevel.DEBUG,
41             { int1 = y },
42             { "Gesture finished; no swipe up gesture detected. Final y=$int1" }
43         )
44     }
45 
46     fun logGestureDetected(y: Int) {
47         buffer.log(
48             TAG,
49             LogLevel.INFO,
50             { int1 = y },
51             { "Gesture detected; notifying callbacks. y=$int1" }
52         )
53     }
54 
55     fun logInputListeningStarted() {
56         buffer.log(TAG, LogLevel.VERBOSE, {}, { "Input listening started "})
57     }
58 
59     fun logInputListeningStopped() {
60         buffer.log(TAG, LogLevel.VERBOSE, {}, { "Input listening stopped "})
61     }
62 }
63 
64 private const val TAG = "SwipeStatusBarAwayGestureHandler"