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();
}
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;
}
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);
}
}
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) {
}
}
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();
}
Aggregations