• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
5  * except in compliance with the License. You may obtain a copy of the License at
6  *
7  *      http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software distributed under the
10  * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
11  * KIND, either express or implied. See the License for the specific language governing
12  * permissions and limitations under the License.
13  */
14 package com.android.systemui.shade
15 
16 import com.android.systemui.log.dagger.ShadeHeightLog
17 import com.android.systemui.plugins.log.LogBuffer
18 import com.android.systemui.plugins.log.LogLevel.DEBUG
19 import java.text.SimpleDateFormat
20 import javax.inject.Inject
21 
22 private const val TAG = "ShadeHeightLogger"
23 
24 /**
25  * Log the call stack for [NotificationPanelViewController] setExpandedHeightInternal.
26  *
27  * Tracking bug: b/261593829
28  */
29 class ShadeHeightLogger
30 @Inject constructor(
31     @ShadeHeightLog private val buffer: LogBuffer,
32 ) {
33 
34     private val dateFormat = SimpleDateFormat("yyyy-MM-dd-HH-mm-ss-SSS")
35 
logFunctionCallnull36     fun logFunctionCall(functionName: String) {
37         buffer.log(TAG, DEBUG, {
38             str1 = functionName
39         }, {
40             "$str1"
41         })
42     }
43 
logSetExpandedHeightInternalnull44     fun logSetExpandedHeightInternal(h: Float, time: Long) {
45         buffer.log(TAG, DEBUG, {
46             double1 = h.toDouble()
47             long1 = time
48         }, {
49             "setExpandedHeightInternal=$double1 time=${dateFormat.format(long1)}"
50         })
51     }
52 }