Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2006 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 android.view; |
| 18 | |
| 19 | import static android.view.Display.DEFAULT_DISPLAY; |
| 20 | |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 21 | /** |
| 22 | * Constants for interfacing with WindowManagerService and WindowManagerPolicyInternal. |
| 23 | * @hide |
| 24 | */ |
| 25 | public interface WindowManagerPolicyConstants { |
| 26 | // Policy flags. These flags are also defined in frameworks/base/include/ui/Input.h. |
| 27 | int FLAG_WAKE = 0x00000001; |
| 28 | int FLAG_VIRTUAL = 0x00000002; |
| 29 | |
| 30 | int FLAG_INJECTED = 0x01000000; |
| 31 | int FLAG_TRUSTED = 0x02000000; |
| 32 | int FLAG_FILTERED = 0x04000000; |
| 33 | int FLAG_DISABLE_KEY_REPEAT = 0x08000000; |
| 34 | |
| 35 | int FLAG_INTERACTIVE = 0x20000000; |
| 36 | int FLAG_PASS_TO_USER = 0x40000000; |
| 37 | |
| 38 | // Flags for IActivityManager.keyguardGoingAway() |
| 39 | int KEYGUARD_GOING_AWAY_FLAG_TO_SHADE = 1 << 0; |
| 40 | int KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS = 1 << 1; |
| 41 | int KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER = 1 << 2; |
| 42 | |
| 43 | // Flags used for indicating whether the internal and/or external input devices |
| 44 | // of some type are available. |
| 45 | int PRESENCE_INTERNAL = 1 << 0; |
| 46 | int PRESENCE_EXTERNAL = 1 << 1; |
| 47 | |
Matthew Ng | a8f2426 | 2017-12-19 11:54:24 -0800 | [diff] [blame] | 48 | // Navigation bar position values |
| 49 | int NAV_BAR_LEFT = 1 << 0; |
| 50 | int NAV_BAR_RIGHT = 1 << 1; |
| 51 | int NAV_BAR_BOTTOM = 1 << 2; |
| 52 | |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 53 | /** |
Yoshiaki Naka | e1bdfc82 | 2017-09-15 15:24:34 +0900 | [diff] [blame] | 54 | * Broadcast sent when a user activity is detected. |
| 55 | */ |
| 56 | String ACTION_USER_ACTIVITY_NOTIFICATION = |
| 57 | "android.intent.action.USER_ACTIVITY_NOTIFICATION"; |
| 58 | |
| 59 | /** |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 60 | * Sticky broadcast of the current HDMI plugged state. |
| 61 | */ |
| 62 | String ACTION_HDMI_PLUGGED = "android.intent.action.HDMI_PLUGGED"; |
| 63 | |
| 64 | /** |
| 65 | * Extra in {@link #ACTION_HDMI_PLUGGED} indicating the state: true if |
| 66 | * plugged in to HDMI, false if not. |
| 67 | */ |
| 68 | String EXTRA_HDMI_PLUGGED_STATE = "state"; |
| 69 | |
| 70 | /** |
| 71 | * Set to {@code true} when intent was invoked from pressing the home key. |
| 72 | * @hide |
| 73 | */ |
Adrian Roos | e99bc05 | 2017-11-20 17:55:31 +0100 | [diff] [blame] | 74 | String EXTRA_FROM_HOME_KEY = "android.intent.extra.FROM_HOME_KEY"; |
| 75 | |
| 76 | // TODO: move this to a more appropriate place. |
| 77 | interface PointerEventListener { |
| 78 | /** |
| 79 | * 1. onPointerEvent will be called on the service.UiThread. |
| 80 | * 2. motionEvent will be recycled after onPointerEvent returns so if it is needed later a |
| 81 | * copy() must be made and the copy must be recycled. |
| 82 | **/ |
| 83 | void onPointerEvent(MotionEvent motionEvent); |
| 84 | |
| 85 | /** |
| 86 | * @see #onPointerEvent(MotionEvent) |
| 87 | **/ |
| 88 | default void onPointerEvent(MotionEvent motionEvent, int displayId) { |
| 89 | if (displayId == DEFAULT_DISPLAY) { |
| 90 | onPointerEvent(motionEvent); |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | /** Screen turned off because of a device admin */ |
| 96 | int OFF_BECAUSE_OF_ADMIN = 1; |
| 97 | /** Screen turned off because of power button */ |
| 98 | int OFF_BECAUSE_OF_USER = 2; |
| 99 | /** Screen turned off because of timeout */ |
| 100 | int OFF_BECAUSE_OF_TIMEOUT = 3; |
| 101 | |
| 102 | int APPLICATION_LAYER = 2; |
| 103 | int APPLICATION_MEDIA_SUBLAYER = -2; |
| 104 | int APPLICATION_MEDIA_OVERLAY_SUBLAYER = -1; |
| 105 | int APPLICATION_PANEL_SUBLAYER = 1; |
| 106 | int APPLICATION_SUB_PANEL_SUBLAYER = 2; |
| 107 | int APPLICATION_ABOVE_SUB_PANEL_SUBLAYER = 3; |
| 108 | |
| 109 | /** |
| 110 | * Convert the off reason to a human readable format. |
| 111 | */ |
| 112 | static String offReasonToString(int why) { |
| 113 | switch (why) { |
| 114 | case OFF_BECAUSE_OF_ADMIN: |
| 115 | return "OFF_BECAUSE_OF_ADMIN"; |
| 116 | case OFF_BECAUSE_OF_USER: |
| 117 | return "OFF_BECAUSE_OF_USER"; |
| 118 | case OFF_BECAUSE_OF_TIMEOUT: |
| 119 | return "OFF_BECAUSE_OF_TIMEOUT"; |
| 120 | default: |
| 121 | return Integer.toString(why); |
| 122 | } |
| 123 | } |
| 124 | } |