summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Pelly <npelly@google.com>2011-10-11 12:51:09 -0700
committerNick Pelly <npelly@google.com>2011-10-11 13:50:33 -0700
commit24d7b5f22ac98392f8b2d2c94560173e44d1ca6c (patch)
treef57c009ff706d183bc6b6741208237807c2c484d
parent9e076a61e5daacd4c846b8dc362d89f053054703 (diff)
downloadframeworks_base-24d7b5f22ac98392f8b2d2c94560173e44d1ca6c.zip
frameworks_base-24d7b5f22ac98392f8b2d2c94560173e44d1ca6c.tar.gz
frameworks_base-24d7b5f22ac98392f8b2d2c94560173e44d1ca6c.tar.bz2
Send ACTION_USER_PRESENT when provisioning is completed.
This is needed for application to know when the keyguard becomes unlocked, because isKeyguardLocked() is typically true while provisioning (setup wizard), but ACTION_USER_PRSENT was not sent when it transitions to false after provisioning. Bug: 5436867 Bug: 5430833 Change-Id: Icae13ff9cab84774a002a426eb9cb353fa1dc530
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java4
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java33
-rw-r--r--policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java5
-rw-r--r--policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java2
4 files changed, 39 insertions, 5 deletions
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java b/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java
index 24dce1a..86807ad 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardStatusViewManager.java
@@ -606,6 +606,10 @@ class KeyguardStatusViewManager implements OnClickListener {
public void onClockVisibilityChanged() {
// ignored
}
+
+ public void onDeviceProvisioned() {
+ // ignored
+ }
};
private SimStateCallback mSimStateCallback = new SimStateCallback() {
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
index 10cf3aa..303a3b5 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardUpdateMonitor.java
@@ -99,6 +99,7 @@ public class KeyguardUpdateMonitor {
private static final int MSG_RINGER_MODE_CHANGED = 305;
private static final int MSG_PHONE_STATE_CHANGED = 306;
private static final int MSG_CLOCK_VISIBILITY_CHANGED = 307;
+ private static final int MSG_DEVICE_PROVISIONED = 308;
/**
* When we receive a
@@ -178,6 +179,9 @@ public class KeyguardUpdateMonitor {
case MSG_CLOCK_VISIBILITY_CHANGED:
handleClockVisibilityChanged();
break;
+ case MSG_DEVICE_PROVISIONED:
+ handleDeviceProvisioned();
+ break;
}
}
};
@@ -197,10 +201,8 @@ public class KeyguardUpdateMonitor {
super.onChange(selfChange);
mDeviceProvisioned = Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.DEVICE_PROVISIONED, 0) != 0;
- if (mDeviceProvisioned && mContentObserver != null) {
- // We don't need the observer anymore...
- mContext.getContentResolver().unregisterContentObserver(mContentObserver);
- mContentObserver = null;
+ if (mDeviceProvisioned) {
+ mHandler.sendMessage(mHandler.obtainMessage(MSG_DEVICE_PROVISIONED));
}
if (DEBUG) Log.d(TAG, "DEVICE_PROVISIONED state = " + mDeviceProvisioned);
}
@@ -212,8 +214,14 @@ public class KeyguardUpdateMonitor {
// prevent a race condition between where we check the flag and where we register the
// observer by grabbing the value once again...
- mDeviceProvisioned = Settings.Secure.getInt(mContext.getContentResolver(),
+ boolean provisioned = Settings.Secure.getInt(mContext.getContentResolver(),
Settings.Secure.DEVICE_PROVISIONED, 0) != 0;
+ if (provisioned != mDeviceProvisioned) {
+ mDeviceProvisioned = provisioned;
+ if (mDeviceProvisioned) {
+ mHandler.sendMessage(mHandler.obtainMessage(MSG_DEVICE_PROVISIONED));
+ }
+ }
}
// take a guess to start
@@ -271,6 +279,17 @@ public class KeyguardUpdateMonitor {
}, filter);
}
+ protected void handleDeviceProvisioned() {
+ for (int i = 0; i < mInfoCallbacks.size(); i++) {
+ mInfoCallbacks.get(i).onDeviceProvisioned();
+ }
+ if (mContentObserver != null) {
+ // We don't need the observer anymore...
+ mContext.getContentResolver().unregisterContentObserver(mContentObserver);
+ mContentObserver = null;
+ }
+ }
+
protected void handlePhoneStateChanged(String newState) {
if (DEBUG) Log.d(TAG, "handlePhoneStateChanged(" + newState + ")");
if (TelephonyManager.EXTRA_STATE_IDLE.equals(newState)) {
@@ -477,6 +496,10 @@ public class KeyguardUpdateMonitor {
*/
void onClockVisibilityChanged();
+ /**
+ * Called when the device becomes provisioned
+ */
+ void onDeviceProvisioned();
}
/**
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
index c25e3ca..f1b6ef9 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -1323,4 +1323,9 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
public void onTimeChanged() {
// ignored
}
+
+ /** {@inheritDoc} */
+ public void onDeviceProvisioned() {
+ mContext.sendBroadcast(mUserPresentIntent);
+ }
}
diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
index 071044e..65cdd32 100644
--- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
+++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java
@@ -615,6 +615,8 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
public void onRingerModeChanged(int state) {}
@Override
public void onClockVisibilityChanged() {}
+ @Override
+ public void onDeviceProvisioned() {}
//We need to stop faceunlock when a phonecall comes in
@Override