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 = "screenshot preview tapped") 50 SCREENSHOT_PREVIEW_TAPPED(307), 51 @UiEvent(doc = "screenshot edit button tapped") 52 SCREENSHOT_EDIT_TAPPED(308), 53 @UiEvent(doc = "screenshot share button tapped") 54 SCREENSHOT_SHARE_TAPPED(309), 55 @UiEvent(doc = "screenshot smart action chip tapped") 56 SCREENSHOT_SMART_ACTION_TAPPED(374), 57 @UiEvent(doc = "screenshot scroll tapped") 58 SCREENSHOT_SCROLL_TAPPED(373), 59 @UiEvent(doc = "screenshot interaction timed out") 60 SCREENSHOT_INTERACTION_TIMEOUT(310), 61 @UiEvent(doc = "screenshot explicitly dismissed") 62 SCREENSHOT_EXPLICIT_DISMISSAL(311), 63 @UiEvent(doc = "screenshot swiped to dismiss") 64 SCREENSHOT_SWIPE_DISMISSED(656), 65 @UiEvent(doc = "screenshot reentered for new screenshot") 66 SCREENSHOT_REENTERED(640), 67 @UiEvent(doc = "Long screenshot button was shown to the user") 68 SCREENSHOT_LONG_SCREENSHOT_IMPRESSION(687), 69 @UiEvent(doc = "User has requested a long screenshot") 70 SCREENSHOT_LONG_SCREENSHOT_REQUESTED(688), 71 @UiEvent(doc = "User has shared a long screenshot") 72 SCREENSHOT_LONG_SCREENSHOT_SHARE(689), 73 @UiEvent(doc = "User has sent a long screenshot to the editor") 74 SCREENSHOT_LONG_SCREENSHOT_EDIT(690); 75 76 private final int mId; 77 ScreenshotEvent(int id)78 ScreenshotEvent(int id) { 79 mId = id; 80 } 81 82 @Override getId()83 public int getId() { 84 return mId; 85 } 86 getScreenshotSource(int source)87 static ScreenshotEvent getScreenshotSource(int source) { 88 switch (source) { 89 case SCREENSHOT_GLOBAL_ACTIONS: 90 return ScreenshotEvent.SCREENSHOT_REQUESTED_GLOBAL_ACTIONS; 91 case SCREENSHOT_KEY_CHORD: 92 return ScreenshotEvent.SCREENSHOT_REQUESTED_KEY_CHORD; 93 case SCREENSHOT_KEY_OTHER: 94 return ScreenshotEvent.SCREENSHOT_REQUESTED_KEY_OTHER; 95 case SCREENSHOT_OVERVIEW: 96 return ScreenshotEvent.SCREENSHOT_REQUESTED_OVERVIEW; 97 case SCREENSHOT_ACCESSIBILITY_ACTIONS: 98 return ScreenshotEvent.SCREENSHOT_REQUESTED_ACCESSIBILITY_ACTIONS; 99 case SCREENSHOT_VENDOR_GESTURE: 100 return ScreenshotEvent.SCREENSHOT_REQUESTED_VENDOR_GESTURE; 101 case SCREENSHOT_OTHER: 102 default: 103 return ScreenshotEvent.SCREENSHOT_REQUESTED_OTHER; 104 } 105 } 106 } 107