Search in sources :

Example 91 with LockPatternUtils

use of com.android.internal.widget.LockPatternUtils in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class InstalledAppDetails method getNotificationSummary.

public static CharSequence getNotificationSummary(AppRow appRow, Context context) {
    boolean showSlider = Settings.Secure.getInt(context.getContentResolver(), NOTIFICATION_TUNER_SETTING, 1) == 1;
    List<String> summaryAttributes = new ArrayList<>();
    StringBuffer summary = new StringBuffer();
    if (showSlider) {
        if (appRow.appImportance != Ranking.IMPORTANCE_UNSPECIFIED) {
            summaryAttributes.add(context.getString(R.string.notification_summary_level, importanceToLevel(appRow.appImportance)));
        }
    } else {
        if (appRow.banned) {
            summaryAttributes.add(context.getString(R.string.notifications_disabled));
        } else if (appRow.appImportance > Ranking.IMPORTANCE_NONE && appRow.appImportance < Ranking.IMPORTANCE_DEFAULT) {
            summaryAttributes.add(context.getString(R.string.notifications_silenced));
        }
    }
    final boolean lockscreenSecure = new LockPatternUtils(context).isSecure(UserHandle.myUserId());
    if (lockscreenSecure) {
        if (appRow.appVisOverride == Notification.VISIBILITY_PRIVATE) {
            summaryAttributes.add(context.getString(R.string.notifications_redacted));
        } else if (appRow.appVisOverride == Notification.VISIBILITY_SECRET) {
            summaryAttributes.add(context.getString(R.string.notifications_hidden));
        }
    }
    if (appRow.appBypassDnd) {
        summaryAttributes.add(context.getString(R.string.notifications_priority));
    }
    final int N = summaryAttributes.size();
    for (int i = 0; i < N; i++) {
        if (i > 0) {
            summary.append(context.getString(R.string.notifications_summary_divider));
        }
        summary.append(summaryAttributes.get(i));
    }
    return summary.toString();
}
Also used : ArrayList(java.util.ArrayList) LockPatternUtils(com.android.internal.widget.LockPatternUtils)

Example 92 with LockPatternUtils

use of com.android.internal.widget.LockPatternUtils in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ChooseLockSettingsHelperTest method getChooseLockSettingsHelper.

private ChooseLockSettingsHelper getChooseLockSettingsHelper(Activity mockActivity) {
    LockPatternUtils mockLockPatternUtils = mock(LockPatternUtils.class);
    when(mockLockPatternUtils.getKeyguardStoredPasswordQuality(anyInt())).thenReturn(DevicePolicyManager.PASSWORD_QUALITY_SOMETHING);
    ChooseLockSettingsHelper helper = new ChooseLockSettingsHelper(mockActivity);
    helper.mLockPatternUtils = mockLockPatternUtils;
    return helper;
}
Also used : LockPatternUtils(com.android.internal.widget.LockPatternUtils)

Example 93 with LockPatternUtils

use of com.android.internal.widget.LockPatternUtils in project android_frameworks_base by crdroidandroid.

the class KeyguardAbsKeyInputView method onFinishInflate.

@Override
protected void onFinishInflate() {
    mLockPatternUtils = new LockPatternUtils(mContext);
    mSecurityMessageDisplay = KeyguardMessageArea.findSecurityMessageDisplay(this);
    mEcaView = findViewById(R.id.keyguard_selector_fade_container);
    mMaxCountdownTimes = mContext.getResources().getInteger(R.integer.config_max_unlock_countdown_times);
    EmergencyButton button = (EmergencyButton) findViewById(R.id.emergency_call_button);
    if (button != null) {
        button.setCallback(this);
    }
}
Also used : LockPatternUtils(com.android.internal.widget.LockPatternUtils)

Example 94 with LockPatternUtils

use of com.android.internal.widget.LockPatternUtils in project android_frameworks_base by crdroidandroid.

the class SettingsBackupAgent method restoreLockSettings.

/**
     * Restores the owner info enabled and owner info settings in LockSettings.
     *
     * @param buffer
     * @param nBytes
     */
private void restoreLockSettings(byte[] buffer, int nBytes) {
    final LockPatternUtils lockPatternUtils = new LockPatternUtils(this);
    ByteArrayInputStream bais = new ByteArrayInputStream(buffer, 0, nBytes);
    DataInputStream in = new DataInputStream(bais);
    try {
        String key;
        // Read until empty string marker
        while ((key = in.readUTF()).length() > 0) {
            final String value = in.readUTF();
            if (DEBUG_BACKUP) {
                Log.v(TAG, "Restoring lock_settings " + key + " = " + value);
            }
            switch(key) {
                case KEY_LOCK_SETTINGS_OWNER_INFO_ENABLED:
                    lockPatternUtils.setOwnerInfoEnabled("1".equals(value), UserHandle.myUserId());
                    break;
                case KEY_LOCK_SETTINGS_OWNER_INFO:
                    lockPatternUtils.setOwnerInfo(value, UserHandle.myUserId());
                    break;
            }
        }
        in.close();
    } catch (IOException ioe) {
    }
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) LockPatternUtils(com.android.internal.widget.LockPatternUtils) IOException(java.io.IOException) DataInputStream(java.io.DataInputStream)

Example 95 with LockPatternUtils

use of com.android.internal.widget.LockPatternUtils in project android_frameworks_base by crdroidandroid.

the class SettingsBackupAgent method getLockSettings.

/**
     * Serialize the owner info settings
     */
private byte[] getLockSettings() {
    final LockPatternUtils lockPatternUtils = new LockPatternUtils(this);
    final boolean ownerInfoEnabled = lockPatternUtils.isOwnerInfoEnabled(UserHandle.myUserId());
    final String ownerInfo = lockPatternUtils.getOwnerInfo(UserHandle.myUserId());
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    DataOutputStream out = new DataOutputStream(baos);
    try {
        out.writeUTF(KEY_LOCK_SETTINGS_OWNER_INFO_ENABLED);
        out.writeUTF(ownerInfoEnabled ? "1" : "0");
        if (ownerInfo != null) {
            out.writeUTF(KEY_LOCK_SETTINGS_OWNER_INFO);
            out.writeUTF(ownerInfo != null ? ownerInfo : "");
        }
        // End marker
        out.writeUTF("");
        out.flush();
    } catch (IOException ioe) {
    }
    return baos.toByteArray();
}
Also used : DataOutputStream(java.io.DataOutputStream) LockPatternUtils(com.android.internal.widget.LockPatternUtils) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException)

Aggregations

LockPatternUtils (com.android.internal.widget.LockPatternUtils)96 ComponentName (android.content.ComponentName)24 UserInfo (android.content.pm.UserInfo)24 DevicePolicyManager (android.app.admin.DevicePolicyManager)19 UserManager (android.os.UserManager)16 IOException (java.io.IOException)11 IntentFilter (android.content.IntentFilter)10 Intent (android.content.Intent)9 View (android.view.View)9 Cursor (android.database.Cursor)6 RemoteException (android.os.RemoteException)6 ArrayList (java.util.ArrayList)6 ContentResolver (android.content.ContentResolver)5 Configuration (android.content.res.Configuration)5 Rect (android.graphics.Rect)5 SoundPool (android.media.SoundPool)5 IBinder (android.os.IBinder)5 IVrManager (android.service.vr.IVrManager)5 StatusBarIcon (com.android.internal.statusbar.StatusBarIcon)5 KeyguardDisplayManager (com.android.keyguard.KeyguardDisplayManager)5