Search in sources :

Example 91 with PreferenceGroup

use of android.support.v7.preference.PreferenceGroup in project android_packages_apps_CMParts by LineageOS.

the class NotificationLightSettings method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    addPreferencesFromResource(R.xml.notification_light_settings);
    getActivity().getActionBar().setTitle(R.string.notification_light_title);
    PreferenceScreen prefSet = getPreferenceScreen();
    Resources resources = getResources();
    PreferenceGroup mAdvancedPrefs = (PreferenceGroup) prefSet.findPreference("advanced_section");
    PreferenceGroup mGeneralPrefs = (PreferenceGroup) prefSet.findPreference("general_section");
    // Get the system defined default notification color
    mDefaultColor = resources.getColor(com.android.internal.R.color.config_defaultNotificationColor, null);
    mDefaultLedOn = resources.getInteger(com.android.internal.R.integer.config_defaultNotificationLedOn);
    mDefaultLedOff = resources.getInteger(com.android.internal.R.integer.config_defaultNotificationLedOff);
    final NotificationManager nm = getContext().getSystemService(NotificationManager.class);
    mLedCanPulse = nm.doLightsSupport(NotificationManager.LIGHTS_PULSATING_LED);
    mMultiColorLed = nm.doLightsSupport(NotificationManager.LIGHTS_RGB_NOTIFICATION_LED);
    mEnabledPref = (SystemSettingSwitchPreference) findPreference(Settings.System.NOTIFICATION_LIGHT_PULSE);
    mEnabledPref.setOnPreferenceChangeListener(this);
    mDefaultPref = (ApplicationLightPreference) findPreference(DEFAULT_PREF);
    mAutoGenerateColors = (CMSystemSettingSwitchPreference) findPreference(CMSettings.System.NOTIFICATION_LIGHT_COLOR_AUTO);
    // Advanced light settings
    mNotificationLedBrightnessPref = (PreferenceScreen) findPreference(CMSettings.System.NOTIFICATION_LIGHT_BRIGHTNESS_LEVEL);
    mMultipleLedsEnabledPref = (CMSystemSettingSwitchPreference) findPreference(CMSettings.System.NOTIFICATION_LIGHT_MULTIPLE_LEDS_ENABLE);
    mScreenOnLightsPref = (CMSystemSettingSwitchPreference) findPreference(CMSettings.System.NOTIFICATION_LIGHT_SCREEN_ON);
    mScreenOnLightsPref.setOnPreferenceChangeListener(this);
    mCustomEnabledPref = (CMSystemSettingSwitchPreference) findPreference(CMSettings.System.NOTIFICATION_LIGHT_PULSE_CUSTOM_ENABLE);
    if (!nm.doLightsSupport(NotificationManager.LIGHTS_ADJUSTABLE_NOTIFICATION_LED_BRIGHTNESS)) {
        mAdvancedPrefs.removePreference(mNotificationLedBrightnessPref);
    } else {
        mNotificationLedBrightnessPref.setOnPreferenceChangeListener(this);
    }
    if (!nm.doLightsSupport(NotificationManager.LIGHTS_MULTIPLE_NOTIFICATION_LED)) {
        mAdvancedPrefs.removePreference(mMultipleLedsEnabledPref);
    } else {
        mMultipleLedsEnabledPref.setOnPreferenceChangeListener(this);
    }
    if (!mLedCanPulse && !mMultiColorLed) {
        mGeneralPrefs.removePreference(mDefaultPref);
        mAdvancedPrefs.removePreference(mCustomEnabledPref);
    } else {
        mCustomEnabledPref.setOnPreferenceChangeListener(this);
        mDefaultPref.setOnPreferenceChangeListener(this);
    }
    // Missed call and Voicemail preferences should only show on devices with a voice capabilities
    TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
    if (tm.getPhoneType() == TelephonyManager.PHONE_TYPE_NONE || (!mLedCanPulse && !mMultiColorLed)) {
        removePreference("phone_list");
    } else {
        mCallPref = (ApplicationLightPreference) findPreference(MISSED_CALL_PREF);
        mCallPref.setOnPreferenceChangeListener(this);
        mVoicemailPref = (ApplicationLightPreference) findPreference(VOICEMAIL_PREF);
        mVoicemailPref.setOnPreferenceChangeListener(this);
    }
    if (!mLedCanPulse && !mMultiColorLed) {
        removePreference("applications_list");
    } else {
        mApplicationPrefList = (PreferenceGroup) findPreference("applications_list");
        mApplicationPrefList.setOrderingAsAdded(false);
    }
    // Get launch-able applications
    mPackageManager = getActivity().getPackageManager();
    mPackageAdapter = new PackageListAdapter(getActivity());
    mPackages = new HashMap<String, Package>();
    setHasOptionsMenu(true);
    if (!mMultiColorLed) {
        resetColors();
        mGeneralPrefs.removePreference(mAutoGenerateColors);
    } else {
        mAutoGenerateColors.setOnPreferenceChangeListener(this);
        watch(CMSettings.System.getUriFor(CMSettings.System.NOTIFICATION_LIGHT_COLOR_AUTO));
    }
    watch(Settings.System.getUriFor(Settings.System.NOTIFICATION_LIGHT_PULSE));
}
Also used : PackageListAdapter(org.cyanogenmod.cmparts.widget.PackageListAdapter) PreferenceScreen(android.support.v7.preference.PreferenceScreen) NotificationManager(android.app.NotificationManager) TelephonyManager(android.telephony.TelephonyManager) PreferenceGroup(android.support.v7.preference.PreferenceGroup) Resources(android.content.res.Resources)

