| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.view; |
| 18 |
|
| 19 |
import static android.os.IInputConstants.POLICY_FLAG_INJECTED_FROM_ACCESSIBILITY; |
| 20 |
|
| 21 |
import android.annotation.IntDef; |
| 22 |
import android.os.PowerManager; |
| 23 |
|
| 24 |
import java.lang.annotation.Retention; |
| 25 |
import java.lang.annotation.RetentionPolicy; |
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
public interface WindowManagerPolicyConstants { |
| 32 |
|
| 33 |
|
| 34 |
int FLAG_WAKE = 0x00000001; |
| 35 |
int FLAG_VIRTUAL = 0x00000002; |
| 36 |
|
| 37 |
int FLAG_INJECTED_FROM_ACCESSIBILITY = POLICY_FLAG_INJECTED_FROM_ACCESSIBILITY; |
| 38 |
int FLAG_INJECTED = 0x01000000; |
| 39 |
int FLAG_TRUSTED = 0x02000000; |
| 40 |
int FLAG_FILTERED = 0x04000000; |
| 41 |
int FLAG_DISABLE_KEY_REPEAT = 0x08000000; |
| 42 |
|
| 43 |
int FLAG_INTERACTIVE = 0x20000000; |
| 44 |
int FLAG_PASS_TO_USER = 0x40000000; |
| 45 |
|
| 46 |
|
| 47 |
int KEYGUARD_GOING_AWAY_FLAG_TO_SHADE = 1 << 0; |
| 48 |
int KEYGUARD_GOING_AWAY_FLAG_NO_WINDOW_ANIMATIONS = 1 << 1; |
| 49 |
int KEYGUARD_GOING_AWAY_FLAG_WITH_WALLPAPER = 1 << 2; |
| 50 |
int KEYGUARD_GOING_AWAY_FLAG_SUBTLE_WINDOW_ANIMATIONS = 1 << 3; |
| 51 |
int KEYGUARD_GOING_AWAY_FLAG_TO_LAUNCHER_CLEAR_SNAPSHOT = 1 << 4; |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
int PRESENCE_INTERNAL = 1 << 0; |
| 56 |
int PRESENCE_EXTERNAL = 1 << 1; |
| 57 |
|
| 58 |
|
| 59 |
int ALT_BAR_UNKNOWN = -1; |
| 60 |
int ALT_BAR_LEFT = 1 << 0; |
| 61 |
int ALT_BAR_RIGHT = 1 << 1; |
| 62 |
int ALT_BAR_BOTTOM = 1 << 2; |
| 63 |
int ALT_BAR_TOP = 1 << 3; |
| 64 |
|
| 65 |
|
| 66 |
int NAV_BAR_INVALID = -1; |
| 67 |
int NAV_BAR_LEFT = 1 << 0; |
| 68 |
int NAV_BAR_RIGHT = 1 << 1; |
| 69 |
int NAV_BAR_BOTTOM = 1 << 2; |
| 70 |
|
| 71 |
|
| 72 |
int NAV_BAR_MODE_3BUTTON = 0; |
| 73 |
int NAV_BAR_MODE_2BUTTON = 1; |
| 74 |
int NAV_BAR_MODE_GESTURAL = 2; |
| 75 |
|
| 76 |
|
| 77 |
String NAV_BAR_MODE_3BUTTON_OVERLAY = "com.android.internal.systemui.navbar.threebutton"; |
| 78 |
String NAV_BAR_MODE_2BUTTON_OVERLAY = "com.android.internal.systemui.navbar.twobutton"; |
| 79 |
String NAV_BAR_MODE_GESTURAL_OVERLAY = "com.android.internal.systemui.navbar.gestural"; |
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
String ACTION_HDMI_PLUGGED = "android.intent.action.HDMI_PLUGGED"; |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
String EXTRA_HDMI_PLUGGED_STATE = "state"; |
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
String EXTRA_FROM_HOME_KEY = "android.intent.extra.FROM_HOME_KEY"; |
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
String EXTRA_START_REASON = "android.intent.extra.EXTRA_START_REASON"; |
| 106 |
|
| 107 |
|
| 108 |
interface PointerEventListener { |
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
void onPointerEvent(MotionEvent motionEvent); |
| 115 |
} |
| 116 |
|
| 117 |
@IntDef(prefix = { "OFF_BECAUSE_OF_" }, value = { |
| 118 |
OFF_BECAUSE_OF_ADMIN, |
| 119 |
OFF_BECAUSE_OF_USER, |
| 120 |
OFF_BECAUSE_OF_TIMEOUT, |
| 121 |
}) |
| 122 |
@Retention(RetentionPolicy.SOURCE) |
| 123 |
public @interface OffReason{} |
| 124 |
|
| 125 |
static @OffReason int translateSleepReasonToOffReason( |
| 126 |
@PowerManager.GoToSleepReason int reason) { |
| 127 |
switch (reason) { |
| 128 |
case PowerManager.GO_TO_SLEEP_REASON_DEVICE_ADMIN: |
| 129 |
return OFF_BECAUSE_OF_ADMIN; |
| 130 |
case PowerManager.GO_TO_SLEEP_REASON_TIMEOUT: |
| 131 |
case PowerManager.GO_TO_SLEEP_REASON_INATTENTIVE: |
| 132 |
return OFF_BECAUSE_OF_TIMEOUT; |
| 133 |
default: |
| 134 |
return OFF_BECAUSE_OF_USER; |
| 135 |
} |
| 136 |
} |
| 137 |
|
| 138 |
|
| 139 |
int OFF_BECAUSE_OF_ADMIN = 1; |
| 140 |
|
| 141 |
int OFF_BECAUSE_OF_USER = 2; |
| 142 |
|
| 143 |
int OFF_BECAUSE_OF_TIMEOUT = 3; |
| 144 |
|
| 145 |
@IntDef(prefix = { "ON_BECAUSE_OF_" }, value = { |
| 146 |
ON_BECAUSE_OF_USER, |
| 147 |
ON_BECAUSE_OF_APPLICATION, |
| 148 |
ON_BECAUSE_OF_UNKNOWN, |
| 149 |
}) |
| 150 |
@Retention(RetentionPolicy.SOURCE) |
| 151 |
public @interface OnReason{} |
| 152 |
|
| 153 |
|
| 154 |
static String onReasonToString(@OnReason int why) { |
| 155 |
switch (why) { |
| 156 |
case ON_BECAUSE_OF_USER: |
| 157 |
return "ON_BECAUSE_OF_USER"; |
| 158 |
case ON_BECAUSE_OF_APPLICATION: |
| 159 |
return "ON_BECAUSE_OF_APPLICATION"; |
| 160 |
case ON_BECAUSE_OF_UNKNOWN: |
| 161 |
return "ON_BECAUSE_OF_UNKNOWN"; |
| 162 |
default: |
| 163 |
return Integer.toString(why); |
| 164 |
} |
| 165 |
} |
| 166 |
|
| 167 |
static @OnReason int translateWakeReasonToOnReason(@PowerManager.WakeReason int reason) { |
| 168 |
switch (reason) { |
| 169 |
case PowerManager.WAKE_REASON_POWER_BUTTON: |
| 170 |
case PowerManager.WAKE_REASON_PLUGGED_IN: |
| 171 |
case PowerManager.WAKE_REASON_GESTURE: |
| 172 |
case PowerManager.WAKE_REASON_TAP: |
| 173 |
case PowerManager.WAKE_REASON_LIFT: |
| 174 |
case PowerManager.WAKE_REASON_BIOMETRIC: |
| 175 |
case PowerManager.WAKE_REASON_CAMERA_LAUNCH: |
| 176 |
case PowerManager.WAKE_REASON_WAKE_KEY: |
| 177 |
case PowerManager.WAKE_REASON_WAKE_MOTION: |
| 178 |
case PowerManager.WAKE_REASON_LID: |
| 179 |
return ON_BECAUSE_OF_USER; |
| 180 |
case PowerManager.WAKE_REASON_APPLICATION: |
| 181 |
return ON_BECAUSE_OF_APPLICATION; |
| 182 |
default: |
| 183 |
return ON_BECAUSE_OF_UNKNOWN; |
| 184 |
} |
| 185 |
} |
| 186 |
|
| 187 |
|
| 188 |
int ON_BECAUSE_OF_USER = 1; |
| 189 |
|
| 190 |
int ON_BECAUSE_OF_APPLICATION = 2; |
| 191 |
|
| 192 |
int ON_BECAUSE_OF_UNKNOWN = 3; |
| 193 |
|
| 194 |
int APPLICATION_LAYER = 2; |
| 195 |
int APPLICATION_MEDIA_SUBLAYER = -2; |
| 196 |
int APPLICATION_MEDIA_OVERLAY_SUBLAYER = -1; |
| 197 |
int APPLICATION_PANEL_SUBLAYER = 1; |
| 198 |
int APPLICATION_SUB_PANEL_SUBLAYER = 2; |
| 199 |
int APPLICATION_ABOVE_SUB_PANEL_SUBLAYER = 3; |
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
static String offReasonToString(int why) { |
| 205 |
switch (why) { |
| 206 |
case OFF_BECAUSE_OF_ADMIN: |
| 207 |
return "OFF_BECAUSE_OF_ADMIN"; |
| 208 |
case OFF_BECAUSE_OF_USER: |
| 209 |
return "OFF_BECAUSE_OF_USER"; |
| 210 |
case OFF_BECAUSE_OF_TIMEOUT: |
| 211 |
return "OFF_BECAUSE_OF_TIMEOUT"; |
| 212 |
default: |
| 213 |
return Integer.toString(why); |
| 214 |
} |
| 215 |
} |
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
int TYPE_LAYER_MULTIPLIER = 10000; |
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
int TYPE_LAYER_OFFSET = 1000; |
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
int WINDOW_LAYER_MULTIPLIER = 5; |
| 235 |
|
| 236 |
|
| 237 |
|
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
int LAYER_OFFSET_THUMBNAIL = WINDOW_LAYER_MULTIPLIER - 1; |
| 242 |
|
| 243 |
int WATERMARK_LAYER = TYPE_LAYER_MULTIPLIER * 100; |
| 244 |
int STRICT_MODE_LAYER = TYPE_LAYER_MULTIPLIER * 101; |
| 245 |
int WINDOW_FREEZE_LAYER = TYPE_LAYER_MULTIPLIER * 200; |
| 246 |
|
| 247 |
|
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
int SCREEN_FREEZE_LAYER_BASE = WINDOW_FREEZE_LAYER + TYPE_LAYER_MULTIPLIER; |
| 252 |
} |