private PreferenceScreen createPreferenceHierarchy() { PreferenceScreen root = getPreferenceScreen(); if (root != null) { root.removeAll(); } // Location Settings addPreferencesFromResource(R.xml.location_settings); addPreferencesFromResource(R.xml.security_settings); root = getPreferenceScreen(); // Location Settings mNetwork = (CheckBoxPreference) root.findPreference(KEY_LOCATION_NETWORK); mGps = (CheckBoxPreference) root.findPreference(KEY_LOCATION_GPS); mAssistedGps = (CheckBoxPreference) root.findPreference(KEY_ASSISTED_GPS); if (GoogleLocationSettingHelper.isAvailable(getActivity())) { // GSF present, Add setting for 'Use My Location' CheckBoxPreference useLocation = new CheckBoxPreference(getActivity()); useLocation.setKey(KEY_USE_LOCATION); useLocation.setTitle(R.string.use_location_title); useLocation.setSummary(R.string.use_location_summary); useLocation.setChecked( GoogleLocationSettingHelper.getUseLocationForServices(getActivity()) == GoogleLocationSettingHelper.USE_LOCATION_FOR_SERVICES_ON); useLocation.setPersistent(false); useLocation.setOnPreferenceChangeListener(this); getPreferenceScreen().addPreference(useLocation); mUseLocation = useLocation; } // Change the summary for wifi-only devices if (Utils.isWifiOnly(getActivity())) { mNetwork.setSummaryOn(R.string.location_neighborhood_level_wifi); } // Security Settings // Add options for lock/unlock screen int resid = 0; if (!mLockPatternUtils.isSecure()) { if (mLockPatternUtils.isLockScreenDisabled()) { resid = R.xml.security_settings_lockscreen; } else { resid = R.xml.security_settings_chooser; } } else if (mLockPatternUtils.usingBiometricWeak() && mLockPatternUtils.isBiometricWeakInstalled()) { resid = R.xml.security_settings_biometric_weak; } else { switch (mLockPatternUtils.getKeyguardStoredPasswordQuality()) { case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING: resid = R.xml.security_settings_pattern; break; case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC: resid = R.xml.security_settings_pin; break; case DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC: case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC: case DevicePolicyManager.PASSWORD_QUALITY_COMPLEX: resid = R.xml.security_settings_password; break; } } addPreferencesFromResource(resid); boolean isSystemEmmcDetect = false; try { Class c = Class.forName(SYSTEM_DETECT_HANDLER); ISystemInfoDetectHandler handler = (ISystemInfoDetectHandler) c.newInstance(); isSystemEmmcDetect = handler.isFileSystemAutoDetect(); Log.i("SecuritySettings", "isSystemEmmcDetect = " + isSystemEmmcDetect); } catch (Exception e) { Log.i("SecuritySettings", "exception " + e); isSystemEmmcDetect = false; } if ((DefaultQuery.SYSTEM_INFO_DETECT_ENABLED == 1) || ((DefaultQuery.SYSTEM_INFO_DETECT_ENABLED == 2) && isSystemEmmcDetect)) { // Add options for device encryption DevicePolicyManager dpm = (DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE); switch (dpm.getStorageEncryptionStatus()) { case DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE: // The device is currently encrypted. addPreferencesFromResource(R.xml.security_settings_encrypted); break; case DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE: // This device supports encryption but isn't encrypted. addPreferencesFromResource(R.xml.security_settings_unencrypted); break; } } // lock after preference mLockAfter = (ListPreference) root.findPreference(KEY_LOCK_AFTER_TIMEOUT); if (mLockAfter != null) { setupLockAfterPreference(); updateLockAfterPreferenceSummary(); } // visible pattern mVisiblePattern = (CheckBoxPreference) root.findPreference(KEY_VISIBLE_PATTERN); // lock instantly on power key press mPowerButtonInstantlyLocks = (CheckBoxPreference) root.findPreference(KEY_POWER_INSTANTLY_LOCKS); // don't display visible pattern if biometric and backup is not // pattern if (resid == R.xml.security_settings_biometric_weak && mLockPatternUtils.getKeyguardStoredPasswordQuality() != DevicePolicyManager.PASSWORD_QUALITY_SOMETHING) { PreferenceGroup securityCategory = (PreferenceGroup) root.findPreference(KEY_SECURITY_CATEGORY); if (securityCategory != null && mVisiblePattern != null) { securityCategory.removePreference(root.findPreference(KEY_VISIBLE_PATTERN)); } } // tactile feedback. Should be common to all unlock preference // screens. mTactileFeedback = (CheckBoxPreference) root.findPreference(KEY_TACTILE_FEEDBACK_ENABLED); if (!((Vibrator) getSystemService(Context.VIBRATOR_SERVICE)).hasVibrator()) { PreferenceGroup securityCategory = (PreferenceGroup) root.findPreference(KEY_SECURITY_CATEGORY); if (securityCategory != null && mTactileFeedback != null) { securityCategory.removePreference(mTactileFeedback); } } // Append the rest of the settings addPreferencesFromResource(R.xml.security_settings_misc); MSimTelephonyManager tm = MSimTelephonyManager.getDefault(); int numPhones = TelephonyManager.getDefault().getPhoneCount(); boolean disableLock = false; for (int i = 0; i < numPhones; i++) { // Disable SIM lock if sim card is missing or unknown // notice:cdma can also set sim lock if ((tm.getSimState(i) == TelephonyManager.SIM_STATE_ABSENT) || (tm.getSimState(i) == TelephonyManager.SIM_STATE_UNKNOWN)) { disableLock = true; } else { disableLock = false; break; } } if (disableLock) { root.findPreference(KEY_SIM_LOCK).setEnabled(false); } // Show password mShowPassword = (CheckBoxPreference) root.findPreference(KEY_SHOW_PASSWORD); // SIM/RUIM lock Preference iccLock = (Preference) root.findPreference(KEY_SIM_LOCK_SETTINGS); Intent intent = new Intent(); if (tm.isMultiSimEnabled()) { intent.setClassName( "com.android.settings", "com.android.settings.multisimsettings.MultiSimSettingTab"); intent.putExtra(SelectSubscription.PACKAGE, "com.android.settings"); intent.putExtra(SelectSubscription.TARGET_CLASS, "com.android.settings.IccLockSettings"); } else { intent.setClassName("com.android.settings", "com.android.settings.IccLockSettings"); } iccLock.setIntent(intent); // Credential storage mResetCredentials = root.findPreference(KEY_RESET_CREDENTIALS); mToggleAppInstallation = (CheckBoxPreference) findPreference(KEY_TOGGLE_INSTALL_APPLICATIONS); mToggleAppInstallation.setChecked(isNonMarketAppsAllowed()); return root; }
private void onDisconnect(Connection conn) { Log.i(TAG, "onDisconnect"); mVoicePrivacyState = false; final Call call = getCallFromMap(mCallMap, conn, false); if (call != null) { final boolean wasConferenced = call.getState() == State.CONFERENCED; updateCallFromConnection(call, conn, false); for (int i = 0; i < mListeners.size(); ++i) { mListeners.get(i).onDisconnect(call); } // If it was a conferenced call, we need to run the entire update // to make the proper changes to parent conference calls. if (wasConferenced) { onPhoneStateChanged(null); } mCallMap.remove(conn); } if (MSimTelephonyManager.getDefault().isMultiSimEnabled() && (call != null)) { mCallManager.clearDisconnected(call.getSubscription()); } else { mCallManager.clearDisconnected(); } PhoneGlobals.getInstance().updateWakeState(); }
/* package */ Call onNewRingingConnection(Connection conn) { Log.i(TAG, "onNewRingingConnection"); final Call call = getCallFromMap(mCallMap, conn, true); if (call != null) { Phone phone = conn.getCall().getPhone(); if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_GSM && mNextGsmCallIsForwarded) { call.setForwarded(true); mNextGsmCallIsForwarded = false; } updateCallFromConnection(call, conn, false); for (int i = 0; i < mListeners.size(); ++i) { mListeners.get(i).onIncoming(call); } if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { int subscription = conn.getCall().getPhone().getSubscription(); Log.i(TAG, "Setting Active sub : '" + subscription + "'"); PhoneUtils.setActiveSubscription(subscription); // if any local hold tones are playing then they need to be stoped. final MSimCallNotifier notifier = (MSimCallNotifier) PhoneGlobals.getInstance().notifier; notifier.manageLocalCallWaitingTone(); } } PhoneGlobals.getInstance().updateWakeState(); return call; }
protected Uri resolveIntent() { Intent intent = getIntent(); if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { mSubscription = MSimTelephonyManager.getDefault().getPreferredVoiceSubscription(); if (intent.getData() == null) { if (mSubscription == SUB1) { intent.setData(Uri.parse("content://iccmsim/adn")); } else if (mSubscription == SUB2) { intent.setData(Uri.parse("content://iccmsim/adn_sub2")); } else { if (DBG) log("resolveIntent: invalid subscription"); } } } else { if (intent.getData() == null) { intent.setData(Uri.parse("content://icc/adn")); } } return intent.getData(); }
private boolean isCardAbsent() { MSimTelephonyManager telManager = MSimTelephonyManager.getDefault(); return telManager.getSimState(mSubscription) == TelephonyManager.SIM_STATE_ABSENT; }
/** Returns a mask of capabilities for the connection such as merge, hold, etc. */ private int getCapabilitiesFor(Connection connection, Call call, boolean isForConference) { final boolean callIsActive = (call.getState() == Call.State.ACTIVE); final boolean callIsBackground = (call.getState() == Call.State.ONHOLD); final Phone phone = connection.getCall().getPhone(); boolean canAddCall = false; boolean canMergeCall = false; boolean canSwapCall = false; boolean canRespondViaText = false; boolean canMute = false; boolean canAddParticipant = false; boolean canModifyCall = false; boolean voicePrivacy = false; final boolean supportHold; final boolean canHold; final boolean genericConf = isForConference && (connection.getCall().getPhone().getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA); if (!MSimTelephonyManager.getDefault().isMultiSimEnabled()) { supportHold = PhoneUtils.okToSupportHold(mCallManager); canHold = (supportHold ? PhoneUtils.okToHoldCall(mCallManager) : false); // only applies to active calls if (callIsActive) { canMergeCall = PhoneUtils.okToMergeCalls(mCallManager); canSwapCall = PhoneUtils.okToSwapCalls(mCallManager); } canAddCall = PhoneUtils.okToAddCall(mCallManager); } else { final int subscription = call.getSubscription(); supportHold = PhoneUtils.okToSupportHold(mCallManager, subscription); canHold = (supportHold ? PhoneUtils.okToHoldCall(mCallManager, subscription) : false); // only applies to active calls if (callIsActive) { canMergeCall = PhoneUtils.okToMergeCalls(mCallManager, subscription); canSwapCall = PhoneUtils.okToSwapCalls(mCallManager, subscription); } canAddCall = PhoneUtils.okToAddCall(mCallManager, subscription); } if (callIsActive || callIsBackground) { canModifyCall = PhoneUtils.isVTModifyAllowed(connection); } canAddParticipant = PhoneUtils.canAddParticipant(mCallManager) && canAddCall; // "Mute": only enabled when the foreground call is ACTIVE. // (It's meaningless while on hold, or while DIALING/ALERTING.) // It's also explicitly disabled during emergency calls or if // emergency callback mode (ECM) is active. boolean isEmergencyCall = false; if (connection != null) { isEmergencyCall = PhoneNumberUtils.isLocalEmergencyNumber(connection.getAddress(), phone.getContext()); } boolean isECM = PhoneUtils.isPhoneInEcm(phone); if (isEmergencyCall || isECM) { // disable "Mute" item canMute = false; } else { canMute = callIsActive; } canRespondViaText = RejectWithTextMessageManager.allowRespondViaSmsForCall(call, connection); // special rules section! // CDMA always has Add if (phone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) { canAddCall = true; } // Voice Privacy for CDMA if ((phone.getPhoneType() == PhoneConstants.PHONE_TYPE_CDMA) && mVoicePrivacyState) { voicePrivacy = true; } int retval = 0x0; if (canHold) { retval |= Capabilities.HOLD; } if (supportHold) { retval |= Capabilities.SUPPORT_HOLD; } if (canAddCall) { retval |= Capabilities.ADD_CALL; } if (canMergeCall) { retval |= Capabilities.MERGE_CALLS; } if (canSwapCall) { retval |= Capabilities.SWAP_CALLS; } if (canRespondViaText) { retval |= Capabilities.RESPOND_VIA_TEXT; } if (canMute) { retval |= Capabilities.MUTE; } if (canAddParticipant) { retval |= Capabilities.ADD_PARTICIPANT; } if (genericConf) { retval |= Capabilities.GENERIC_CONFERENCE; } if (canModifyCall) { retval |= Capabilities.MODIFY_CALL; } if (voicePrivacy) { retval |= Capabilities.VOICE_PRIVACY; } return retval; }
@Override public void onCreate(Bundle icicle) { super.onCreate(icicle); addPreferencesFromResource(R.xml.device_info_settings); setStringSummary(KEY_FIRMWARE_VERSION, Build.VERSION.RELEASE); findPreference(KEY_FIRMWARE_VERSION).setEnabled(true); setValueSummary(KEY_BASEBAND_VERSION, "gsm.version.baseband"); setStringSummary(KEY_DEVICE_MODEL, Build.MODEL + getMsvSuffix()); setValueSummary(KEY_EQUIPMENT_ID, PROPERTY_EQUIPMENT_ID); setStringSummary(KEY_DEVICE_MODEL, Build.MODEL); setStringSummary(KEY_BUILD_NUMBER, Build.DISPLAY); findPreference(KEY_BUILD_NUMBER).setEnabled(true); findPreference(KEY_KERNEL_VERSION).setSummary(getFormattedKernelVersion()); setValueSummary(KEY_MOD_VERSION, "ro.cm.version"); findPreference(KEY_MOD_VERSION).setEnabled(true); setValueSummary(KEY_MOD_BUILD_DATE, "ro.build.date"); if (!SELinux.isSELinuxEnabled()) { String status = getResources().getString(R.string.selinux_status_disabled); setStringSummary(KEY_SELINUX_STATUS, status); } else if (!SELinux.isSELinuxEnforced()) { String status = getResources().getString(R.string.selinux_status_permissive); setStringSummary(KEY_SELINUX_STATUS, status); } findPreference(KEY_SELINUX_STATUS).setEnabled(true); if (MSimTelephonyManager.getDefault().isMultiSimEnabled()) { findPreference(KEY_STATUS) .getIntent() .setClassName("com.android.settings", "com.android.settings.deviceinfo.msim.MSimStatus"); } // Remove selinux information if property is not present removePreferenceIfPropertyMissing( getPreferenceScreen(), KEY_SELINUX_STATUS, PROPERTY_SELINUX_STATUS); String cpuInfo = getCPUInfo(); String memInfo = getMemInfo(); // Only the owner should see the Updater settings, if it exists if (UserHandle.myUserId() == UserHandle.USER_OWNER) { removePreferenceIfPackageNotInstalled(findPreference(KEY_CM_UPDATES)); } else { getPreferenceScreen().removePreference(findPreference(KEY_CM_UPDATES)); } if (cpuInfo != null) { setStringSummary(KEY_DEVICE_CPU, cpuInfo); } else { getPreferenceScreen().removePreference(findPreference(KEY_DEVICE_CPU)); } if (memInfo != null) { setStringSummary(KEY_DEVICE_MEMORY, memInfo); } else { getPreferenceScreen().removePreference(findPreference(KEY_DEVICE_MEMORY)); } // Remove Safety information preference if PROPERTY_URL_SAFETYLEGAL is not set removePreferenceIfPropertyMissing( getPreferenceScreen(), "safetylegal", PROPERTY_URL_SAFETYLEGAL); // Remove Equipment id preference if FCC ID is not set by RIL removePreferenceIfPropertyMissing( getPreferenceScreen(), KEY_EQUIPMENT_ID, PROPERTY_EQUIPMENT_ID); // Remove Baseband version if wifi-only device if (Utils.isWifiOnly(getActivity()) || (MSimTelephonyManager.getDefault().isMultiSimEnabled())) { getPreferenceScreen().removePreference(findPreference(KEY_BASEBAND_VERSION)); } /* * Settings is a generic app and should not contain any device-specific * info. */ final Activity act = getActivity(); // These are contained in the "container" preference group PreferenceGroup parentPreference = (PreferenceGroup) findPreference(KEY_CONTAINER); 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_TEAM, Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY); // These are contained by the root preference screen parentPreference = getPreferenceScreen(); if (UserHandle.myUserId() == UserHandle.USER_OWNER) { Utils.updatePreferenceToSpecificActivityOrRemove( act, parentPreference, KEY_SYSTEM_UPDATE_SETTINGS, Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY); /* Make sure the activity is provided by who we want... */ if (findPreference(KEY_SYSTEM_UPDATE_SETTINGS) != null) removePreferenceIfPackageNotInstalled(findPreference(KEY_SYSTEM_UPDATE_SETTINGS)); } else { // Remove for secondary users removePreference(KEY_SYSTEM_UPDATE_SETTINGS); } Utils.updatePreferenceToSpecificActivityOrRemove( act, parentPreference, KEY_CONTRIBUTORS, Utils.UPDATE_PREFERENCE_FLAG_SET_TITLE_TO_MATCHING_ACTIVITY); // Read platform settings for additional system update setting removePreferenceIfBoolFalse( KEY_UPDATE_SETTING, R.bool.config_additional_system_update_setting_enable); // Remove regulatory information if not enabled. removePreferenceIfBoolFalse(KEY_REGULATORY_INFO, R.bool.config_show_regulatory_info); }
void loadTiles() { // Reset reference tiles mIMETile = null; // Filter items not compatible with device boolean cameraSupported = QSUtils.deviceSupportsCamera(); boolean bluetoothSupported = QSUtils.deviceSupportsBluetooth(); boolean mobileDataSupported = QSUtils.deviceSupportsMobileData(mContext); boolean lteSupported = QSUtils.deviceSupportsLte(mContext); boolean gpsSupported = QSUtils.deviceSupportsGps(mContext); boolean torchSupported = QSUtils.deviceSupportsTorch(mContext); if (!bluetoothSupported) { TILES_DEFAULT.remove(TILE_BLUETOOTH); } if (!mobileDataSupported) { TILES_DEFAULT.remove(TILE_WIFIAP); TILES_DEFAULT.remove(TILE_MOBILEDATA); TILES_DEFAULT.remove(TILE_NETWORKMODE); } if (!lteSupported) { TILES_DEFAULT.remove(TILE_LTE); } if (!gpsSupported) { TILES_DEFAULT.remove(TILE_GPS); } if (!torchSupported) { TILES_DEFAULT.remove(TILE_TORCH); } // Read the stored list of tiles ContentResolver resolver = mContext.getContentResolver(); LayoutInflater inflater = LayoutInflater.from(mContext); String tiles = Settings.System.getStringForUser(resolver, mSettingsKey, UserHandle.USER_CURRENT); if (tiles == null) { Log.i(TAG, "Default tiles being loaded"); tiles = TextUtils.join(TILE_DELIMITER, TILES_DEFAULT); } Log.i(TAG, "Tiles list: " + tiles); // Split out the tile names and add to the list boolean dockBatteryLoaded = false; NetworkController networkController = MSimTelephonyManager.getDefault().isMultiSimEnabled() ? mStatusBarService.mMSimNetworkController : mStatusBarService.mNetworkController; for (String tile : tiles.split("\\|")) { QuickSettingsTile qs = null; if (tile.equals(TILE_USER)) { qs = new UserTile(mContext, this, mHandler); } else if (tile.equals(TILE_BATTERY)) { qs = new BatteryTile(mContext, this, mStatusBarService.mBatteryController); } else if (tile.equals(TILE_SETTINGS)) { qs = new PreferencesTile(mContext, this); } else if (tile.equals(TILE_WIFI)) { qs = new WiFiTile(mContext, this, networkController); } else if (tile.equals(TILE_GPS)) { qs = new GPSTile(mContext, this, mStatusBarService.mLocationController); } else if (tile.equals(TILE_BLUETOOTH) && bluetoothSupported) { qs = new BluetoothTile(mContext, this, mStatusBarService.mBluetoothController); } else if (tile.equals(TILE_BRIGHTNESS)) { qs = new BrightnessTile(mContext, this); } else if (tile.equals(TILE_CAMERA) && cameraSupported) { qs = new CameraTile(mContext, this, mHandler); } else if (tile.equals(TILE_RINGER)) { qs = new RingerModeTile(mContext, this); } else if (tile.equals(TILE_SYNC)) { qs = new SyncTile(mContext, this, mHandler); } else if (tile.equals(TILE_WIFIAP) && mobileDataSupported) { qs = new WifiAPTile(mContext, this); } else if (tile.equals(TILE_SCREENTIMEOUT)) { qs = new ScreenTimeoutTile(mContext, this); } else if (tile.equals(TILE_MOBILEDATA) && mobileDataSupported) { qs = new MobileNetworkTile(mContext, this, networkController); } else if (tile.equals(TILE_LOCKSCREEN)) { qs = new ToggleLockscreenTile(mContext, this); } else if (tile.equals(TILE_NETWORKMODE) && mobileDataSupported) { qs = new MobileNetworkTypeTile(mContext, this, networkController); } else if (tile.equals(TILE_AUTOROTATE)) { qs = new AutoRotateTile(mContext, this); } else if (tile.equals(TILE_AIRPLANE)) { qs = new AirplaneModeTile(mContext, this, networkController); } else if (tile.equals(TILE_TORCH)) { qs = new TorchTile(mContext, this); } else if (tile.equals(TILE_SLEEP)) { qs = new SleepScreenTile(mContext, this); } else if (tile.equals(TILE_PROFILE)) { mTileStatusUris.add(Settings.System.getUriFor(Settings.System.SYSTEM_PROFILES_ENABLED)); if (QSUtils.systemProfilesEnabled(resolver)) { qs = new ProfileTile(mContext, this); } } else if (tile.equals(TILE_PERFORMANCE_PROFILE)) { if (QSUtils.deviceSupportsPerformanceProfiles(mContext)) { qs = new PerformanceProfileTile(mContext, this); } } else if (tile.equals(TILE_NFC)) { // User cannot add the NFC tile if the device does not support it // No need to check again here qs = new NfcTile(mContext, this); } else if (tile.equals(TILE_WIMAX)) { // Not available yet } else if (tile.equals(TILE_LTE)) { qs = new LteTile(mContext, this); } else if (tile.equals(TILE_QUIETHOURS)) { qs = new QuietHoursTile(mContext, this); } else if (tile.equals(TILE_VOLUME)) { qs = new VolumeTile(mContext, this); } else if (tile.equals(TILE_EXPANDEDDESKTOP)) { mTileStatusUris.add(Settings.System.getUriFor(Settings.System.EXPANDED_DESKTOP_STYLE)); if (QSUtils.expandedDesktopEnabled(resolver)) { qs = new ExpandedDesktopTile(mContext, this); } } else if (tile.equals(TILE_NETWORKADB)) { mTileStatusUris.add(Settings.Global.getUriFor(Settings.Global.ADB_ENABLED)); if (QSUtils.adbEnabled(resolver)) { qs = new NetworkAdbTile(mContext, this); } } else if (tile.equals(TILE_COMPASS)) { qs = new CompassTile(mContext, this); } else if (tile.equals(TILE_HEADS_UP)) { qs = new HeadsUpTile(mContext, this); } else if (tile.equals(TILE_THEMES)) { qs = new ThemesTile(mContext, this); } if (qs != null) { qs.setupQuickSettingsTile(inflater, mContainerView); mQuickSettingsTiles.add(qs); // Add dock battery beside main battery when possible if (qs instanceof BatteryTile) { loadDockBatteryTile(resolver, inflater); dockBatteryLoaded = true; } } } if (mRibbonMode) { return; } // Load the dynamic tiles // These toggles must be the last ones added to the view, as they will show // only when they are needed if (Settings.System.getIntForUser( resolver, Settings.System.QS_DYNAMIC_ALARM, 1, UserHandle.USER_CURRENT) == 1) { QuickSettingsTile qs = new AlarmTile(mContext, this); qs.setupQuickSettingsTile(inflater, mContainerView); mQuickSettingsTiles.add(qs); } if (Settings.System.getIntForUser( resolver, Settings.System.QS_DYNAMIC_BUGREPORT, 1, UserHandle.USER_CURRENT) == 1) { QuickSettingsTile qs = new BugReportTile(mContext, this, mHandler); qs.setupQuickSettingsTile(inflater, mContainerView); mQuickSettingsTiles.add(qs); } if (!dockBatteryLoaded) { loadDockBatteryTile(resolver, inflater); } if (Settings.System.getIntForUser( resolver, Settings.System.QS_DYNAMIC_WIFI, 1, UserHandle.USER_CURRENT) == 1) { QuickSettingsTile qs = new RemoteDisplayTile(mContext, this); qs.setupQuickSettingsTile(inflater, mContainerView); mQuickSettingsTiles.add(qs); } if (QSUtils.deviceSupportsImeSwitcher(mContext) && Settings.System.getIntForUser( resolver, Settings.System.QS_DYNAMIC_IME, 1, UserHandle.USER_CURRENT) == 1) { mIMETile = new InputMethodTile(mContext, this); mIMETile.setupQuickSettingsTile(inflater, mContainerView); mQuickSettingsTiles.add(mIMETile); } if (QSUtils.deviceSupportsUsbTether(mContext) && Settings.System.getIntForUser( resolver, Settings.System.QS_DYNAMIC_USBTETHER, 1, UserHandle.USER_CURRENT) == 1) { QuickSettingsTile qs = new UsbTetherTile(mContext, this); qs.setupQuickSettingsTile(inflater, mContainerView); mQuickSettingsTiles.add(qs); } if (Settings.System.getIntForUser( resolver, Settings.System.QS_DYNAMIC_EQUALIZER, 1, UserHandle.USER_CURRENT) == 1) { QuickSettingsTile qs = new EqualizerTile(mContext, this); qs.setupQuickSettingsTile(inflater, mContainerView); mQuickSettingsTiles.add(qs); } }