• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 android.annotation.IntDef;
20 
21 import java.lang.annotation.Retention;
22 import java.lang.annotation.RetentionPolicy;
23 
24 /**
25  * Constants for interfacing with WindowManagerService and WindowManagerPolicyInternal.
26  * @hide
27  */
28 public interface WindowManagerPolicyConstants {
29     // Policy flags.  These flags are also defined in frameworks/base/include/ui/Input.h.
30     int FLAG_WAKE = 0x00000001;
31     int FLAG_VIRTUAL = 0x00000002;
32 
33     int FLAG_INJECTED = 0x01000000;
34     int FLAG_TRUSTED = 0x02000000;
35     int FLAG_FILTERED = 0x04000000;
36     int FLAG_DISABLE_KEY_REPEAT = 0x08000000;
37 
38     int FLAG_INTERACTIVE = 0x20000000;
39     int FLAG_PASS_TO_USER = 0x40000000;
40 
41     // Flags for IActivityTaskManager.keyguardGoingAway()
42     int KEYGUARD_GOING_AWAY_FLAG_TO_SHADE = 1 << 0;
43     int KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS = 1 << 1;
44     int KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER = 1 << 2;
45     int KEYGUARD_GOING_AWAY_FLAG_SUBTLE_WINDOW_ANIMATIONS = 1 << 3;
46 
47     // Flags used for indicating whether the internal and/or external input devices
48     // of some type are available.
49     int PRESENCE_INTERNAL = 1 << 0;
50     int PRESENCE_EXTERNAL = 1 << 1;
51 
52     // Alternate bars position values
53     int ALT_BAR_UNKNOWN = -1;
54     int ALT_BAR_LEFT = 1 << 0;
55     int ALT_BAR_RIGHT = 1 << 1;
56     int ALT_BAR_BOTTOM = 1 << 2;
57     int ALT_BAR_TOP = 1 << 3;
58 
59     // Navigation bar position values
60     int NAV_BAR_INVALID = -1;
61     int NAV_BAR_LEFT = 1 << 0;
62     int NAV_BAR_RIGHT = 1 << 1;
63     int NAV_BAR_BOTTOM = 1 << 2;
64 
65     // Navigation bar interaction modes
66     int NAV_BAR_MODE_3BUTTON = 0;
67     int NAV_BAR_MODE_2BUTTON = 1;
68     int NAV_BAR_MODE_GESTURAL = 2;
69 
70     // Associated overlays for each nav bar mode
71     String NAV_BAR_MODE_3BUTTON_OVERLAY = "com.android.internal.systemui.navbar.threebutton";
72     String NAV_BAR_MODE_2BUTTON_OVERLAY = "com.android.internal.systemui.navbar.twobutton";
73     String NAV_BAR_MODE_GESTURAL_OVERLAY = "com.android.internal.systemui.navbar.gestural";
74 
75     /**
76      * Sticky broadcast of the current HDMI plugged state.
77      */
78     String ACTION_HDMI_PLUGGED = "android.intent.action.HDMI_PLUGGED";
79 
80     /**
81      * Extra in {@link #ACTION_HDMI_PLUGGED} indicating the state: true if
82      * plugged in to HDMI, false if not.
83      */
84     String EXTRA_HDMI_PLUGGED_STATE = "state";
85 
86     /**
87      * Set to {@code true} when intent was invoked from pressing the home key.
88      * @hide
89      */
90     String EXTRA_FROM_HOME_KEY = "android.intent.extra.FROM_HOME_KEY";
91 
92     // TODO: move this to a more appropriate place.
93     interface PointerEventListener {
94         /**
95          * 1. onPointerEvent will be called on the service.UiThread.
96          * 2. motionEvent will be recycled after onPointerEvent returns so if it is needed later a
97          * copy() must be made and the copy must be recycled.
98          **/
onPointerEvent(MotionEvent motionEvent)99         void onPointerEvent(MotionEvent motionEvent);
100     }
101 
102     /** Screen turned off because of a device admin */
103     int OFF_BECAUSE_OF_ADMIN = 1;
104     /** Screen turned off because of power button */
105     int OFF_BECAUSE_OF_USER = 2;
106     /** Screen turned off because of timeout */
107     int OFF_BECAUSE_OF_TIMEOUT = 3;
108 
109     @IntDef(prefix = { "ON_BECAUSE_OF_" }, value = {
110             ON_BECAUSE_OF_USER,
111             ON_BECAUSE_OF_APPLICATION,
112             ON_BECAUSE_OF_UNKNOWN,
113     })
114     @Retention(RetentionPolicy.SOURCE)
115     public @interface OnReason{}
116 
117     /** Convert the on reason to a human readable format */
onReasonToString(@nReason int why)118     static String onReasonToString(@OnReason int why) {
119         switch (why) {
120             case ON_BECAUSE_OF_USER:
121                 return "ON_BECAUSE_OF_USER";
122             case ON_BECAUSE_OF_APPLICATION:
123                 return "ON_BECAUSE_OF_APPLICATION";
124             case ON_BECAUSE_OF_UNKNOWN:
125                 return "ON_BECAUSE_OF_UNKNOWN";
126             default:
127                 return Integer.toString(why);
128         }
129     }
130 
131     /** Screen turned on because of a user-initiated action. */
132     int ON_BECAUSE_OF_USER = 1;
133     /** Screen turned on because of an application request or event */
134     int ON_BECAUSE_OF_APPLICATION = 2;
135     /** Screen turned on for an unknown reason */
136     int ON_BECAUSE_OF_UNKNOWN = 3;
137 
138     int APPLICATION_LAYER = 2;
139     int APPLICATION_MEDIA_SUBLAYER = -2;
140     int APPLICATION_MEDIA_OVERLAY_SUBLAYER = -1;
141     int APPLICATION_PANEL_SUBLAYER = 1;
142     int APPLICATION_SUB_PANEL_SUBLAYER = 2;
143     int APPLICATION_ABOVE_SUB_PANEL_SUBLAYER = 3;
144 
145     /**
146      * Convert the off reason to a human readable format.
147      */
offReasonToString(int why)148     static String offReasonToString(int why) {
149         switch (why) {
150             case OFF_BECAUSE_OF_ADMIN:
151                 return "OFF_BECAUSE_OF_ADMIN";
152             case OFF_BECAUSE_OF_USER:
153                 return "OFF_BECAUSE_OF_USER";
154             case OFF_BECAUSE_OF_TIMEOUT:
155                 return "OFF_BECAUSE_OF_TIMEOUT";
156             default:
157                 return Integer.toString(why);
158         }
159     }
160 }
161