1 /* 2 * Copyright (C) 2020 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.screenshot; 18 19 import static android.view.WindowManager.ScreenshotSource.SCREENSHOT_ACCESSIBILITY_ACTIONS; 20 import static android.view.WindowManager.ScreenshotSource.SCREENSHOT_GLOBAL_ACTIONS; 21 import static android.view.WindowManager.ScreenshotSource.SCREENSHOT_KEY_CHORD; 22 import static android.view.WindowManager.ScreenshotSource.SCREENSHOT_KEY_OTHER; 23 import static android.view.WindowManager.ScreenshotSource.SCREENSHOT_OTHER; 24 import static android.view.WindowManager.ScreenshotSource.SCREENSHOT_OVERVIEW; 25 import static android.view.WindowManager.ScreenshotSource.SCREENSHOT_VENDOR_GESTURE; 26 27 import com.android.internal.logging.UiEvent; 28 import com.android.internal.logging.UiEventLogger; 29 30 public enum ScreenshotEvent implements UiEventLogger.UiEventEnum { 31 @UiEvent(doc = "screenshot requested from global actions") 32 SCREENSHOT_REQUESTED_GLOBAL_ACTIONS(302), 33 @UiEvent(doc = "screenshot requested from key chord") 34 SCREENSHOT_REQUESTED_KEY_CHORD(303), 35 @UiEvent(doc = "screenshot requested from other key press (e.g. ctrl-s)") 36 SCREENSHOT_REQUESTED_KEY_OTHER(384), 37 @UiEvent(doc = "screenshot requested from overview") 38 SCREENSHOT_REQUESTED_OVERVIEW(304), 39 @UiEvent(doc = "screenshot requested from accessibility actions") 40 SCREENSHOT_REQUESTED_ACCESSIBILITY_ACTIONS(382), 41 @UiEvent(doc = "screenshot requested from vendor gesture") 42 SCREENSHOT_REQUESTED_VENDOR_GESTURE(638), 43 @UiEvent(doc = "screenshot requested (other)") 44 SCREENSHOT_REQUESTED_OTHER(305), 45 @UiEvent(doc = "screenshot was saved") 46 SCREENSHOT_SAVED(306), 47 @UiEvent(doc = "screenshot failed to save") 48 SCREENSHOT_NOT_SAVED(336), 49 @UiEvent(doc = "failed to capture screenshot") 50 SCREENSHOT_CAPTURE_FAILED(1281), 51 @UiEvent(doc = "screenshot preview tapped") 52 SCREENSHOT_PREVIEW_TAPPED(307), 53 @UiEvent(doc = "screenshot edit button tapped") 54 SCREENSHOT_EDIT_TAPPED(308), 55 @UiEvent(doc = "screenshot share button tapped") 56 SCREENSHOT_SHARE_TAPPED(309), 57 @UiEvent(doc = "screenshot smart action chip tapped") 58 SCREENSHOT_SMART_ACTION_TAPPED(374), 59 @UiEvent(doc = "screenshot scroll tapped") 60 SCREENSHOT_SCROLL_TAPPED(373), 61 @UiEvent(doc = "screenshot interaction timed out") 62 SCREENSHOT_INTERACTION_TIMEOUT(310), 63 @UiEvent(doc = "screenshot explicitly dismissed") 64 SCREENSHOT_EXPLICIT_DISMISSAL(311), 65 @UiEvent(doc = "screenshot swiped to dismiss") 66 SCREENSHOT_SWIPE_DISMISSED(656), 67 @UiEvent(doc = "screenshot dismissed, miscellaneous reason") 68 SCREENSHOT_DISMISSED_OTHER(1076), 69 @UiEvent(doc = "screenshot reentered for new screenshot") 70 SCREENSHOT_REENTERED(640), 71 @UiEvent(doc = "Long screenshot button was shown to the user") 72 SCREENSHOT_LONG_SCREENSHOT_IMPRESSION(687), 73 @UiEvent(doc = "User has requested a long screenshot") 74 SCREENSHOT_LONG_SCREENSHOT_REQUESTED(688), 75 @UiEvent(doc = "User has shared a long screenshot") 76 SCREENSHOT_LONG_SCREENSHOT_SHARE(689), 77 @UiEvent(doc = "User has sent a long screenshot to the editor") 78 SCREENSHOT_LONG_SCREENSHOT_EDIT(690), 79 @UiEvent(doc = "A long screenshot capture has started") 80 SCREENSHOT_LONG_SCREENSHOT_STARTED(880), 81 @UiEvent(doc = "The long screenshot capture failed") 82 SCREENSHOT_LONG_SCREENSHOT_FAILURE(881), 83 @UiEvent(doc = "The long screenshot capture completed successfully") 84 SCREENSHOT_LONG_SCREENSHOT_COMPLETED(882), 85 @UiEvent(doc = "Long screenshot editor activity started") 86 SCREENSHOT_LONG_SCREENSHOT_ACTIVITY_STARTED(889), 87 @UiEvent(doc = "Long screenshot editor activity loaded a previously saved screenshot") 88 SCREENSHOT_LONG_SCREENSHOT_ACTIVITY_CACHED_IMAGE_LOADED(890), 89 @UiEvent(doc = "Long screenshot editor activity finished") 90 SCREENSHOT_LONG_SCREENSHOT_ACTIVITY_FINISHED(891), 91 @UiEvent(doc = "User has saved a long screenshot to a file") 92 SCREENSHOT_LONG_SCREENSHOT_SAVED(910), 93 @UiEvent(doc = "User has discarded the result of a long screenshot") 94 SCREENSHOT_LONG_SCREENSHOT_EXIT(911), 95 @UiEvent(doc = "A screenshot has been taken and saved to work profile") 96 SCREENSHOT_SAVED_TO_WORK_PROFILE(1240); 97 98 private final int mId; 99 ScreenshotEvent(int id)100 ScreenshotEvent(int id) { 101 mId = id; 102 } 103 104 @Override getId()105 public int getId() { 106 return mId; 107 } 108 getScreenshotSource(int source)109 static ScreenshotEvent getScreenshotSource(int source) { 110 switch (source) { 111 case SCREENSHOT_GLOBAL_ACTIONS: 112 return ScreenshotEvent.SCREENSHOT_REQUESTED_GLOBAL_ACTIONS; 113 case SCREENSHOT_KEY_CHORD: 114 return ScreenshotEvent.SCREENSHOT_REQUESTED_KEY_CHORD; 115 case SCREENSHOT_KEY_OTHER: 116 return ScreenshotEvent.SCREENSHOT_REQUESTED_KEY_OTHER; 117 case SCREENSHOT_OVERVIEW: 118 return ScreenshotEvent.SCREENSHOT_REQUESTED_OVERVIEW; 119 case SCREENSHOT_ACCESSIBILITY_ACTIONS: 120 return ScreenshotEvent.SCREENSHOT_REQUESTED_ACCESSIBILITY_ACTIONS; 121 case SCREENSHOT_VENDOR_GESTURE: 122 return ScreenshotEvent.SCREENSHOT_REQUESTED_VENDOR_GESTURE; 123 case SCREENSHOT_OTHER: 124 default: 125 return ScreenshotEvent.SCREENSHOT_REQUESTED_OTHER; 126 } 127 } 128 } 129