Example 92 with PreferenceGroup

use of android.support.v7.preference.PreferenceGroup in project android_packages_apps_CMParts by LineageOS.

the class BatteryLightSettings method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    addPreferencesFromResource(R.xml.battery_light_settings);
    getActivity().getActionBar().setTitle(R.string.battery_light_title);
    PreferenceScreen prefSet = getPreferenceScreen();
    PreferenceGroup mGeneralPrefs = (PreferenceGroup) prefSet.findPreference("general_section");
    mLightEnabledPref = (CMSystemSettingSwitchPreference) prefSet.findPreference(LIGHT_ENABLED_PREF);
    mPulseEnabledPref = (CMSystemSettingSwitchPreference) prefSet.findPreference(PULSE_ENABLED_PREF);
    final NotificationManager nm = getContext().getSystemService(NotificationManager.class);
    if (!nm.doLightsSupport(NotificationManager.LIGHTS_PULSATING_LED) || nm.doLightsSupport(NotificationManager.LIGHTS_SEGMENTED_BATTERY_LED)) {
        mGeneralPrefs.removePreference(mPulseEnabledPref);
    }
    // Does the device support changing battery LED colors?
    if (nm.doLightsSupport(NotificationManager.LIGHTS_RGB_BATTERY_LED)) {
        setHasOptionsMenu(true);
        // Low, Medium and full color preferences
        mLowColorPref = (ApplicationLightPreference) prefSet.findPreference(LOW_COLOR_PREF);
        mLowColorPref.setOnPreferenceChangeListener(this);
        mMediumColorPref = (ApplicationLightPreference) prefSet.findPreference(MEDIUM_COLOR_PREF);
        mMediumColorPref.setOnPreferenceChangeListener(this);
        mFullColorPref = (ApplicationLightPreference) prefSet.findPreference(FULL_COLOR_PREF);
        mFullColorPref.setOnPreferenceChangeListener(this);
    } else {
        prefSet.removePreference(prefSet.findPreference("colors_list"));
        resetColors();
    }
    watch(CMSettings.System.getUriFor(CMSettings.System.BATTERY_LIGHT_ENABLED));
}
Also used : PreferenceScreen(android.support.v7.preference.PreferenceScreen) NotificationManager(android.app.NotificationManager) PreferenceGroup(android.support.v7.preference.PreferenceGroup)

