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 // Navigation bar position values 53 int NAV_BAR_INVALID = -1; 54 int NAV_BAR_LEFT = 1 << 0; 55 int NAV_BAR_RIGHT = 1 << 1; 56 int NAV_BAR_BOTTOM = 1 << 2; 57 58 // Navigation bar interaction modes 59 int NAV_BAR_MODE_3BUTTON = 0; 60 int NAV_BAR_MODE_2BUTTON = 1; 61 int NAV_BAR_MODE_GESTURAL = 2; 62 63 // Associated overlays for each nav bar mode 64 String NAV_BAR_MODE_3BUTTON_OVERLAY = "com.android.internal.systemui.navbar.threebutton"; 65 String NAV_BAR_MODE_2BUTTON_OVERLAY = "com.android.internal.systemui.navbar.twobutton"; 66 String NAV_BAR_MODE_GESTURAL_OVERLAY = "com.android.internal.systemui.navbar.gestural"; 67 68 /** 69 * Broadcast sent when a user activity is detected. 70 */ 71 String ACTION_USER_ACTIVITY_NOTIFICATION = 72 "android.intent.action.USER_ACTIVITY_NOTIFICATION"; 73 74 /** 75 * Sticky broadcast of the current HDMI plugged state. 76 */ 77 String ACTION_HDMI_PLUGGED = "android.intent.action.HDMI_PLUGGED"; 78 79 /** 80 * Extra in {@link #ACTION_HDMI_PLUGGED} indicating the state: true if 81 * plugged in to HDMI, false if not. 82 */ 83 String EXTRA_HDMI_PLUGGED_STATE = "state"; 84 85 /** 86 * Set to {@code true} when intent was invoked from pressing the home key. 87 * @hide 88 */ 89 String EXTRA_FROM_HOME_KEY = "android.intent.extra.FROM_HOME_KEY"; 90 91 // TODO: move this to a more appropriate place. 92 interface PointerEventListener { 93 /** 94 * 1. onPointerEvent will be called on the service.UiThread. 95 * 2. motionEvent will be recycled after onPointerEvent returns so if it is needed later a 96 * copy() must be made and the copy must be recycled. 97 **/ onPointerEvent(MotionEvent motionEvent)98 void onPointerEvent(MotionEvent motionEvent); 99 } 100 101 /** Screen turned off because of a device admin */ 102 int OFF_BECAUSE_OF_ADMIN = 1; 103 /** Screen turned off because of power button */ 104 int OFF_BECAUSE_OF_USER = 2; 105 /** Screen turned off because of timeout */ 106 int OFF_BECAUSE_OF_TIMEOUT = 3; 107 108 @IntDef(prefix = { "ON_BECAUSE_OF_" }, value = { 109 ON_BECAUSE_OF_USER, 110 ON_BECAUSE_OF_APPLICATION, 111 ON_BECAUSE_OF_UNKNOWN, 112 }) 113 @Retention(RetentionPolicy.SOURCE) 114 public @interface OnReason{} 115 116 /** Convert the on reason to a human readable format */ onReasonToString(@nReason int why)117 static String onReasonToString(@OnReason int why) { 118 switch (why) { 119 case ON_BECAUSE_OF_USER: 120 return "ON_BECAUSE_OF_USER"; 121 case ON_BECAUSE_OF_APPLICATION: 122 return "ON_BECAUSE_OF_APPLICATION"; 123 case ON_BECAUSE_OF_UNKNOWN: 124 return "ON_BECAUSE_OF_UNKNOWN"; 125 default: 126 return Integer.toString(why); 127 } 128 } 129 130 /** Screen turned on because of a user-initiated action. */ 131 int ON_BECAUSE_OF_USER = 1; 132 /** Screen turned on because of an application request or event */ 133 int ON_BECAUSE_OF_APPLICATION = 2; 134 /** Screen turned on for an unknown reason */ 135 int ON_BECAUSE_OF_UNKNOWN = 3; 136 137 int APPLICATION_LAYER = 2; 138 int APPLICATION_MEDIA_SUBLAYER = -2; 139 int APPLICATION_MEDIA_OVERLAY_SUBLAYER = -1; 140 int APPLICATION_PANEL_SUBLAYER = 1; 141 int APPLICATION_SUB_PANEL_SUBLAYER = 2; 142 int APPLICATION_ABOVE_SUB_PANEL_SUBLAYER = 3; 143 144 /** 145 * Convert the off reason to a human readable format. 146 */ offReasonToString(int why)147 static String offReasonToString(int why) { 148 switch (why) { 149 case OFF_BECAUSE_OF_ADMIN: 150 return "OFF_BECAUSE_OF_ADMIN"; 151 case OFF_BECAUSE_OF_USER: 152 return "OFF_BECAUSE_OF_USER"; 153 case OFF_BECAUSE_OF_TIMEOUT: 154 return "OFF_BECAUSE_OF_TIMEOUT"; 155 default: 156 return Integer.toString(why); 157 } 158 } 159 } 160