Search in sources :

Example 1 with KeyguardDisplayManager

use of com.android.keyguard.KeyguardDisplayManager in project platform_frameworks_base by android.

the class KeyguardViewMediator method setupLocked.

private void setupLocked() {
    mPM = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
    mWM = WindowManagerGlobal.getWindowManagerService();
    mTrustManager = (TrustManager) mContext.getSystemService(Context.TRUST_SERVICE);
    mShowKeyguardWakeLock = mPM.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "show keyguard");
    mShowKeyguardWakeLock.setReferenceCounted(false);
    mContext.registerReceiver(mBroadcastReceiver, new IntentFilter(DELAYED_KEYGUARD_ACTION));
    mContext.registerReceiver(mBroadcastReceiver, new IntentFilter(DELAYED_LOCK_PROFILE_ACTION));
    mKeyguardDisplayManager = new KeyguardDisplayManager(mContext);
    mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
    mUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
    mLockPatternUtils = new LockPatternUtils(mContext);
    KeyguardUpdateMonitor.setCurrentUser(ActivityManager.getCurrentUser());
    // Assume keyguard is showing (unless it's disabled) until we know for sure...
    setShowingLocked(!shouldWaitForProvisioning() && !mLockPatternUtils.isLockScreenDisabled(KeyguardUpdateMonitor.getCurrentUser()));
    updateInputRestrictedLocked();
    mTrustManager.reportKeyguardShowingChanged();
    mStatusBarKeyguardViewManager = SystemUIFactory.getInstance().createStatusBarKeyguardViewManager(mContext, mViewMediatorCallback, mLockPatternUtils);
    final ContentResolver cr = mContext.getContentResolver();
    mDeviceInteractive = mPM.isInteractive();
    mLockSounds = new SoundPool(1, AudioManager.STREAM_SYSTEM, 0);
    String soundPath = Settings.Global.getString(cr, Settings.Global.LOCK_SOUND);
    if (soundPath != null) {
        mLockSoundId = mLockSounds.load(soundPath, 1);
    }
    if (soundPath == null || mLockSoundId == 0) {
        Log.w(TAG, "failed to load lock sound from " + soundPath);
    }
    soundPath = Settings.Global.getString(cr, Settings.Global.UNLOCK_SOUND);
    if (soundPath != null) {
        mUnlockSoundId = mLockSounds.load(soundPath, 1);
    }
    if (soundPath == null || mUnlockSoundId == 0) {
        Log.w(TAG, "failed to load unlock sound from " + soundPath);
    }
    soundPath = Settings.Global.getString(cr, Settings.Global.TRUSTED_SOUND);
    if (soundPath != null) {
        mTrustedSoundId = mLockSounds.load(soundPath, 1);
    }
    if (soundPath == null || mTrustedSoundId == 0) {
        Log.w(TAG, "failed to load trusted sound from " + soundPath);
    }
    int lockSoundDefaultAttenuation = mContext.getResources().getInteger(com.android.internal.R.integer.config_lockSoundVolumeDb);
    mLockSoundVolume = (float) Math.pow(10, (float) lockSoundDefaultAttenuation / 20);
    mHideAnimation = AnimationUtils.loadAnimation(mContext, com.android.internal.R.anim.lock_screen_behind_enter);
}
Also used : IntentFilter(android.content.IntentFilter) KeyguardDisplayManager(com.android.keyguard.KeyguardDisplayManager) LockPatternUtils(com.android.internal.widget.LockPatternUtils) SoundPool(android.media.SoundPool) ContentResolver(android.content.ContentResolver)

Example 2 with KeyguardDisplayManager

use of com.android.keyguard.KeyguardDisplayManager in project android_frameworks_base by ResurrectionRemix.

the class KeyguardViewMediator method setupLocked.

