1 package com.android.intentresolver.logging 2 /* 3 * Copyright (C) 2023 The Android Open Source Project 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 18 import com.android.internal.util.FrameworkStatsLog 19 20 internal data class ShareSheetStarted( 21 val frameworkEventId: Int = FrameworkStatsLog.SHARESHEET_STARTED, 22 val appEventId: Int, 23 val packageName: String?, 24 val instanceId: Int, 25 val mimeType: String?, 26 val numAppProvidedDirectTargets: Int, 27 val numAppProvidedAppTargets: Int, 28 val isWorkProfile: Boolean, 29 val previewType: Int, 30 val intentType: Int, 31 val numCustomActions: Int, 32 val modifyShareActionProvided: Boolean 33 ) 34 35 internal data class RankingSelected( 36 val frameworkEventId: Int = FrameworkStatsLog.RANKING_SELECTED, 37 val appEventId: Int, 38 val packageName: String?, 39 val instanceId: Int, 40 val positionPicked: Int, 41 val isPinned: Boolean 42 ) 43 44 internal class FakeFrameworkStatsLogger : FrameworkStatsLogger { 45 var shareSheetStarted: ShareSheetStarted? = null 46 var rankingSelected: RankingSelected? = null writenull47 override fun write( 48 frameworkEventId: Int, 49 appEventId: Int, 50 packageName: String?, 51 instanceId: Int, 52 mimeType: String?, 53 numAppProvidedDirectTargets: Int, 54 numAppProvidedAppTargets: Int, 55 isWorkProfile: Boolean, 56 previewType: Int, 57 intentType: Int, 58 numCustomActions: Int, 59 modifyShareActionProvided: Boolean 60 ) { 61 shareSheetStarted = 62 ShareSheetStarted( 63 frameworkEventId, 64 appEventId, 65 packageName, 66 instanceId, 67 mimeType, 68 numAppProvidedDirectTargets, 69 numAppProvidedAppTargets, 70 isWorkProfile, 71 previewType, 72 intentType, 73 numCustomActions, 74 modifyShareActionProvided 75 ) 76 } writenull77 override fun write( 78 frameworkEventId: Int, 79 appEventId: Int, 80 packageName: String?, 81 instanceId: Int, 82 positionPicked: Int, 83 isPinned: Boolean 84 ) { 85 rankingSelected = 86 RankingSelected( 87 frameworkEventId, 88 appEventId, 89 packageName, 90 instanceId, 91 positionPicked, 92 isPinned 93 ) 94 } 95 } 96