1 /*
2  * Copyright (C) 2022 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.media.taptotransfer.receiver
18 
19 import com.android.internal.logging.InstanceId
20 import com.android.internal.logging.UiEvent
21 import com.android.internal.logging.UiEventLogger
22 import com.android.systemui.dagger.SysUISingleton
23 import javax.inject.Inject
24 
25 /** A class for analytics logging for the media tap-to-transfer chip on the receiver device. */
26 @SysUISingleton
27 class MediaTttReceiverUiEventLogger @Inject constructor(private val logger: UiEventLogger) {
28     /** Logs that the receiver chip has changed states. */
logReceiverStateChangenull29     fun logReceiverStateChange(chipState: ChipStateReceiver, instanceId: InstanceId) {
30         logger.log(chipState.uiEvent, instanceId)
31     }
32 }
33 
34 enum class MediaTttReceiverUiEvents(val metricId: Int) : UiEventLogger.UiEventEnum {
35     @UiEvent(doc = "See android.app.StatusBarManager.MEDIA_TRANSFER_RECEIVER_* docs")
36     MEDIA_TTT_RECEIVER_CLOSE_TO_SENDER(982),
37     @UiEvent(doc = "See android.app.StatusBarManager.MEDIA_TRANSFER_RECEIVER_* docs")
38     MEDIA_TTT_RECEIVER_FAR_FROM_SENDER(983),
39     @UiEvent(doc = "See android.app.StatusBarManager.MEDIA_TRANSFER_RECEIVER_* docs")
40     MEDIA_TTT_RECEIVER_TRANSFER_TO_RECEIVER_SUCCEEDED(1263),
41     @UiEvent(doc = "See android.app.StatusBarManager.MEDIA_TRANSFER_RECEIVER_* docs")
42     MEDIA_TTT_RECEIVER_TRANSFER_TO_RECEIVER_FAILED(1264);
43 
getIdnull44     override fun getId() = metricId
45 }
46