private void setupLocked() {
    mPM = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
    mWM = WindowManagerGlobal.getWindowManagerService();
    mTrustManager = (TrustManager) mContext.getSystemService(Context.TRUST_SERVICE);
    mShowKeyguardWakeLock = mPM.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "show keyguard");
    mShowKeyguardWakeLock.setReferenceCounted(false);
    mProfileManager = ProfileManager.getInstance(mContext);
    IntentFilter filter = new IntentFilter();
    filter.addAction(DELAYED_KEYGUARD_ACTION);
    filter.addAction(DELAYED_LOCK_PROFILE_ACTION);
    filter.addAction(Intent.ACTION_SHUTDOWN);
    mContext.registerReceiver(mBroadcastReceiver, filter);
    mKeyguardDisplayManager = new KeyguardDisplayManager(mContext);
    mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
    mUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
    mLockPatternUtils = new LockPatternUtils(mContext);
    KeyguardUpdateMonitor.setCurrentUser(ActivityManager.getCurrentUser());
    // Assume keyguard is showing (unless it's disabled) until we know for sure...
    setShowingLocked(!shouldWaitForProvisioning() && !mLockPatternUtils.isLockScreenDisabled(KeyguardUpdateMonitor.getCurrentUser()));
    updateInputRestrictedLocked();
    mTrustManager.reportKeyguardShowingChanged();
    mStatusBarKeyguardViewManager = SystemUIFactory.getInstance().createStatusBarKeyguardViewManager(mContext, mViewMediatorCallback, mLockPatternUtils);
    final ContentResolver cr = mContext.getContentResolver();
    mDeviceInteractive = mPM.isInteractive();
    mLockSounds = new SoundPool(1, AudioManager.STREAM_SYSTEM, 0);
    String soundPath = Settings.Global.getString(cr, Settings.Global.LOCK_SOUND);
    if (soundPath != null) {
        mLockSoundId = mLockSounds.load(soundPath, 1);
    }
    if (soundPath == null || mLockSoundId == 0) {
        Log.w(TAG, "failed to load lock sound from " + soundPath);
    }
    soundPath = Settings.Global.getString(cr, Settings.Global.UNLOCK_SOUND);
    if (soundPath != null) {
        mUnlockSoundId = mLockSounds.load(soundPath, 1);
    }
    if (soundPath == null || mUnlockSoundId == 0) {
        Log.w(TAG, "failed to load unlock sound from " + soundPath);
    }
    soundPath = Settings.Global.getString(cr, Settings.Global.TRUSTED_SOUND);
    if (soundPath != null) {
        mTrustedSoundId = mLockSounds.load(soundPath, 1);
    }
    if (soundPath == null || mTrustedSoundId == 0) {
        Log.w(TAG, "failed to load trusted sound from " + soundPath);
    }
    int lockSoundDefaultAttenuation = mContext.getResources().getInteger(com.android.internal.R.integer.config_lockSoundVolumeDb);
    mLockSoundVolume = (float) Math.pow(10, (float) lockSoundDefaultAttenuation / 20);
    mHideAnimation = AnimationUtils.loadAnimation(mContext, com.android.internal.R.anim.lock_screen_behind_enter);
}
Also used : IntentFilter(android.content.IntentFilter) KeyguardDisplayManager(com.android.keyguard.KeyguardDisplayManager) LockPatternUtils(com.android.internal.widget.LockPatternUtils) SoundPool(android.media.SoundPool) ContentResolver(android.content.ContentResolver)

Example 3 with KeyguardDisplayManager

use of com.android.keyguard.KeyguardDisplayManager in project android_frameworks_base by crdroidandroid.

the class KeyguardViewMediator method setupLocked.

private void setupLocked() {
    mPM = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
    mWM = WindowManagerGlobal.getWindowManagerService();
    mTrustManager = (TrustManager) mContext.getSystemService(Context.TRUST_SERVICE);
    mShowKeyguardWakeLock = mPM.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "show keyguard");
    mShowKeyguardWakeLock.setReferenceCounted(false);
    mProfileManager = ProfileManager.getInstance(mContext);
    IntentFilter filter = new IntentFilter();
    filter.addAction(DELAYED_KEYGUARD_ACTION);
    filter.addAction(DELAYED_LOCK_PROFILE_ACTION);
    filter.addAction(Intent.ACTION_SHUTDOWN);
    mContext.registerReceiver(mBroadcastReceiver, filter);
    mKeyguardDisplayManager = new KeyguardDisplayManager(mContext);
    mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
    mUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
    mLockPatternUtils = new LockPatternUtils(mContext);
    KeyguardUpdateMonitor.setCurrentUser(ActivityManager.getCurrentUser());
    // Assume keyguard is showing (unless it's disabled) until we know for sure...
    setShowingLocked(!shouldWaitForProvisioning() && !mLockPatternUtils.isLockScreenDisabled(KeyguardUpdateMonitor.getCurrentUser()));
    updateInputRestrictedLocked();
    mTrustManager.reportKeyguardShowingChanged();
    mStatusBarKeyguardViewManager = SystemUIFactory.getInstance().createStatusBarKeyguardViewManager(mContext, mViewMediatorCallback, mLockPatternUtils);
    final ContentResolver cr = mContext.getContentResolver();
    mDeviceInteractive = mPM.isInteractive();
    mLockSounds = new SoundPool(1, AudioManager.STREAM_SYSTEM, 0);
    String soundPath = Settings.Global.getString(cr, Settings.Global.LOCK_SOUND);
    if (soundPath != null) {
        mLockSoundId = mLockSounds.load(soundPath, 1);
    }
    if (soundPath == null || mLockSoundId == 0) {
        Log.w(TAG, "failed to load lock sound from " + soundPath);
    }
    soundPath = Settings.Global.getString(cr, Settings.Global.UNLOCK_SOUND);
    if (soundPath != null) {
        mUnlockSoundId = mLockSounds.load(soundPath, 1);
    }
    if (soundPath == null || mUnlockSoundId == 0) {
        Log.w(TAG, "failed to load unlock sound from " + soundPath);
    }
    soundPath = Settings.Global.getString(cr, Settings.Global.TRUSTED_SOUND);
    if (soundPath != null) {
        mTrustedSoundId = mLockSounds.load(soundPath, 1);
    }
    if (soundPath == null || mTrustedSoundId == 0) {
        Log.w(TAG, "failed to load trusted sound from " + soundPath);
    }
    int lockSoundDefaultAttenuation = mContext.getResources().getInteger(com.android.internal.R.integer.config_lockSoundVolumeDb);
    mLockSoundVolume = (float) Math.pow(10, (float) lockSoundDefaultAttenuation / 20);
    mHideAnimation = AnimationUtils.loadAnimation(mContext, com.android.internal.R.anim.lock_screen_behind_enter);
}
Also used : IntentFilter(android.content.IntentFilter) KeyguardDisplayManager(com.android.keyguard.KeyguardDisplayManager) LockPatternUtils(com.android.internal.widget.LockPatternUtils) SoundPool(android.media.SoundPool) ContentResolver(android.content.ContentResolver)

