-
Notifications
You must be signed in to change notification settings - Fork 2
/
ScreenStateHelper.smali
170 lines (102 loc) · 3.22 KB
/
ScreenStateHelper.smali
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
.class Lcom/android/nfc/ScreenStateHelper;
.super Ljava/lang/Object;
.source "ScreenStateHelper.java"
# static fields
.field static final SCREEN_POLLING_P2P_MASK:I = 0x20
.field static final SCREEN_POLLING_READER_MASK:I = 0x40
.field static final SCREEN_POLLING_TAG_MASK:I = 0x10
.field static final SCREEN_STATE_OFF_LOCKED:I = 0x2
.field static final SCREEN_STATE_OFF_UNLOCKED:I = 0x1
.field static final SCREEN_STATE_ON_LOCKED:I = 0x4
.field static final SCREEN_STATE_ON_UNLOCKED:I = 0x8
.field static final SCREEN_STATE_UNKNOWN:I
# instance fields
.field private final mKeyguardManager:Landroid/app/KeyguardManager;
.field private final mPowerManager:Landroid/os/PowerManager;
# direct methods
.method constructor <init>(Landroid/content/Context;)V
.locals 1
.line 26
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 27
nop
.line 28
const-string v0, "keyguard"
invoke-virtual {p1, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object v0
check-cast v0, Landroid/app/KeyguardManager;
iput-object v0, p0, Lcom/android/nfc/ScreenStateHelper;->mKeyguardManager:Landroid/app/KeyguardManager;
.line 29
const-string v0, "power"
invoke-virtual {p1, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;
move-result-object p1
check-cast p1, Landroid/os/PowerManager;
iput-object p1, p0, Lcom/android/nfc/ScreenStateHelper;->mPowerManager:Landroid/os/PowerManager;
.line 30
return-void
.end method
.method static screenStateToString(I)Ljava/lang/String;
.locals 1
.line 51
const/4 v0, 0x1
if-eq p0, v0, :cond_3
const/4 v0, 0x2
if-eq p0, v0, :cond_2
const/4 v0, 0x4
if-eq p0, v0, :cond_1
const/16 v0, 0x8
if-eq p0, v0, :cond_0
.line 61
const-string p0, "UNKNOWN"
return-object p0
.line 57
:cond_0
const-string p0, "ON_UNLOCKED"
return-object p0
.line 55
:cond_1
const-string p0, "ON_LOCKED"
return-object p0
.line 53
:cond_2
const-string p0, "OFF_LOCKED"
return-object p0
.line 59
:cond_3
const-string p0, "OFF_UNLOCKED"
return-object p0
.end method
# virtual methods
.method checkScreenState()I
.locals 1
.line 34
iget-object v0, p0, Lcom/android/nfc/ScreenStateHelper;->mPowerManager:Landroid/os/PowerManager;
invoke-virtual {v0}, Landroid/os/PowerManager;->isScreenOn()Z
move-result v0
if-nez v0, :cond_1
.line 35
iget-object v0, p0, Lcom/android/nfc/ScreenStateHelper;->mKeyguardManager:Landroid/app/KeyguardManager;
invoke-virtual {v0}, Landroid/app/KeyguardManager;->isKeyguardLocked()Z
move-result v0
if-eqz v0, :cond_0
.line 36
const/16 v0, 0x8
return v0
.line 38
:cond_0
const/16 v0, 0x8
return v0
.line 40
:cond_1
iget-object v0, p0, Lcom/android/nfc/ScreenStateHelper;->mKeyguardManager:Landroid/app/KeyguardManager;
invoke-virtual {v0}, Landroid/app/KeyguardManager;->isKeyguardLocked()Z
move-result v0
if-eqz v0, :cond_2
.line 41
const/16 v0, 0x8
return v0
.line 43
:cond_2
const/16 v0, 0x8
return v0
.end method