1 /*
2  * Copyright (C) 2023 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 package com.android.intentresolver.logging
17 
18 import android.net.Uri
19 import android.util.HashedStringCache
20 
21 /** Logs notable events during ShareSheet usage. */
22 interface EventLog {
23 
24     companion object {
25         const val SELECTION_TYPE_SERVICE = 1
26         const val SELECTION_TYPE_APP = 2
27         const val SELECTION_TYPE_STANDARD = 3
28         const val SELECTION_TYPE_COPY = 4
29         const val SELECTION_TYPE_NEARBY = 5
30         const val SELECTION_TYPE_EDIT = 6
31         const val SELECTION_TYPE_MODIFY_SHARE = 7
32         const val SELECTION_TYPE_CUSTOM_ACTION = 8
33     }
34 
logChooserActivityShownnull35     fun logChooserActivityShown(isWorkProfile: Boolean, targetMimeType: String?, systemCost: Long)
36 
37     fun logShareStarted(
38         packageName: String?,
39         mimeType: String?,
40         appProvidedDirect: Int,
41         appProvidedApp: Int,
42         isWorkprofile: Boolean,
43         previewType: Int,
44         intent: String?,
45         customActionCount: Int,
46         modifyShareActionProvided: Boolean
47     )
48 
49     fun logCustomActionSelected(positionPicked: Int)
50     fun logShareTargetSelected(
51         targetType: Int,
52         packageName: String?,
53         positionPicked: Int,
54         directTargetAlsoRanked: Int,
55         numCallerProvided: Int,
56         directTargetHashed: HashedStringCache.HashResult?,
57         isPinned: Boolean,
58         successfullySelected: Boolean,
59         selectionCost: Long
60     )
61 
62     fun logDirectShareTargetReceived(category: Int, latency: Int)
63     fun logActionShareWithPreview(previewType: Int)
64     fun logActionSelected(targetType: Int)
65     fun logContentPreviewWarning(uri: Uri?)
66     fun logSharesheetTriggered()
67     fun logSharesheetAppLoadComplete()
68     fun logSharesheetDirectLoadComplete()
69     fun logSharesheetDirectLoadTimeout()
70     fun logSharesheetProfileChanged()
71     fun logSharesheetExpansionChanged(isCollapsed: Boolean)
72     fun logSharesheetAppShareRankingTimeout()
73     fun logSharesheetEmptyDirectShareRow()
74 }
75