Example 93 with PreferenceGroup

use of android.support.v7.preference.PreferenceGroup in project android_packages_apps_Settings by SudaMod.

the class EncryptionAndCredential 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.encryption_and_credential);
    root = getPreferenceScreen();
    // Add options for device encryption
    mIsAdmin = mUm.isAdminUser();
    if (mIsAdmin) {
        if (LockPatternUtils.isDeviceEncryptionEnabled()) {
            // The device is currently encrypted.
            addPreferencesFromResource(R.xml.security_settings_encrypted);
        } else {
            // This device supports encryption but isn't encrypted.
            addPreferencesFromResource(R.xml.security_settings_unencrypted);
        }
    }
    // Credential storage
    // needs to be initialized for onResume()
    mKeyStore = KeyStore.getInstance();
    if (!RestrictedLockUtils.hasBaseUserRestriction(getActivity(), UserManager.DISALLOW_CONFIG_CREDENTIALS, MY_USER_ID)) {
        RestrictedPreference userCredentials = (RestrictedPreference) root.findPreference(KEY_USER_CREDENTIALS);
        userCredentials.checkRestrictionAndSetDisabled(UserManager.DISALLOW_CONFIG_CREDENTIALS);
        RestrictedPreference credentialStorageType = (RestrictedPreference) root.findPreference(KEY_CREDENTIAL_STORAGE_TYPE);
        credentialStorageType.checkRestrictionAndSetDisabled(UserManager.DISALLOW_CONFIG_CREDENTIALS);
        RestrictedPreference installCredentials = (RestrictedPreference) root.findPreference(KEY_CREDENTIALS_INSTALL);
        installCredentials.checkRestrictionAndSetDisabled(UserManager.DISALLOW_CONFIG_CREDENTIALS);
        mResetCredentials = (RestrictedPreference) root.findPreference(KEY_RESET_CREDENTIALS);
        mResetCredentials.checkRestrictionAndSetDisabled(UserManager.DISALLOW_CONFIG_CREDENTIALS);
        final int storageSummaryRes = mKeyStore.isHardwareBacked() ? R.string.credential_storage_type_hardware : R.string.credential_storage_type_software;
        credentialStorageType.setSummary(storageSummaryRes);
    } else {
        PreferenceGroup credentialsManager = (PreferenceGroup) root.findPreference(KEY_CREDENTIALS_MANAGER);
        credentialsManager.removePreference(root.findPreference(KEY_RESET_CREDENTIALS));
        credentialsManager.removePreference(root.findPreference(KEY_CREDENTIALS_INSTALL));
        credentialsManager.removePreference(root.findPreference(KEY_CREDENTIAL_STORAGE_TYPE));
        credentialsManager.removePreference(root.findPreference(KEY_USER_CREDENTIALS));
    }
    return root;
}
Also used : PreferenceScreen(android.support.v7.preference.PreferenceScreen) RestrictedPreference(com.android.settingslib.RestrictedPreference) PreferenceGroup(android.support.v7.preference.PreferenceGroup)

Example 94 with PreferenceGroup

use of android.support.v7.preference.PreferenceGroup in project android_packages_apps_Settings by SudaMod.

the class LegalSettings method onCreate.

public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    addPreferencesFromResource(R.xml.about_legal);
    final Activity act = getActivity();
    // These are contained in the "container" preference group
    PreferenceGroup parentPreference = getPreferenceScreen();
    Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference, KEY_TERMS, Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
    Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference, KEY_LICENSE, Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
    Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference, KEY_COPYRIGHT, Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
    Utils.updatePreferenceToSpecificActivityOrRemove(act, parentPreference, KEY_WEBVIEW_LICENSE, Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY);
}
Also used : Activity(android.app.Activity) PreferenceGroup(android.support.v7.preference.PreferenceGroup)

