Search in sources :

Example 1 with KeyguardManager

use of android.app.KeyguardManager in project AndroidTraining by mixi-inc.

the class DefaultModule method configure.

@SuppressWarnings("unchecked")
protected void configure() {
    bind(Application.class).toProvider(ApplicationProvider.class).in(ApplicationScoped.class);
    bind(Context.class).toProvider(ContextProvider.class);
    bind(Handler.class).toProvider(HandlerProvider.class).in(ApplicationScoped.class);
    bind(ActivityManager.class).toProvider(new SystemServiceProvider<ActivityManager>(Context.ACTIVITY_SERVICE));
    bind(AlarmManager.class).toProvider(new SystemServiceProvider<AlarmManager>(Context.ALARM_SERVICE));
    bind(AudioManager.class).toProvider(new SystemServiceProvider<AudioManager>(Context.AUDIO_SERVICE));
    bind(ConnectivityManager.class).toProvider(new SystemServiceProvider<ConnectivityManager>(Context.CONNECTIVITY_SERVICE));
    bind(InputMethodManager.class).toProvider(new SystemServiceProvider<InputMethodManager>(Context.INPUT_METHOD_SERVICE));
    bind(KeyguardManager.class).toProvider(new SystemServiceProvider<KeyguardManager>(Context.KEYGUARD_SERVICE));
    bind(LocationManager.class).toProvider(new SystemServiceProvider<LocationManager>(Context.LOCATION_SERVICE));
    bind(NotificationManager.class).toProvider(new SystemServiceProvider<NotificationManager>(Context.NOTIFICATION_SERVICE));
    bind(PowerManager.class).toProvider(new SystemServiceProvider<PowerManager>(Context.POWER_SERVICE));
    bind(SensorManager.class).toProvider(new SystemServiceProvider<SensorManager>(Context.SENSOR_SERVICE));
    bind(TelephonyManager.class).toProvider(new SystemServiceProvider<TelephonyManager>(Context.TELEPHONY_SERVICE));
    bind(Vibrator.class).toProvider(new SystemServiceProvider<Vibrator>(Context.VIBRATOR_SERVICE));
    bind(WifiManager.class).toProvider(new SystemServiceProvider<WifiManager>(Context.WIFI_SERVICE));
    bind(WindowManager.class).toProvider(new SystemServiceProvider<WindowManager>(Context.WINDOW_SERVICE));
    bind(mAccountManagerClass).toProvider(AccountManagerProvider.class);
    bind(ObserverManager.class);
    bindProviderListener(new ObserverRegister());
    bind(StateManager.class).in(ApplicationScoped.class);
    bind(StateEventObserver.class);
    bindFieldListener(RetainState.class, new RetainStateListener());
}
Also used : WifiManager(android.net.wifi.WifiManager) ConnectivityManager(android.net.ConnectivityManager) InputMethodManager(android.view.inputmethod.InputMethodManager) ActivityManager(android.app.ActivityManager) WindowManager(android.view.WindowManager) PowerManager(android.os.PowerManager) AudioManager(android.media.AudioManager) StateManager(proton.inject.state.StateManager) TelephonyManager(android.telephony.TelephonyManager) Context(android.content.Context) LocationManager(android.location.LocationManager) ApplicationProvider(proton.inject.provider.ApplicationProvider) NotificationManager(android.app.NotificationManager) HandlerProvider(proton.inject.provider.HandlerProvider) RetainStateListener(proton.inject.state.RetainStateListener) SensorManager(android.hardware.SensorManager) AlarmManager(android.app.AlarmManager) Vibrator(android.os.Vibrator) KeyguardManager(android.app.KeyguardManager) ObserverRegister(proton.inject.observer.ObserverRegister)

Example 2 with KeyguardManager

use of android.app.KeyguardManager in project android_frameworks_base by ParanoidAndroid.

the class LockScreenButton method applyState.

private void applyState(Context context) {
    if (mLock == null) {
        KeyguardManager keyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
        mLock = keyguardManager.newKeyguardLock("PowerWidget");
    }
    if (mDisabledLockscreen) {
        mLock.disableKeyguard();
    } else {
        mLock.reenableKeyguard();
    }
}
Also used : KeyguardManager(android.app.KeyguardManager)

Example 3 with KeyguardManager

use of android.app.KeyguardManager in project android_frameworks_base by ParanoidAndroid.