Example 4 with KeyguardDisplayManager

use of com.android.keyguard.KeyguardDisplayManager in project android_frameworks_base by AOSPA.

the class KeyguardViewMediator method setupLocked.

private void setupLocked() {
    mPM = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
    mWM = WindowManagerGlobal.getWindowManagerService();
    mTrustManager = (TrustManager) mContext.getSystemService(Context.TRUST_SERVICE);
    mShowKeyguardWakeLock = mPM.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "show keyguard");
    mShowKeyguardWakeLock.setReferenceCounted(false);
    IntentFilter filter = new IntentFilter();
    filter.addAction(DELAYED_KEYGUARD_ACTION);
    filter.addAction(DELAYED_LOCK_PROFILE_ACTION);
    filter.addAction(Intent.ACTION_SHUTDOWN);
    mContext.registerReceiver(mBroadcastReceiver, filter);
    mKeyguardDisplayManager = new KeyguardDisplayManager(mContext);
    mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
    mUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
    mLockPatternUtils = new LockPatternUtils(mContext);
    KeyguardUpdateMonitor.setCurrentUser(ActivityManager.getCurrentUser());
    // Assume keyguard is showing (unless it's disabled) until we know for sure...
    setShowingLocked(!shouldWaitForProvisioning() && !mLockPatternUtils.isLockScreenDisabled(KeyguardUpdateMonitor.getCurrentUser()));
    updateInputRestrictedLocked();
    mTrustManager.reportKeyguardShowingChanged();
    mStatusBarKeyguardViewManager = SystemUIFactory.getInstance().createStatusBarKeyguardViewManager(mContext, mViewMediatorCallback, mLockPatternUtils);
    final ContentResolver cr = mContext.getContentResolver();
    mDeviceInteractive = mPM.isInteractive();
    mLockSounds = new SoundPool(1, AudioManager.STREAM_SYSTEM, 0);
    String soundPath = Settings.Global.getString(cr, Settings.Global.LOCK_SOUND);
    if (soundPath != null) {
        mLockSoundId = mLockSounds.load(soundPath, 1);
    }
    if (soundPath == null || mLockSoundId == 0) {
        Log.w(TAG, "failed to load lock sound from " + soundPath);
    }
    soundPath = Settings.Global.getString(cr, Settings.Global.UNLOCK_SOUND);
    if (soundPath != null) {
        mUnlockSoundId = mLockSounds.load(soundPath, 1);
    }
    if (soundPath == null || mUnlockSoundId == 0) {
        Log.w(TAG, "failed to load unlock sound from " + soundPath);
    }
    soundPath = Settings.Global.getString(cr, Settings.Global.TRUSTED_SOUND);
    if (soundPath != null) {
        mTrustedSoundId = mLockSounds.load(soundPath, 1);
    }
    if (soundPath == null || mTrustedSoundId == 0) {
        Log.w(TAG, "failed to load trusted sound from " + soundPath);
    }
    int lockSoundDefaultAttenuation = mContext.getResources().getInteger(com.android.internal.R.integer.config_lockSoundVolumeDb);
    mLockSoundVolume = (float) Math.pow(10, (float) lockSoundDefaultAttenuation / 20);
    mHideAnimation = AnimationUtils.loadAnimation(mContext, com.android.internal.R.anim.lock_screen_behind_enter);
}
Also used : IntentFilter(android.content.IntentFilter) KeyguardDisplayManager(com.android.keyguard.KeyguardDisplayManager) LockPatternUtils(com.android.internal.widget.LockPatternUtils) SoundPool(android.media.SoundPool) ContentResolver(android.content.ContentResolver)

