Loading core/java/com/android/internal/widget/LockPatternUtils.java +0 −3 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; Loading Loading @@ -54,8 +53,6 @@ import java.util.List; */ public class LockPatternUtils { private static final String OPTION_ENABLE_FACELOCK = "enable_facelock"; private static final String TAG = "LockPatternUtils"; /** Loading policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java +12 −3 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.os.Parcelable; import android.os.SystemClock; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; import android.util.AttributeSet; import android.util.Log; import android.util.Slog; Loading Loading @@ -101,6 +102,8 @@ public class KeyguardHostView extends KeyguardViewBase { private boolean mSafeModeEnabled; private boolean mUserSetupCompleted; /*package*/ interface TransportCallback { void onListenerDetached(); void onListenerAttached(); Loading Loading @@ -143,6 +146,8 @@ public class KeyguardHostView extends KeyguardViewBase { } mSafeModeEnabled = LockPatternUtils.isSafeModeEnabled(); mUserSetupCompleted = Settings.Secure.getIntForUser(mContext.getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 0, UserHandle.USER_CURRENT) != 0; if (mSafeModeEnabled) { Log.v(TAG, "Keyguard widgets disabled by safe mode"); Loading Loading @@ -270,7 +275,7 @@ public class KeyguardHostView extends KeyguardViewBase { addDefaultWidgets(); addWidgetsFromSettings(); if (numWidgets() >= MAX_WIDGETS) { if (!shouldEnableAddWidget()) { mAppWidgetContainer.setAddWidgetEnabled(false); } checkAppWidgetConsistency(); Loading @@ -282,6 +287,10 @@ public class KeyguardHostView extends KeyguardViewBase { updateSecurityViews(); } private boolean shouldEnableAddWidget() { return numWidgets() < MAX_WIDGETS && mUserSetupCompleted; } private int getDisabledFeatures(DevicePolicyManager dpm) { int disabledFeatures = DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_NONE; if (dpm != null) { Loading Loading @@ -364,7 +373,7 @@ public class KeyguardHostView extends KeyguardViewBase { @Override public void onAddView(View v) { if (numWidgets() >= MAX_WIDGETS) { if (!shouldEnableAddWidget()) { mAppWidgetContainer.setAddWidgetEnabled(false); } } Loading @@ -382,7 +391,7 @@ public class KeyguardHostView extends KeyguardViewBase { @Override public void onRemoveViewAnimationCompleted() { if (numWidgets() < MAX_WIDGETS) { if (shouldEnableAddWidget()) { mAppWidgetContainer.setAddWidgetEnabled(true); } } Loading policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java +15 −13 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import android.os.Handler; import android.os.IRemoteCallback; import android.os.Message; import android.os.RemoteException; import android.os.UserHandle; import android.provider.Settings; import com.android.internal.telephony.IccCardConstants; Loading Loading @@ -113,7 +114,7 @@ public class KeyguardUpdateMonitor { private final ArrayList<WeakReference<KeyguardUpdateMonitorCallback>> mCallbacks = Lists.newArrayList(); private ContentObserver mContentObserver; private ContentObserver mDeviceProvisionedObserver; private final Handler mHandler = new Handler() { @Override Loading Loading @@ -322,9 +323,7 @@ public class KeyguardUpdateMonitor { private KeyguardUpdateMonitor(Context context) { mContext = context; mDeviceProvisioned = Settings.Global.getInt( mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0) != 0; mDeviceProvisioned = isDeviceProvisionedInSettingsDb(); // Since device can't be un-provisioned, we only need to register a content observer // to update mDeviceProvisioned when we are... if (!mDeviceProvisioned) { Loading Loading @@ -373,13 +372,17 @@ public class KeyguardUpdateMonitor { } } private boolean isDeviceProvisionedInSettingsDb() { return Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0) != 0; } private void watchForDeviceProvisioning() { mContentObserver = new ContentObserver(mHandler) { mDeviceProvisionedObserver = new ContentObserver(mHandler) { @Override public void onChange(boolean selfChange) { super.onChange(selfChange); mDeviceProvisioned = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0) != 0; mDeviceProvisioned = isDeviceProvisionedInSettingsDb(); if (mDeviceProvisioned) { mHandler.sendMessage(mHandler.obtainMessage(MSG_DEVICE_PROVISIONED)); } Loading @@ -389,12 +392,11 @@ public class KeyguardUpdateMonitor { mContext.getContentResolver().registerContentObserver( Settings.Global.getUriFor(Settings.Global.DEVICE_PROVISIONED), false, mContentObserver); false, mDeviceProvisionedObserver); // prevent a race condition between where we check the flag and where we register the // observer by grabbing the value once again... boolean provisioned = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0) != 0; boolean provisioned = isDeviceProvisionedInSettingsDb(); if (provisioned != mDeviceProvisioned) { mDeviceProvisioned = provisioned; if (mDeviceProvisioned) { Loading Loading @@ -475,10 +477,10 @@ public class KeyguardUpdateMonitor { cb.onDeviceProvisioned(); } } if (mContentObserver != null) { if (mDeviceProvisionedObserver != null) { // We don't need the observer anymore... mContext.getContentResolver().unregisterContentObserver(mContentObserver); mContentObserver = null; mContext.getContentResolver().unregisterContentObserver(mDeviceProvisionedObserver); mDeviceProvisionedObserver = null; } } Loading Loading
core/java/com/android/internal/widget/LockPatternUtils.java +0 −3 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.content.Context; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; import android.os.ServiceManager; Loading Loading @@ -54,8 +53,6 @@ import java.util.List; */ public class LockPatternUtils { private static final String OPTION_ENABLE_FACELOCK = "enable_facelock"; private static final String TAG = "LockPatternUtils"; /** Loading
policy/src/com/android/internal/policy/impl/keyguard/KeyguardHostView.java +12 −3 Original line number Diff line number Diff line Loading @@ -40,6 +40,7 @@ import android.os.Parcelable; import android.os.SystemClock; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; import android.util.AttributeSet; import android.util.Log; import android.util.Slog; Loading Loading @@ -101,6 +102,8 @@ public class KeyguardHostView extends KeyguardViewBase { private boolean mSafeModeEnabled; private boolean mUserSetupCompleted; /*package*/ interface TransportCallback { void onListenerDetached(); void onListenerAttached(); Loading Loading @@ -143,6 +146,8 @@ public class KeyguardHostView extends KeyguardViewBase { } mSafeModeEnabled = LockPatternUtils.isSafeModeEnabled(); mUserSetupCompleted = Settings.Secure.getIntForUser(mContext.getContentResolver(), Settings.Secure.USER_SETUP_COMPLETE, 0, UserHandle.USER_CURRENT) != 0; if (mSafeModeEnabled) { Log.v(TAG, "Keyguard widgets disabled by safe mode"); Loading Loading @@ -270,7 +275,7 @@ public class KeyguardHostView extends KeyguardViewBase { addDefaultWidgets(); addWidgetsFromSettings(); if (numWidgets() >= MAX_WIDGETS) { if (!shouldEnableAddWidget()) { mAppWidgetContainer.setAddWidgetEnabled(false); } checkAppWidgetConsistency(); Loading @@ -282,6 +287,10 @@ public class KeyguardHostView extends KeyguardViewBase { updateSecurityViews(); } private boolean shouldEnableAddWidget() { return numWidgets() < MAX_WIDGETS && mUserSetupCompleted; } private int getDisabledFeatures(DevicePolicyManager dpm) { int disabledFeatures = DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_NONE; if (dpm != null) { Loading Loading @@ -364,7 +373,7 @@ public class KeyguardHostView extends KeyguardViewBase { @Override public void onAddView(View v) { if (numWidgets() >= MAX_WIDGETS) { if (!shouldEnableAddWidget()) { mAppWidgetContainer.setAddWidgetEnabled(false); } } Loading @@ -382,7 +391,7 @@ public class KeyguardHostView extends KeyguardViewBase { @Override public void onRemoveViewAnimationCompleted() { if (numWidgets() < MAX_WIDGETS) { if (shouldEnableAddWidget()) { mAppWidgetContainer.setAddWidgetEnabled(true); } } Loading
policy/src/com/android/internal/policy/impl/keyguard/KeyguardUpdateMonitor.java +15 −13 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import android.os.Handler; import android.os.IRemoteCallback; import android.os.Message; import android.os.RemoteException; import android.os.UserHandle; import android.provider.Settings; import com.android.internal.telephony.IccCardConstants; Loading Loading @@ -113,7 +114,7 @@ public class KeyguardUpdateMonitor { private final ArrayList<WeakReference<KeyguardUpdateMonitorCallback>> mCallbacks = Lists.newArrayList(); private ContentObserver mContentObserver; private ContentObserver mDeviceProvisionedObserver; private final Handler mHandler = new Handler() { @Override Loading Loading @@ -322,9 +323,7 @@ public class KeyguardUpdateMonitor { private KeyguardUpdateMonitor(Context context) { mContext = context; mDeviceProvisioned = Settings.Global.getInt( mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0) != 0; mDeviceProvisioned = isDeviceProvisionedInSettingsDb(); // Since device can't be un-provisioned, we only need to register a content observer // to update mDeviceProvisioned when we are... if (!mDeviceProvisioned) { Loading Loading @@ -373,13 +372,17 @@ public class KeyguardUpdateMonitor { } } private boolean isDeviceProvisionedInSettingsDb() { return Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0) != 0; } private void watchForDeviceProvisioning() { mContentObserver = new ContentObserver(mHandler) { mDeviceProvisionedObserver = new ContentObserver(mHandler) { @Override public void onChange(boolean selfChange) { super.onChange(selfChange); mDeviceProvisioned = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0) != 0; mDeviceProvisioned = isDeviceProvisionedInSettingsDb(); if (mDeviceProvisioned) { mHandler.sendMessage(mHandler.obtainMessage(MSG_DEVICE_PROVISIONED)); } Loading @@ -389,12 +392,11 @@ public class KeyguardUpdateMonitor { mContext.getContentResolver().registerContentObserver( Settings.Global.getUriFor(Settings.Global.DEVICE_PROVISIONED), false, mContentObserver); false, mDeviceProvisionedObserver); // prevent a race condition between where we check the flag and where we register the // observer by grabbing the value once again... boolean provisioned = Settings.Global.getInt(mContext.getContentResolver(), Settings.Global.DEVICE_PROVISIONED, 0) != 0; boolean provisioned = isDeviceProvisionedInSettingsDb(); if (provisioned != mDeviceProvisioned) { mDeviceProvisioned = provisioned; if (mDeviceProvisioned) { Loading Loading @@ -475,10 +477,10 @@ public class KeyguardUpdateMonitor { cb.onDeviceProvisioned(); } } if (mContentObserver != null) { if (mDeviceProvisionedObserver != null) { // We don't need the observer anymore... mContext.getContentResolver().unregisterContentObserver(mContentObserver); mContentObserver = null; mContext.getContentResolver().unregisterContentObserver(mDeviceProvisionedObserver); mDeviceProvisionedObserver = null; } } Loading