Example 95 with PreferenceGroup

use of android.support.v7.preference.PreferenceGroup in project android_packages_apps_Settings by SudaMod.

the class DevelopmentSettings method onCreate.

@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    mWindowManager = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
    mBackupManager = IBackupManager.Stub.asInterface(ServiceManager.getService(Context.BACKUP_SERVICE));
    mWebViewUpdateService = WebViewFactory.getUpdateService();
    mOemLockManager = (OemLockManager) getSystemService(Context.OEM_LOCK_SERVICE);
    mTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
    mUm = (UserManager) getSystemService(Context.USER_SERVICE);
    mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    mBugReportController = new BugReportPreferenceController(getActivity());
    mBugReportInPowerController = new BugReportInPowerPreferenceController(getActivity());
    mTelephonyMonitorController = new TelephonyMonitorPreferenceController(getActivity());
    mWebViewAppPrefController = new WebViewAppPreferenceController(getActivity());
    mVerifyAppsOverUsbController = new VerifyAppsOverUsbPreferenceController(getActivity());
    mCameraLaserSensorController = new CameraLaserSensorPreferenceController(getActivity());
    setIfOnlyAvailableForAdmins(true);
    if (isUiRestricted() || !Utils.isDeviceProvisioned(getActivity())) {
        // Block access to developer options if the user is not the owner, if user policy
        // restricts it, or if the device has not been provisioned
        mUnavailable = true;
        addPreferencesFromResource(R.xml.placeholder_prefs);
        return;
    }
    addPreferencesFromResource(R.xml.development_prefs);
    final PreferenceGroup debugDebuggingCategory = (PreferenceGroup) findPreference(DEBUG_DEBUGGING_CATEGORY_KEY);
    mEnableAdbController = new EnableAdbPreferenceController(getActivity());
    mAdbOverNetwork = findAndInitSwitchPref(ADB_TCPIP);
    mClearAdbKeys = findPreference(CLEAR_ADB_KEYS);
    if (!SystemProperties.getBoolean("ro.adb.secure", false)) {
        if (debugDebuggingCategory != null) {
            debugDebuggingCategory.removePreference(mClearAdbKeys);
        }
    }
    mAllPrefs.add(mClearAdbKeys);
    mEnableTerminal = findAndInitSwitchPref(ENABLE_TERMINAL);
    if (!isPackageInstalled(getActivity(), TERMINAL_APP_PACKAGE)) {
        debugDebuggingCategory.removePreference(mEnableTerminal);
        mEnableTerminal = null;
    }
    mBugReportController.displayPreference(getPreferenceScreen());
    mBugReportInPowerController.displayPreference(getPreferenceScreen());
    mTelephonyMonitorController.displayPreference(getPreferenceScreen());
    mWebViewAppPrefController.displayPreference(getPreferenceScreen());
    mEnableAdbController.displayPreference(getPreferenceScreen());
    mCameraLaserSensorController.displayPreference(getPreferenceScreen());
    mKeepScreenOn = (RestrictedSwitchPreference) findAndInitSwitchPref(KEEP_SCREEN_ON);
    mBtHciSnoopLog = findAndInitSwitchPref(BT_HCI_SNOOP_LOG);
    mEnableOemUnlock = (RestrictedSwitchPreference) findAndInitSwitchPref(ENABLE_OEM_UNLOCK);
    if (!showEnableOemUnlockPreference(getActivity())) {
        removePreference(mEnableOemUnlock);
        mEnableOemUnlock = null;
    }
    mDebugViewAttributes = findAndInitSwitchPref(DEBUG_VIEW_ATTRIBUTES);
    mForceAllowOnExternal = findAndInitSwitchPref(FORCE_ALLOW_ON_EXTERNAL_KEY);
    mPassword = findPreference(LOCAL_BACKUP_PASSWORD);
    mAllPrefs.add(mPassword);
    if (!mUm.isAdminUser()) {
        disableForUser(mClearAdbKeys);
        disableForUser(mEnableTerminal);
        disableForUser(mPassword);
    }
    mDebugAppPref = findPreference(DEBUG_APP_KEY);
    mAllPrefs.add(mDebugAppPref);
    mWaitForDebugger = findAndInitSwitchPref(WAIT_FOR_DEBUGGER_KEY);
    mMockLocationAppPref = findPreference(MOCK_LOCATION_APP_KEY);
    mAllPrefs.add(mMockLocationAppPref);
    mVerifyAppsOverUsbController.displayPreference(getPreferenceScreen());
    mStrictMode = findAndInitSwitchPref(STRICT_MODE_KEY);
    mPointerLocation = findAndInitSwitchPref(POINTER_LOCATION_KEY);
    mShowTouches = findAndInitSwitchPref(SHOW_TOUCHES_KEY);
    mShowScreenUpdates = findAndInitSwitchPref(SHOW_SCREEN_UPDATES_KEY);
    mDisableOverlays = findAndInitSwitchPref(DISABLE_OVERLAYS_KEY);
    mForceHardwareUi = findAndInitSwitchPref(FORCE_HARDWARE_UI_KEY);
    mForceMsaa = findAndInitSwitchPref(FORCE_MSAA_KEY);
    mTrackFrameTime = addListPreference(TRACK_FRAME_TIME_KEY);
    mShowNonRectClip = addListPreference(SHOW_NON_RECTANGULAR_CLIP_KEY);
    mShowHwScreenUpdates = findAndInitSwitchPref(SHOW_HW_SCREEN_UPDATES_KEY);
    mShowHwLayersUpdates = findAndInitSwitchPref(SHOW_HW_LAYERS_UPDATES_KEY);
    mDebugLayout = findAndInitSwitchPref(DEBUG_LAYOUT_KEY);
    mForceRtlLayout = findAndInitSwitchPref(FORCE_RTL_LAYOUT_KEY);
    mDebugHwOverdraw = addListPreference(DEBUG_HW_OVERDRAW_KEY);
    mDebugHwRenderer = addListPreference(DEBUG_HW_RENDERER_KEY);
    mWifiDisplayCertification = findAndInitSwitchPref(WIFI_DISPLAY_CERTIFICATION_KEY);
    mWifiVerboseLogging = findAndInitSwitchPref(WIFI_VERBOSE_LOGGING_KEY);
    mWifiAggressiveHandover = findAndInitSwitchPref(WIFI_AGGRESSIVE_HANDOVER_KEY);
    mWifiAllowScansWithTraffic = findAndInitSwitchPref(WIFI_ALLOW_SCAN_WITH_TRAFFIC_KEY);
    mMobileDataAlwaysOn = findAndInitSwitchPref(MOBILE_DATA_ALWAYS_ON);
    mTetheringHardwareOffload = findAndInitSwitchPref(TETHERING_HARDWARE_OFFLOAD);
    mLogdSize = addListPreference(SELECT_LOGD_SIZE_KEY);
    if ("1".equals(SystemProperties.get("ro.debuggable", "0"))) {
        mLogpersist = addListPreference(SELECT_LOGPERSIST_KEY);
    } else {
        mLogpersist = (ListPreference) findPreference(SELECT_LOGPERSIST_KEY);
        if (mLogpersist != null) {
            mLogpersist.setEnabled(false);
            if (debugDebuggingCategory != null) {
                debugDebuggingCategory.removePreference(mLogpersist);
            }
        }
        mLogpersist = null;
    }
    mUsbConfiguration = addListPreference(USB_CONFIGURATION_KEY);
    mBluetoothShowDevicesWithoutNames = findAndInitSwitchPref(BLUETOOTH_SHOW_DEVICES_WITHOUT_NAMES_KEY);
    mBluetoothDisableAbsVolume = findAndInitSwitchPref(BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_KEY);
    mBluetoothEnableInbandRinging = findAndInitSwitchPref(BLUETOOTH_ENABLE_INBAND_RINGING_KEY);
    if (!BluetoothHeadset.isInbandRingingSupported(getContext())) {
        removePreference(mBluetoothEnableInbandRinging);
        mBluetoothEnableInbandRinging = null;
    }
    mBluetoothSelectAvrcpVersion = addListPreference(BLUETOOTH_SELECT_AVRCP_VERSION_KEY);
    mBluetoothSelectA2dpCodec = addListPreference(BLUETOOTH_SELECT_A2DP_CODEC_KEY);
    mBluetoothSelectA2dpSampleRate = addListPreference(BLUETOOTH_SELECT_A2DP_SAMPLE_RATE_KEY);
    mBluetoothSelectA2dpBitsPerSample = addListPreference(BLUETOOTH_SELECT_A2DP_BITS_PER_SAMPLE_KEY);
    mBluetoothSelectA2dpChannelMode = addListPreference(BLUETOOTH_SELECT_A2DP_CHANNEL_MODE_KEY);
    mBluetoothSelectA2dpLdacPlaybackQuality = addListPreference(BLUETOOTH_SELECT_A2DP_LDAC_PLAYBACK_QUALITY_KEY);
    initBluetoothConfigurationValues();
    mWindowAnimationScale = addListPreference(WINDOW_ANIMATION_SCALE_KEY);
    mTransitionAnimationScale = addListPreference(TRANSITION_ANIMATION_SCALE_KEY);
    mAnimatorDurationScale = addListPreference(ANIMATOR_DURATION_SCALE_KEY);
    mOverlayDisplayDevices = addListPreference(OVERLAY_DISPLAY_DEVICES_KEY);
    mSimulateColorSpace = addListPreference(SIMULATE_COLOR_SPACE);
    mUSBAudio = findAndInitSwitchPref(USB_AUDIO_KEY);
    mForceResizable = findAndInitSwitchPref(FORCE_RESIZABLE_KEY);
    mImmediatelyDestroyActivities = (SwitchPreference) findPreference(IMMEDIATELY_DESTROY_ACTIVITIES_KEY);
    mAllPrefs.add(mImmediatelyDestroyActivities);
    mResetSwitchPrefs.add(mImmediatelyDestroyActivities);
    mAppProcessLimit = addListPreference(APP_PROCESS_LIMIT_KEY);
    mShowAllANRs = (SwitchPreference) findPreference(SHOW_ALL_ANRS_KEY);
    mAllPrefs.add(mShowAllANRs);
    mResetSwitchPrefs.add(mShowAllANRs);
    mShowNotificationChannelWarnings = (SwitchPreference) findPreference(SHOW_NOTIFICATION_CHANNEL_WARNINGS_KEY);
    mAllPrefs.add(mShowNotificationChannelWarnings);
    mResetSwitchPrefs.add(mShowNotificationChannelWarnings);
    Preference hdcpChecking = findPreference(HDCP_CHECKING_KEY);
    if (hdcpChecking != null) {
        mAllPrefs.add(hdcpChecking);
        removePreferenceForProduction(hdcpChecking);
    }
    Preference convertFbePreference = findPreference(KEY_CONVERT_FBE);
    try {
        IBinder service = ServiceManager.getService("mount");
        IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
        if (!storageManager.isConvertibleToFBE()) {
            removePreference(KEY_CONVERT_FBE);
        } else if ("file".equals(SystemProperties.get("ro.crypto.type", "none"))) {
            convertFbePreference.setEnabled(false);
            convertFbePreference.setSummary(getResources().getString(R.string.convert_to_file_encryption_done));
        }
    } catch (RemoteException e) {
        removePreference(KEY_CONVERT_FBE);
    }
    mOtaDisableAutomaticUpdate = findAndInitSwitchPref(OTA_DISABLE_AUTOMATIC_UPDATE_KEY);
    if (!SystemProperties.getBoolean("ro.build.ab_update", false)) {
        removePreference(mOtaDisableAutomaticUpdate);
        mOtaDisableAutomaticUpdate = null;
    }
    mColorModePreference = (ColorModePreference) findPreference(KEY_COLOR_MODE);
    mColorModePreference.updateCurrentAndSupported();
    if (mColorModePreference.getColorModeCount() < 2 || getContext().getResources().getConfiguration().isScreenWideColorGamut()) {
        removePreference(KEY_COLOR_MODE);
        mColorModePreference = null;
    }
    mColorTemperaturePreference = (SwitchPreference) findPreference(COLOR_TEMPERATURE_KEY);
    if (getResources().getBoolean(R.bool.config_enableColorTemperature)) {
        mAllPrefs.add(mColorTemperaturePreference);
        mResetSwitchPrefs.add(mColorTemperaturePreference);
    } else {
        removePreference(COLOR_TEMPERATURE_KEY);
        mColorTemperaturePreference = null;
    }
    mDevelopmentTools = (PreferenceScreen) findPreference(DEVELOPMENT_TOOLS);
    mAllPrefs.add(mDevelopmentTools);
    mRootAccess = (ListPreference) findPreference(ROOT_ACCESS_KEY);
    mRootAccess.setOnPreferenceChangeListener(this);
    mRootAppops = (Preference) findPreference(ROOT_APPOPS_KEY);
    mRootAppops.setOnPreferenceClickListener(this);
    if (!removeRootOptionsIfRequired()) {
        if (FileUtils.fileExists("/system/xbin/su")) {
            mRootAccess.setEntries(R.array.root_access_entries);
            mRootAccess.setEntryValues(R.array.root_access_values);
        } else {
            mRootAccess.setEntries(R.array.root_access_entries_adb);
            mRootAccess.setEntryValues(R.array.root_access_values_adb);
        }
        mAllPrefs.add(mRootAccess);
        mAllPrefs.add(mRootAppops);
    }
    addDashboardCategoryPreferences();
}
Also used : WebViewAppPreferenceController(com.android.settings.webview.WebViewAppPreferenceController) IStorageManager(android.os.storage.IStorageManager) IBinder(android.os.IBinder) ListPreference(android.support.v7.preference.ListPreference) RestrictedSwitchPreference(com.android.settingslib.RestrictedSwitchPreference) Preference(android.support.v7.preference.Preference) SwitchPreference(android.support.v14.preference.SwitchPreference) PreferenceGroup(android.support.v7.preference.PreferenceGroup) AbstractEnableAdbPreferenceController(com.android.settingslib.development.AbstractEnableAdbPreferenceController) RemoteException(android.os.RemoteException)

Aggregations

PreferenceGroup (android.support.v7.preference.PreferenceGroup)104 Preference (android.support.v7.preference.Preference)70 Context (android.content.Context)28 PreferenceScreen (android.support.v7.preference.PreferenceScreen)28 Test (org.junit.Test)26 PreferenceManager (android.support.v7.preference.PreferenceManager)22 SwitchPreference (android.support.v14.preference.SwitchPreference)19 ArrayList (java.util.ArrayList)19 PreferenceCategory (android.support.v7.preference.PreferenceCategory)17 UserInfo (android.content.pm.UserInfo)16 Intent (android.content.Intent)14 AccessiblePreferenceCategory (com.android.settings.AccessiblePreferenceCategory)14 RestrictedSwitchPreference (com.android.settingslib.RestrictedSwitchPreference)14 Account (android.accounts.Account)12 AuthenticatorDescription (android.accounts.AuthenticatorDescription)12 UserHandle (android.os.UserHandle)12 TelephonyManager (android.telephony.TelephonyManager)12 Activity (android.app.Activity)11 RestrictedPreference (com.android.settingslib.RestrictedPreference)11 RemoteException (android.os.RemoteException)8