the class ImfBaseTestCase method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    final String packageName = getInstrumentation().getTargetContext().getPackageName();
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
    mTargetActivity = launchActivityWithIntent(packageName, mTargetActivityClass, intent);
    // expect ime to auto pop up if device has no hard keyboard
    int keyboardType = mTargetActivity.getResources().getConfiguration().keyboard;
    mExpectAutoPop = (keyboardType == Configuration.KEYBOARD_NOKEYS || keyboardType == Configuration.KEYBOARD_UNDEFINED);
    mImm = InputMethodManager.getInstance();
    KeyguardManager keyguardManager = (KeyguardManager) getInstrumentation().getContext().getSystemService(Context.KEYGUARD_SERVICE);
    keyguardManager.newKeyguardLock("imftest").disableKeyguard();
}
Also used : Intent(android.content.Intent) KeyguardManager(android.app.KeyguardManager)

Example 4 with KeyguardManager

use of android.app.KeyguardManager in project android_frameworks_base by ResurrectionRemix.

the class ActivityStarter method showConfirmDeviceCredential.

void showConfirmDeviceCredential(int userId) {
    // First, retrieve the stack that we want to resume after credential is confirmed.
    ActivityStack targetStack;
    ActivityStack fullscreenStack = mSupervisor.getStack(FULLSCREEN_WORKSPACE_STACK_ID);
    ActivityStack freeformStack = mSupervisor.getStack(FREEFORM_WORKSPACE_STACK_ID);
    if (fullscreenStack != null && fullscreenStack.getStackVisibilityLocked(null) != ActivityStack.STACK_INVISIBLE) {
        // Single window case and the case that the docked stack is shown with fullscreen stack.
        targetStack = fullscreenStack;
    } else if (freeformStack != null && freeformStack.getStackVisibilityLocked(null) != ActivityStack.STACK_INVISIBLE) {
        targetStack = freeformStack;
    } else {
        // The case that the docked stack is shown with recent.
        targetStack = mSupervisor.getStack(HOME_STACK_ID);
    }
    if (targetStack == null) {
        return;
    }
    final KeyguardManager km = (KeyguardManager) mService.mContext.getSystemService(Context.KEYGUARD_SERVICE);
    final Intent credential = km.createConfirmDeviceCredentialIntent(null, null, userId);
    // For safety, check null here in case users changed the setting after the checking.
    if (credential == null) {
        return;
    }
    final ActivityRecord activityRecord = targetStack.topRunningActivityLocked();
    if (activityRecord != null) {
        final IIntentSender target = mService.getIntentSenderLocked(ActivityManager.INTENT_SENDER_ACTIVITY, activityRecord.launchedFromPackage, activityRecord.launchedFromUid, activityRecord.userId, null, null, 0, new Intent[] { activityRecord.intent }, new String[] { activityRecord.resolvedType }, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE, null);
        credential.putExtra(Intent.EXTRA_INTENT, new IntentSender(target));
        // Show confirm credentials activity.
        startConfirmCredentialIntent(credential);
    }
}
Also used : IIntentSender(android.content.IIntentSender) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) IntentSender(android.content.IntentSender) IIntentSender(android.content.IIntentSender) KeyguardManager(android.app.KeyguardManager)

Example 5 with KeyguardManager

use of android.app.KeyguardManager in project android_frameworks_base by ResurrectionRemix.

the class ImfBaseTestCase method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    final String packageName = getInstrumentation().getTargetContext().getPackageName();
    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
    mTargetActivity = launchActivityWithIntent(packageName, mTargetActivityClass, intent);
    // expect ime to auto pop up if device has no hard keyboard
    int keyboardType = mTargetActivity.getResources().getConfiguration().keyboard;
    mExpectAutoPop = (keyboardType == Configuration.KEYBOARD_NOKEYS || keyboardType == Configuration.KEYBOARD_UNDEFINED);
    mImm = InputMethodManager.getInstance();
    KeyguardManager keyguardManager = (KeyguardManager) getInstrumentation().getContext().getSystemService(Context.KEYGUARD_SERVICE);
    keyguardManager.newKeyguardLock("imftest").disableKeyguard();
}
Also used : Intent(android.content.Intent) KeyguardManager(android.app.KeyguardManager)

Aggregations

KeyguardManager (android.app.KeyguardManager)97 Intent (android.content.Intent)46 PendingIntent (android.app.PendingIntent)18 PowerManager (android.os.PowerManager)18 Context (android.content.Context)12 SuppressLint (android.annotation.SuppressLint)10 IIntentSender (android.content.IIntentSender)10 IntentSender (android.content.IntentSender)10 FingerprintManager (android.hardware.fingerprint.FingerprintManager)7 Resources (android.content.res.Resources)5 TelephonyManager (android.telephony.TelephonyManager)5 TargetApi (android.annotation.TargetApi)4 RemoteException (android.os.RemoteException)4 Activity (android.app.Activity)3 NotificationManager (android.app.NotificationManager)3 Bitmap (android.graphics.Bitmap)3 ConnectivityManager (android.net.ConnectivityManager)3 Bundle (android.os.Bundle)3 DialogFragment (android.app.DialogFragment)2 Notification (android.app.Notification)2