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 com.android.internal.util.FrameworkStatsLog 19 20 /** A documenting annotation for FrameworkStatsLog methods and their associated UiEvents. */ 21 internal annotation class ForUiEvent(vararg val uiEventId: Int) 22 23 /** Isolates the specific method signatures to use for each of the logged UiEvents. */ 24 interface FrameworkStatsLogger { 25 26 @ForUiEvent(FrameworkStatsLog.SHARESHEET_STARTED) writenull27 fun write( 28 frameworkEventId: Int, 29 appEventId: Int, 30 packageName: String?, 31 instanceId: Int, 32 mimeType: String?, 33 numAppProvidedDirectTargets: Int, 34 numAppProvidedAppTargets: Int, 35 isWorkProfile: Boolean, 36 previewType: Int, 37 intentType: Int, 38 numCustomActions: Int, 39 modifyShareActionProvided: Boolean, 40 ) { 41 FrameworkStatsLog.write( 42 frameworkEventId, /* event_id = 1 */ 43 appEventId, /* package_name = 2 */ 44 packageName, /* instance_id = 3 */ 45 instanceId, /* mime_type = 4 */ 46 mimeType, /* num_app_provided_direct_targets */ 47 numAppProvidedDirectTargets, /* num_app_provided_app_targets */ 48 numAppProvidedAppTargets, /* is_workprofile */ 49 isWorkProfile, /* previewType = 8 */ 50 previewType, /* intentType = 9 */ 51 intentType, /* num_provided_custom_actions = 10 */ 52 numCustomActions, /* modify_share_action_provided = 11 */ 53 modifyShareActionProvided 54 ) 55 } 56 57 @ForUiEvent(FrameworkStatsLog.RANKING_SELECTED) writenull58 fun write( 59 frameworkEventId: Int, 60 appEventId: Int, 61 packageName: String?, 62 instanceId: Int, 63 positionPicked: Int, 64 isPinned: Boolean, 65 ) { 66 FrameworkStatsLog.write( 67 frameworkEventId, /* event_id = 1 */ 68 appEventId, /* package_name = 2 */ 69 packageName, /* instance_id = 3 */ 70 instanceId, /* position_picked = 4 */ 71 positionPicked, /* is_pinned = 5 */ 72 isPinned 73 ) 74 } 75 } 76