Skip to content

Commit 19fa262

Browse files
Martijn CoenenAndroid (Google) Code Review
authored andcommitted
Merge "Send ACTION_USER_PRESENT when provisioning is completed." into ics-mr0
2 parents 97e9ea9 + 24d7b5f commit 19fa262

File tree

4 files changed

+39
-5
lines changed

4 files changed

+39
-5
lines changed

policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,10 @@ public void onPhoneStateChanged(int phoneState) {
609609
public void onClockVisibilityChanged() {
610610
// ignored
611611
}
612+
613+
public void onDeviceProvisioned() {
614+
// ignored
615+
}
612616
};
613617

614618
private SimStateCallback mSimStateCallback = new SimStateCallback() {

policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public class KeyguardUpdateMonitor {
9999
private static final int MSG_RINGER_MODE_CHANGED = 305;
100100
private static final int MSG_PHONE_STATE_CHANGED = 306;
101101
private static final int MSG_CLOCK_VISIBILITY_CHANGED = 307;
102+
private static final int MSG_DEVICE_PROVISIONED = 308;
102103

103104
/**
104105
* When we receive a
@@ -178,6 +179,9 @@ public void handleMessage(Message msg) {
178179
case MSG_CLOCK_VISIBILITY_CHANGED:
179180
handleClockVisibilityChanged();
180181
break;
182+
case MSG_DEVICE_PROVISIONED:
183+
handleDeviceProvisioned();
184+
break;
181185
}
182186
}
183187
};
@@ -197,10 +201,8 @@ public void onChange(boolean selfChange) {
197201
super.onChange(selfChange);
198202
mDeviceProvisioned = Settings.Secure.getInt(mContext.getContentResolver(),
199203
Settings.Secure.DEVICE_PROVISIONED, 0) != 0;
200-
if (mDeviceProvisioned && mContentObserver != null) {
201-
// We don't need the observer anymore...
202-
mContext.getContentResolver().unregisterContentObserver(mContentObserver);
203-
mContentObserver = null;
204+
if (mDeviceProvisioned) {
205+
mHandler.sendMessage(mHandler.obtainMessage(MSG_DEVICE_PROVISIONED));
204206
}
205207
if (DEBUG) Log.d(TAG, "DEVICE_PROVISIONED state = " + mDeviceProvisioned);
206208
}
@@ -212,8 +214,14 @@ public void onChange(boolean selfChange) {
212214

213215
// prevent a race condition between where we check the flag and where we register the
214216
// observer by grabbing the value once again...
215-
mDeviceProvisioned = Settings.Secure.getInt(mContext.getContentResolver(),
217+
boolean provisioned = Settings.Secure.getInt(mContext.getContentResolver(),
216218
Settings.Secure.DEVICE_PROVISIONED, 0) != 0;
219+
if (provisioned != mDeviceProvisioned) {
220+
mDeviceProvisioned = provisioned;
221+
if (mDeviceProvisioned) {
222+
mHandler.sendMessage(mHandler.obtainMessage(MSG_DEVICE_PROVISIONED));
223+
}
224+
}
217225
}
218226

219227
// take a guess to start
@@ -271,6 +279,17 @@ public void onReceive(Context context, Intent intent) {
271279
}, filter);
272280
}
273281

282+
protected void handleDeviceProvisioned() {
283+
for (int i = 0; i < mInfoCallbacks.size(); i++) {
284+
mInfoCallbacks.get(i).onDeviceProvisioned();
285+
}
286+
if (mContentObserver != null) {
287+
// We don't need the observer anymore...
288+
mContext.getContentResolver().unregisterContentObserver(mContentObserver);
289+
mContentObserver = null;
290+
}
291+
}
292+
274293
protected void handlePhoneStateChanged(String newState) {
275294
if (DEBUG) Log.d(TAG, "handlePhoneStateChanged(" + newState + ")");
276295
if (TelephonyManager.EXTRA_STATE_IDLE.equals(newState)) {
@@ -477,6 +496,10 @@ interface InfoCallback {
477496
*/
478497
void onClockVisibilityChanged();
479498

499+
/**
500+
* Called when the device becomes provisioned
501+
*/
502+
void onDeviceProvisioned();
480503
}
481504

482505
/**

policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,4 +1316,9 @@ public void onRingerModeChanged(int state) {
13161316
public void onTimeChanged() {
13171317
// ignored
13181318
}
1319+
1320+
/** {@inheritDoc} */
1321+
public void onDeviceProvisioned() {
1322+
mContext.sendBroadcast(mUserPresentIntent);
1323+
}
13191324
}

policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,8 @@ public void onRefreshCarrierInfo(CharSequence plmn, CharSequence spn) {}
649649
public void onRingerModeChanged(int state) {}
650650
@Override
651651
public void onClockVisibilityChanged() {}
652+
@Override
653+
public void onDeviceProvisioned() {}
652654

653655
//We need to stop faceunlock when a phonecall comes in
654656
@Override

0 commit comments

Comments
 (0)