summaryrefslogtreecommitdiffstats
path: root/policy
diff options
context:
space:
mode:
Diffstat (limited to 'policy')
-rw-r--r--policy/com/android/internal/policy/impl/KeyguardViewMediator.java48
1 files changed, 32 insertions, 16 deletions
diff --git a/policy/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/com/android/internal/policy/impl/KeyguardViewMediator.java
index 526dcbc..c255041 100644
--- a/policy/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -145,10 +145,15 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
private Context mContext;
private AlarmManager mAlarmManager;
private StatusBarManager mStatusBarManager;
+ private boolean mShowLockIcon = false;
private IBinder mSecureLockIcon = null;
private boolean mSystemReady;
- private boolean mFirstShow = true;
+
+ // Whether the next call to playSounds() should be skipped. Defaults to
+ // true because the first lock (on boot) should be silent.
+ private boolean mSuppressNextLockSound = true;
+
/** Low level access to the power manager for enableUserActivity. Having this
* requires that we run in the system process. */
@@ -279,6 +284,9 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
mUserPresentIntent = new Intent(Intent.ACTION_USER_PRESENT);
mUserPresentIntent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
+
+ final ContentResolver cr = mContext.getContentResolver();
+ mShowLockIcon = (Settings.System.getInt(cr, "show_status_bar_lock", 0) == 1);
}
/**
@@ -685,6 +693,10 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
+ sequence + ", mDelayedShowingSequence = " + mDelayedShowingSequence);
if (mDelayedShowingSequence == sequence) {
+ // Don't play lockscreen SFX if the screen went off due to
+ // timeout.
+ mSuppressNextLockSound = true;
+
doKeyguard();
}
} else if (TelephonyManager.ACTION_PHONE_STATE_CHANGED.equals(action)) {
@@ -922,6 +934,12 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
private void playSounds(boolean locked) {
// User feedback for keyguard.
+
+ if (mSuppressNextLockSound) {
+ mSuppressNextLockSound = false;
+ return;
+ }
+
final ContentResolver cr = mContext.getContentResolver();
if (Settings.System.getInt(cr, Settings.System.LOCKSCREEN_SOUNDS_ENABLED, 1) == 1)
{
@@ -957,11 +975,7 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
if (DEBUG) Log.d(TAG, "handleShow");
if (!mSystemReady) return;
- if (mFirstShow) {
- mFirstShow = false;
- } else {
- playSounds(true);
- }
+ playSounds(true);
mKeyguardViewManager.show();
mShowing = true;
@@ -1019,16 +1033,18 @@ public class KeyguardViewMediator implements KeyguardViewCallback,
if (mStatusBarManager == null) {
Log.w(TAG, "Could not get status bar manager");
} else {
- // Give feedback to user when secure keyguard is active and engaged
- if (mShowing && isSecure()) {
- if (mSecureLockIcon == null) {
- mSecureLockIcon = mStatusBarManager.addIcon("secure",
- com.android.internal.R.drawable.stat_sys_secure, 0);
- }
- } else {
- if (mSecureLockIcon != null) {
- mStatusBarManager.removeIcon(mSecureLockIcon);
- mSecureLockIcon = null;
+ if (mShowLockIcon) {
+ // Give feedback to user when secure keyguard is active and engaged
+ if (mShowing && isSecure()) {
+ if (mSecureLockIcon == null) {
+ mSecureLockIcon = mStatusBarManager.addIcon("secure",
+ com.android.internal.R.drawable.stat_sys_secure, 0);
+ }
+ } else {
+ if (mSecureLockIcon != null) {
+ mStatusBarManager.removeIcon(mSecureLockIcon);
+ mSecureLockIcon = null;
+ }
}
}