use of android.os.PersistableBundle in project android_packages_apps_Settings by crdroidandroid.
the class WifiCallingSettings method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.wifi_calling_settings);
mButtonWfcMode = (ListPreference) findPreference(BUTTON_WFC_MODE);
mButtonWfcMode.setOnPreferenceChangeListener(this);
mButtonWfcRoamingMode = (ListPreference) findPreference(BUTTON_WFC_ROAMING_MODE);
mButtonWfcRoamingMode.setOnPreferenceChangeListener(this);
mUpdateAddress = (Preference) findPreference(PREFERENCE_EMERGENCY_ADDRESS);
mUpdateAddress.setOnPreferenceClickListener(mUpdateAddressListener);
mIntentFilter = new IntentFilter();
mIntentFilter.addAction(ImsManager.ACTION_IMS_REGISTRATION_ERROR);
CarrierConfigManager configManager = (CarrierConfigManager) getSystemService(Context.CARRIER_CONFIG_SERVICE);
boolean isWifiOnlySupported = true;
if (configManager != null) {
PersistableBundle b = configManager.getConfig();
if (b != null) {
mEditableWfcMode = b.getBoolean(CarrierConfigManager.KEY_EDITABLE_WFC_MODE_BOOL);
mEditableWfcRoamingMode = b.getBoolean(CarrierConfigManager.KEY_EDITABLE_WFC_ROAMING_MODE_BOOL);
isWifiOnlySupported = b.getBoolean(CarrierConfigManager.KEY_CARRIER_WFC_SUPPORTS_WIFI_ONLY_BOOL, true);
}
}
if (!isWifiOnlySupported) {
mButtonWfcMode.setEntries(R.array.wifi_calling_mode_choices_without_wifi_only);
mButtonWfcMode.setEntryValues(R.array.wifi_calling_mode_values_without_wifi_only);
mButtonWfcRoamingMode.setEntries(R.array.wifi_calling_mode_choices_v2_without_wifi_only);
mButtonWfcRoamingMode.setEntryValues(R.array.wifi_calling_mode_values_without_wifi_only);
}
}
use of android.os.PersistableBundle in project android_packages_apps_Settings by crdroidandroid.
the class RestrictedSettingsFragment method ensurePin.
private void ensurePin() {
if (!mChallengeSucceeded && !mChallengeRequested && mRestrictionsManager.hasRestrictionsProvider()) {
Intent intent = mRestrictionsManager.createLocalApprovalIntent();
if (intent != null) {
mChallengeRequested = true;
mChallengeSucceeded = false;
PersistableBundle request = new PersistableBundle();
request.putString(RestrictionsManager.REQUEST_KEY_MESSAGE, getResources().getString(R.string.restr_pin_enter_admin_pin));
intent.putExtra(RestrictionsManager.EXTRA_REQUEST_BUNDLE, request);
startActivityForResult(intent, REQUEST_PIN_CHALLENGE);
}
}
}
use of android.os.PersistableBundle in project android_packages_apps_Settings by crdroidandroid.
the class SecuritySettings method createPreferenceHierarchy.
/**
* Important!
*
* Don't forget to update the SecuritySearchIndexProvider if you are doing any change in the
* logic or adding/removing preferences here.
*/
private PreferenceScreen createPreferenceHierarchy() {
PreferenceScreen root = getPreferenceScreen();
if (root != null) {
root.removeAll();
}
addPreferencesFromResource(R.xml.security_settings);
root = getPreferenceScreen();
// Add category for security status
addPreferencesFromResource(R.xml.security_settings_status);
// Add options for lock/unlock screen
final int resid = getResIdForLockUnlockScreen(getActivity(), mLockPatternUtils, mManagedPasswordProvider, MY_USER_ID);
addPreferencesFromResource(resid);
// DO or PO installed in the user may disallow to change password.
disableIfPasswordQualityManaged(KEY_UNLOCK_SET_OR_CHANGE, MY_USER_ID);
mProfileChallengeUserId = Utils.getManagedProfileId(mUm, MY_USER_ID);
if (mProfileChallengeUserId != UserHandle.USER_NULL && mLockPatternUtils.isSeparateProfileChallengeAllowed(mProfileChallengeUserId)) {
addPreferencesFromResource(R.xml.security_settings_profile);
addPreferencesFromResource(R.xml.security_settings_unification);
final int profileResid = getResIdForLockUnlockScreen(getActivity(), mLockPatternUtils, mManagedPasswordProvider, mProfileChallengeUserId);
addPreferencesFromResource(profileResid);
maybeAddFingerprintPreference(root, mProfileChallengeUserId);
if (!mLockPatternUtils.isSeparateProfileChallengeEnabled(mProfileChallengeUserId)) {
final Preference lockPreference = root.findPreference(KEY_UNLOCK_SET_OR_CHANGE_PROFILE);
final String summary = getContext().getString(R.string.lock_settings_profile_unified_summary);
lockPreference.setSummary(summary);
lockPreference.setEnabled(false);
// PO may disallow to change password for the profile, but screen lock and managed
// profile's lock is the same. Disable main "Screen lock" menu.
disableIfPasswordQualityManaged(KEY_UNLOCK_SET_OR_CHANGE, mProfileChallengeUserId);
} else {
// PO may disallow to change profile password, and the profile's password is
// separated from screen lock password. Disable profile specific "Screen lock" menu.
disableIfPasswordQualityManaged(KEY_UNLOCK_SET_OR_CHANGE_PROFILE, mProfileChallengeUserId);
}
}
Preference unlockSetOrChange = findPreference(KEY_UNLOCK_SET_OR_CHANGE);
if (unlockSetOrChange instanceof GearPreference) {
((GearPreference) unlockSetOrChange).setOnGearClickListener(this);
}
mIsAdmin = mUm.isAdminUser();
// Fingerprint and trust agents
int numberOfTrustAgent = 0;
PreferenceGroup securityCategory = (PreferenceGroup) root.findPreference(KEY_SECURITY_CATEGORY);
if (securityCategory != null) {
maybeAddFingerprintPreference(securityCategory, UserHandle.myUserId());
numberOfTrustAgent = addTrustAgentSettings(securityCategory);
setLockscreenPreferencesSummary(securityCategory);
}
mVisiblePatternProfile = (SwitchPreference) root.findPreference(KEY_VISIBLE_PATTERN_PROFILE);
mUnifyProfile = (SwitchPreference) root.findPreference(KEY_UNIFICATION);
// Append the rest of the settings
addPreferencesFromResource(R.xml.security_settings_misc);
// Do not display SIM lock for devices without an Icc card
TelephonyManager tm = TelephonyManager.getDefault();
CarrierConfigManager cfgMgr = (CarrierConfigManager) getActivity().getSystemService(Context.CARRIER_CONFIG_SERVICE);
PersistableBundle b = cfgMgr.getConfig();
if (!mIsAdmin || !isSimIccReady() || b.getBoolean(CarrierConfigManager.KEY_HIDE_SIM_LOCK_SETTINGS_BOOL)) {
root.removePreference(root.findPreference(KEY_SIM_LOCK));
} else {
// Disable SIM lock if there is no ready SIM card.
root.findPreference(KEY_SIM_LOCK).setEnabled(isSimReady());
}
if (Settings.System.getInt(getContentResolver(), Settings.System.LOCK_TO_APP_ENABLED, 0) != 0) {
root.findPreference(KEY_SCREEN_PINNING).setSummary(getResources().getString(R.string.switch_on_text));
}
// Encryption status of device
if (LockPatternUtils.isDeviceEncryptionEnabled()) {
root.findPreference(KEY_ENCRYPTION_AND_CREDENTIALS).setSummary(R.string.encryption_and_credential_settings_summary);
} else {
root.findPreference(KEY_ENCRYPTION_AND_CREDENTIALS).setSummary(R.string.summary_placeholder);
}
// Show password
mShowPassword = (SwitchPreference) root.findPreference(KEY_SHOW_PASSWORD);
// Credential storage
final UserManager um = (UserManager) getActivity().getSystemService(Context.USER_SERVICE);
// Advanced Security features
initTrustAgentPreference(root, numberOfTrustAgent);
// The above preferences come and go based on security state, so we need to update
// the index. This call is expected to be fairly cheap, but we may want to do something
// smarter in the future.
final Activity activity = getActivity();
FeatureFactory.getFactory(activity).getSearchFeatureProvider().getIndexingManager(activity).updateFromClassNameResource(SecuritySettings.class.getName(), true);
PreferenceGroup securityStatusPreferenceGroup = (PreferenceGroup) root.findPreference(KEY_SECURITY_STATUS);
final List<Preference> tilePrefs = mDashboardFeatureProvider.getPreferencesForCategory(getActivity(), getPrefContext(), getMetricsCategory(), CategoryKey.CATEGORY_SECURITY);
int numSecurityStatusPrefs = 0;
if (tilePrefs != null && !tilePrefs.isEmpty()) {
for (Preference preference : tilePrefs) {
if (!TextUtils.isEmpty(preference.getKey()) && preference.getKey().startsWith(SECURITY_STATUS_KEY_PREFIX)) {
// Injected security status settings are placed under the Security status
// category.
securityStatusPreferenceGroup.addPreference(preference);
numSecurityStatusPrefs++;
} else {
// Other injected settings are placed under the Security preference screen.
root.addPreference(preference);
}
}
}
if (numSecurityStatusPrefs == 0) {
root.removePreference(securityStatusPreferenceGroup);
} else if (numSecurityStatusPrefs > 0) {
// Update preference data with tile data. Security feature provider only updates the
// data if it actually needs to be changed.
mSecurityFeatureProvider.updatePreferences(getActivity(), root, mDashboardFeatureProvider.getTilesForCategory(CategoryKey.CATEGORY_SECURITY));
}
for (int i = 0; i < SWITCH_PREFERENCE_KEYS.length; i++) {
final Preference pref = findPreference(SWITCH_PREFERENCE_KEYS[i]);
if (pref != null)
pref.setOnPreferenceChangeListener(this);
}
mLocationcontroller.displayPreference(root);
mManageDeviceAdminPreferenceController.updateState(root.findPreference(KEY_MANAGE_DEVICE_ADMIN));
mEnterprisePrivacyPreferenceController.displayPreference(root);
mEnterprisePrivacyPreferenceController.onResume();
return root;
}
use of android.os.PersistableBundle in project android_packages_apps_Settings by SudaMod.
the class RestrictedDashboardFragment method ensurePin.
private void ensurePin() {
if (!mChallengeSucceeded && !mChallengeRequested && mRestrictionsManager.hasRestrictionsProvider()) {
Intent intent = mRestrictionsManager.createLocalApprovalIntent();
if (intent != null) {
mChallengeRequested = true;
mChallengeSucceeded = false;
PersistableBundle request = new PersistableBundle();
request.putString(RestrictionsManager.REQUEST_KEY_MESSAGE, getResources().getString(R.string.restr_pin_enter_admin_pin));
intent.putExtra(RestrictionsManager.EXTRA_REQUEST_BUNDLE, request);
startActivityForResult(intent, REQUEST_PIN_CHALLENGE);
}
}
}
use of android.os.PersistableBundle in project android_packages_apps_Settings by SudaMod.
the class SimStatus method updatePreference.
private void updatePreference() {
if (mPhone.getPhoneType() != TelephonyManager.PHONE_TYPE_CDMA) {
mShowLatestAreaInfo = Resources.getSystem().getBoolean(com.android.internal.R.bool.config_showAreaUpdateInfoSettings);
}
PersistableBundle carrierConfig = mCarrierConfigManager.getConfigForSubId(mSir.getSubscriptionId());
mShowICCID = carrierConfig.getBoolean(CarrierConfigManager.KEY_SHOW_ICCID_IN_SIM_STATUS_BOOL);
// If formattedNumber is null or empty, it'll display as "Unknown".
setSummaryText(KEY_PHONE_NUMBER, DeviceInfoUtils.getFormattedPhoneNumber(getContext(), mSir));
setSummaryText(KEY_IMEI, mPhone.getImei());
setSummaryText(KEY_IMEI_SV, mPhone.getDeviceSvn());
if (!mShowICCID) {
removePreferenceFromScreen(KEY_ICCID);
} else {
// Get ICCID, which is SIM serial number
String iccid = mTelephonyManager.getSimSerialNumber(mSir.getSubscriptionId());
setSummaryText(KEY_ICCID, iccid);
}
if (!mShowLatestAreaInfo) {
removePreferenceFromScreen(KEY_LATEST_AREA_INFO);
}
}
Aggregations