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