Example 5 with KeyguardDisplayManager

use of com.android.keyguard.KeyguardDisplayManager in project android_frameworks_base by DirtyUnicorns.

the class KeyguardViewMediator method setupLocked.

private void setupLocked() {
    mPM = (PowerManager) mContext.getSystemService(Context.POWER_SERVICE);
    mWM = WindowManagerGlobal.getWindowManagerService();
    mTrustManager = (TrustManager) mContext.getSystemService(Context.TRUST_SERVICE);
    mShowKeyguardWakeLock = mPM.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "show keyguard");
    mShowKeyguardWakeLock.setReferenceCounted(false);
    IntentFilter filter = new IntentFilter();
    filter.addAction(DELAYED_KEYGUARD_ACTION);
    filter.addAction(DELAYED_LOCK_PROFILE_ACTION);
    filter.addAction(Intent.ACTION_SHUTDOWN);
    mContext.registerReceiver(mBroadcastReceiver, filter);
    mKeyguardDisplayManager = new KeyguardDisplayManager(mContext);
    mAlarmManager = (AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE);
    mUpdateMonitor = KeyguardUpdateMonitor.getInstance(mContext);
    mLockPatternUtils = new LockPatternUtils(mContext);
    KeyguardUpdateMonitor.setCurrentUser(ActivityManager.getCurrentUser());
    // Assume keyguard is showing (unless it's disabled) until we know for sure...
    setShowingLocked(!shouldWaitForProvisioning() && !mLockPatternUtils.isLockScreenDisabled(KeyguardUpdateMonitor.getCurrentUser()));
    updateInputRestrictedLocked();
    mTrustManager.reportKeyguardShowingChanged();
    mStatusBarKeyguardViewManager = SystemUIFactory.getInstance().createStatusBarKeyguardViewManager(mContext, mViewMediatorCallback, mLockPatternUtils);
    final ContentResolver cr = mContext.getContentResolver();
    mDeviceInteractive = mPM.isInteractive();
    mLockSounds = new SoundPool(1, AudioManager.STREAM_SYSTEM, 0);
    String soundPath = Settings.Global.getString(cr, Settings.Global.LOCK_SOUND);
    if (soundPath != null) {
        mLockSoundId = mLockSounds.load(soundPath, 1);
    }
    if (soundPath == null || mLockSoundId == 0) {
        Log.w(TAG, "failed to load lock sound from " + soundPath);
    }
    soundPath = Settings.Global.getString(cr, Settings.Global.UNLOCK_SOUND);
    if (soundPath != null) {
        mUnlockSoundId = mLockSounds.load(soundPath, 1);
    }
    if (soundPath == null || mUnlockSoundId == 0) {
        Log.w(TAG, "failed to load unlock sound from " + soundPath);
    }
    soundPath = Settings.Global.getString(cr, Settings.Global.TRUSTED_SOUND);
    if (soundPath != null) {
        mTrustedSoundId = mLockSounds.load(soundPath, 1);
    }
    if (soundPath == null || mTrustedSoundId == 0) {
        Log.w(TAG, "failed to load trusted sound from " + soundPath);
    }
    int lockSoundDefaultAttenuation = mContext.getResources().getInteger(com.android.internal.R.integer.config_lockSoundVolumeDb);
    mLockSoundVolume = (float) Math.pow(10, (float) lockSoundDefaultAttenuation / 20);
    mHideAnimation = AnimationUtils.loadAnimation(mContext, com.android.internal.R.anim.lock_screen_behind_enter);
}
Also used : IntentFilter(android.content.IntentFilter) KeyguardDisplayManager(com.android.keyguard.KeyguardDisplayManager) LockPatternUtils(com.android.internal.widget.LockPatternUtils) SoundPool(android.media.SoundPool) ContentResolver(android.content.ContentResolver)

Aggregations

ContentResolver (android.content.ContentResolver)5 IntentFilter (android.content.IntentFilter)5 SoundPool (android.media.SoundPool)5 LockPatternUtils (com.android.internal.widget.LockPatternUtils)5 KeyguardDisplayManager (com.android.keyguard.KeyguardDisplayManager)5