diff options
Diffstat (limited to 'src/com/android')
31 files changed, 628 insertions, 69 deletions
diff --git a/src/com/android/settings/DisplaySettings.java b/src/com/android/settings/DisplaySettings.java index 9a62412704..19d06d66be 100644 --- a/src/com/android/settings/DisplaySettings.java +++ b/src/com/android/settings/DisplaySettings.java @@ -27,6 +27,7 @@ import com.android.settings.display.LiftToWakePreferenceController; import com.android.settings.display.ScreenSaverPreferenceController; import com.android.settings.display.ShowOperatorNamePreferenceController; import com.android.settings.display.TapToWakePreferenceController; +import com.android.settings.display.TapToSleepPreferenceController; import com.android.settings.display.ThemePreferenceController; import com.android.settings.display.VrDisplayPreferenceController; import com.android.settings.search.BaseSearchIndexProvider; @@ -78,6 +79,7 @@ public class DisplaySettings extends DashboardFragment { controllers.add(new LiftToWakePreferenceController(context)); controllers.add(new ScreenSaverPreferenceController(context)); controllers.add(new TapToWakePreferenceController(context)); + controllers.add(new TapToSleepPreferenceController(context)); controllers.add(new VrDisplayPreferenceController(context)); controllers.add(new ShowOperatorNamePreferenceController(context)); controllers.add(new ThemePreferenceController(context)); diff --git a/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizardActivity.java b/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizardActivity.java index 7a28e3917e..255c6acf24 100644 --- a/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizardActivity.java +++ b/src/com/android/settings/accessibility/AccessibilitySettingsForSetupWizardActivity.java @@ -23,6 +23,7 @@ import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.Menu; +import android.view.View; import android.view.accessibility.AccessibilityEvent; import androidx.annotation.VisibleForTesting; @@ -106,6 +107,9 @@ public class AccessibilitySettingsForSetupWizardActivity extends SettingsActivit super.onCreate(savedState); applyTheme(); tryLaunchFontSizeSettings(); + if (mCollapsingToolbarLayout != null) { + mCollapsingToolbarLayout.setVisibility(View.GONE); + } findViewById(R.id.content_parent).setFitsSystemWindows(false); } diff --git a/src/com/android/settings/applications/AppStorageSettings.java b/src/com/android/settings/applications/AppStorageSettings.java index 91eeace0fd..720bddb73f 100644 --- a/src/com/android/settings/applications/AppStorageSettings.java +++ b/src/com/android/settings/applications/AppStorageSettings.java @@ -208,13 +208,6 @@ public class AppStorageSettings extends AppInfoWithHeader if (mAppsControlDisallowedAdmin != null && !mAppsControlDisallowedBySystem) { RestrictedLockUtils.sendShowAdminSupportDetailsIntent( getActivity(), mAppsControlDisallowedAdmin); - } else if (mAppEntry.info.manageSpaceActivityName != null) { - if (!Utils.isMonkeyRunning()) { - Intent intent = new Intent(Intent.ACTION_DEFAULT); - intent.setClassName(mAppEntry.info.packageName, - mAppEntry.info.manageSpaceActivityName); - startActivityForResult(intent, REQUEST_MANAGE_SPACE); - } } else { showDialogInner(DLG_CLEAR_DATA, 0); } @@ -298,11 +291,8 @@ public class AppStorageSettings extends AppInfoWithHeader if (appHasSpaceManagementUI) { intent.setClassName(mAppEntry.info.packageName, mAppEntry.info.manageSpaceActivityName); } - final boolean isManageSpaceActivityAvailable = - getPackageManager().resolveActivity(intent, 0) != null; - if ((!appHasSpaceManagementUI && appRestrictsClearingData) - || !isManageSpaceActivityAvailable) { + if (!appHasSpaceManagementUI && appRestrictsClearingData) { mButtonsPref .setButton1Text(R.string.clear_user_data_text) .setButton1Icon(R.drawable.ic_settings_delete) diff --git a/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java b/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java index e1ea8e47af..ed82166036 100755 --- a/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java +++ b/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java @@ -164,6 +164,7 @@ public class AppInfoDashboardFragment extends DashboardFragment .setParentFragment(this); use(AppStoragePreferenceController.class).setParentFragment(this); use(AppVersionPreferenceController.class).setParentFragment(this); + use(AppPackageNamePreferenceController.class).setParentFragment(this); use(InstantAppDomainsPreferenceController.class).setParentFragment(this); use(ExtraAppInfoPreferenceController.class).setPackageName(packageName); diff --git a/src/com/android/settings/applications/appinfo/AppPackageNamePreferenceController.java b/src/com/android/settings/applications/appinfo/AppPackageNamePreferenceController.java new file mode 100644 index 0000000000..bd4f12f508 --- /dev/null +++ b/src/com/android/settings/applications/appinfo/AppPackageNamePreferenceController.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2018 The LineageOS Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settings.applications.appinfo; + +import android.content.Context; + +public class AppPackageNamePreferenceController extends AppInfoPreferenceControllerBase { + + public AppPackageNamePreferenceController(Context context, String key) { + super(context, key); + } + + @Override + public CharSequence getSummary() { + return mParent.getPackageInfo().packageName; + } +} diff --git a/src/com/android/settings/applications/manageapplications/ManageApplications.java b/src/com/android/settings/applications/manageapplications/ManageApplications.java index d20e570acb..6878c5a020 100644 --- a/src/com/android/settings/applications/manageapplications/ManageApplications.java +++ b/src/com/android/settings/applications/manageapplications/ManageApplications.java @@ -728,9 +728,11 @@ public class ManageApplications extends InstrumentedFragment } mOptionsMenu.findItem(R.id.advanced).setVisible(false); - mOptionsMenu.findItem(R.id.sort_order_alpha).setVisible(mListType == LIST_TYPE_STORAGE + mOptionsMenu.findItem(R.id.sort_order_alpha).setVisible( + (mListType == LIST_TYPE_STORAGE || mListType == LIST_TYPE_MAIN) && mSortOrder != R.id.sort_order_alpha); - mOptionsMenu.findItem(R.id.sort_order_size).setVisible(mListType == LIST_TYPE_STORAGE + mOptionsMenu.findItem(R.id.sort_order_size).setVisible( + (mListType == LIST_TYPE_STORAGE || mListType == LIST_TYPE_MAIN) && mSortOrder != R.id.sort_order_size); mOptionsMenu.findItem(R.id.show_system).setVisible(!mShowSystem diff --git a/src/com/android/settings/connecteddevice/NfcAndPaymentFragmentController.java b/src/com/android/settings/connecteddevice/NfcAndPaymentFragmentController.java index ee0021ec95..f16dd378db 100644 --- a/src/com/android/settings/connecteddevice/NfcAndPaymentFragmentController.java +++ b/src/com/android/settings/connecteddevice/NfcAndPaymentFragmentController.java @@ -16,21 +16,47 @@ package com.android.settings.connecteddevice; +import android.content.BroadcastReceiver; import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; import android.content.pm.PackageManager; import android.nfc.NfcAdapter; import android.os.UserManager; +import androidx.preference.Preference; +import androidx.preference.PreferenceScreen; + import com.android.settings.R; import com.android.settings.core.BasePreferenceController; +import com.android.settingslib.core.lifecycle.LifecycleObserver; +import com.android.settingslib.core.lifecycle.events.OnResume; +import com.android.settingslib.core.lifecycle.events.OnStop; /** * Controller that used to show NFC and payment features */ -public class NfcAndPaymentFragmentController extends BasePreferenceController { +public class NfcAndPaymentFragmentController extends BasePreferenceController + implements LifecycleObserver, OnResume, OnStop { private final NfcAdapter mNfcAdapter; private final PackageManager mPackageManager; private final UserManager mUserManager; + private final IntentFilter mIntentFilter; + private Preference mPreference; + + private final BroadcastReceiver mReceiver = new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + if (mPreference == null) { + return; + } + + final String action = intent.getAction(); + if (NfcAdapter.ACTION_ADAPTER_STATE_CHANGED.equals(action)) { + refreshSummary(mPreference); + } + } + }; public NfcAndPaymentFragmentController(Context context, String preferenceKey) { super(context, preferenceKey); @@ -38,6 +64,15 @@ public class NfcAndPaymentFragmentController extends BasePreferenceController { mPackageManager = context.getPackageManager(); mUserManager = context.getSystemService(UserManager.class); mNfcAdapter = NfcAdapter.getDefaultAdapter(context); + + mIntentFilter = isNfcAvailable() + ? new IntentFilter(NfcAdapter.ACTION_ADAPTER_STATE_CHANGED) : null; + } + + @Override + public void displayPreference(PreferenceScreen screen) { + super.displayPreference(screen); + mPreference = screen.findPreference(getPreferenceKey()); } @Override @@ -61,4 +96,26 @@ public class NfcAndPaymentFragmentController extends BasePreferenceController { } return null; } + + @Override + public void onStop() { + if (!isNfcAvailable()) { + return; + } + + mContext.unregisterReceiver(mReceiver); + } + + @Override + public void onResume() { + if (!isNfcAvailable()) { + return; + } + + mContext.registerReceiver(mReceiver, mIntentFilter); + } + + private boolean isNfcAvailable() { + return mNfcAdapter != null; + } } diff --git a/src/com/android/settings/connecteddevice/usb/UsbBackend.java b/src/com/android/settings/connecteddevice/usb/UsbBackend.java index 15922005d4..d54851709b 100644 --- a/src/com/android/settings/connecteddevice/usb/UsbBackend.java +++ b/src/com/android/settings/connecteddevice/usb/UsbBackend.java @@ -164,6 +164,30 @@ public class UsbBackend { && mPortStatus.isRoleCombinationSupported(POWER_ROLE_SOURCE, DATA_ROLE_HOST); } + public boolean isSingleDataRoleSupported() { + return mPort != null && mPortStatus != null + && ((!mPortStatus + .isRoleCombinationSupported(POWER_ROLE_SINK, DATA_ROLE_HOST) + && !mPortStatus + .isRoleCombinationSupported(POWER_ROLE_SOURCE, DATA_ROLE_HOST)) + || (!mPortStatus + .isRoleCombinationSupported(POWER_ROLE_SINK, DATA_ROLE_DEVICE) + && !mPortStatus + .isRoleCombinationSupported(POWER_ROLE_SOURCE, DATA_ROLE_DEVICE))); + } + + public boolean isSinglePowerRoleSupported() { + return mPort != null && mPortStatus != null + && ((!mPortStatus + .isRoleCombinationSupported(POWER_ROLE_SINK, DATA_ROLE_DEVICE) + && !mPortStatus + .isRoleCombinationSupported(POWER_ROLE_SINK, DATA_ROLE_HOST)) + || (!mPortStatus + .isRoleCombinationSupported(POWER_ROLE_SOURCE, DATA_ROLE_DEVICE) + && !mPortStatus + .isRoleCombinationSupported(POWER_ROLE_SOURCE, DATA_ROLE_HOST))); + } + public static String usbFunctionsToString(long functions) { // TODO replace with UsbManager.usbFunctionsToString once supported by Roboelectric return Long.toBinaryString(functions); diff --git a/src/com/android/settings/connecteddevice/usb/UsbDetailsDataRoleController.java b/src/com/android/settings/connecteddevice/usb/UsbDetailsDataRoleController.java index 411bc1dce8..4f024a7074 100644 --- a/src/com/android/settings/connecteddevice/usb/UsbDetailsDataRoleController.java +++ b/src/com/android/settings/connecteddevice/usb/UsbDetailsDataRoleController.java @@ -113,7 +113,8 @@ public class UsbDetailsDataRoleController extends UsbDetailsController @Override public boolean isAvailable() { - return !Utils.isMonkeyRunning(); + return !Utils.isMonkeyRunning() + && !mUsbBackend.isSingleDataRoleSupported(); } @Override diff --git a/src/com/android/settings/connecteddevice/usb/UsbDetailsPowerRoleController.java b/src/com/android/settings/connecteddevice/usb/UsbDetailsPowerRoleController.java index 13b3076e6f..e8ff68411c 100644 --- a/src/com/android/settings/connecteddevice/usb/UsbDetailsPowerRoleController.java +++ b/src/com/android/settings/connecteddevice/usb/UsbDetailsPowerRoleController.java @@ -123,7 +123,8 @@ public class UsbDetailsPowerRoleController extends UsbDetailsController @Override public boolean isAvailable() { - return !Utils.isMonkeyRunning(); + return !Utils.isMonkeyRunning() + && !mUsbBackend.isSinglePowerRoleSupported(); } @Override diff --git a/src/com/android/settings/development/NotificationChannelWarningsPreferenceController.java b/src/com/android/settings/development/NotificationChannelWarningsPreferenceController.java index 775b70871f..104fcde17d 100644 --- a/src/com/android/settings/development/NotificationChannelWarningsPreferenceController.java +++ b/src/com/android/settings/development/NotificationChannelWarningsPreferenceController.java @@ -80,6 +80,6 @@ public class NotificationChannelWarningsPreferenceController extends @VisibleForTesting boolean isDebuggable() { - return Build.IS_DEBUGGABLE; + return Build.IS_ENG; } } diff --git a/src/com/android/settings/development/qstile/DevelopmentTilePreferenceController.java b/src/com/android/settings/development/qstile/DevelopmentTilePreferenceController.java index c271bc99b9..6e48c10630 100644 --- a/src/com/android/settings/development/qstile/DevelopmentTilePreferenceController.java +++ b/src/com/android/settings/development/qstile/DevelopmentTilePreferenceController.java @@ -96,15 +96,15 @@ public class DevelopmentTilePreferenceController extends BasePreferenceControlle @Override public boolean onPreferenceChange(Preference preference, Object newValue) { - boolean enabled = ((Boolean) newValue).booleanValue(); - ComponentName componentName = new ComponentName( + //boolean enabled = ((Boolean) newValue).booleanValue(); + ComponentName cn = new ComponentName( mContext.getPackageName(), preference.getKey()); - mPackageManager.setComponentEnabledSetting(componentName, enabled + mPackageManager.setComponentEnabledSetting(cn, (Boolean) newValue ? PackageManager.COMPONENT_ENABLED_STATE_ENABLED : PackageManager.COMPONENT_ENABLED_STATE_DISABLED, PackageManager.DONT_KILL_APP); - try { + /*try { if (mStatusBarService != null) { if (enabled) { mStatusBarService.addTile(componentName); @@ -115,7 +115,7 @@ public class DevelopmentTilePreferenceController extends BasePreferenceControlle } catch (RemoteException e) { Log.e(TAG, "Failed to modify QS tile for component " + componentName.toString(), e); - } + }*/ return true; } } diff --git a/src/com/android/settings/deviceinfo/BuildNumberPreferenceController.java b/src/com/android/settings/deviceinfo/BuildNumberPreferenceController.java index c09ea02608..62ae3b621d 100644 --- a/src/com/android/settings/deviceinfo/BuildNumberPreferenceController.java +++ b/src/com/android/settings/deviceinfo/BuildNumberPreferenceController.java @@ -78,7 +78,7 @@ public class BuildNumberPreferenceController extends BasePreferenceController im @Override public CharSequence getSummary() { - return BidiFormatter.getInstance().unicodeWrap(Build.DISPLAY); + return BidiFormatter.getInstance().unicodeWrap(Build.ID); } @Override diff --git a/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java b/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java index dcfb0e8efe..13b7df75e6 100644 --- a/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java +++ b/src/com/android/settings/deviceinfo/aboutphone/MyDeviceInfoFragment.java @@ -36,7 +36,6 @@ import com.android.settings.deviceinfo.FccEquipmentIdPreferenceController; import com.android.settings.deviceinfo.FeedbackPreferenceController; import com.android.settings.deviceinfo.IpAddressPreferenceController; import com.android.settings.deviceinfo.ManualPreferenceController; -import com.android.settings.deviceinfo.PhoneNumberPreferenceController; import com.android.settings.deviceinfo.RegulatoryInfoPreferenceController; import com.android.settings.deviceinfo.SafetyInfoPreferenceController; import com.android.settings.deviceinfo.SoftwareVersionPreferenceController; @@ -98,7 +97,6 @@ public class MyDeviceInfoFragment extends DashboardFragment use(DeviceNamePreferenceController.class).setHost(this /* parent */); mBuildNumberPreferenceController = use(BuildNumberPreferenceController.class); mBuildNumberPreferenceController.setHost(this /* parent */); - use(PhoneNumberPreferenceController.class).init(getSettingsLifecycle()); } @Override diff --git a/src/com/android/settings/deviceinfo/firmwareversion/BasebandFormatter.java b/src/com/android/settings/deviceinfo/firmwareversion/BasebandFormatter.java new file mode 100644 index 0000000000..9dca245d5f --- /dev/null +++ b/src/com/android/settings/deviceinfo/firmwareversion/BasebandFormatter.java @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2019 The PixelExperience Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settings.deviceinfo.firmwareversion; + +public class BasebandFormatter { + public static String getFormattedBaseband(String baseband){ + if (baseband.contains(",")) { + String[] splitBaseband = baseband.split(","); + if (splitBaseband.length > 1 && splitBaseband[0].equals(splitBaseband[1])) { + baseband = splitBaseband[0]; + } + } + return baseband; + } +} diff --git a/src/com/android/settings/deviceinfo/firmwareversion/BasebandVersionPreferenceController.java b/src/com/android/settings/deviceinfo/firmwareversion/BasebandVersionPreferenceController.java index 1507ddc80b..bb0a8454e4 100644 --- a/src/com/android/settings/deviceinfo/firmwareversion/BasebandVersionPreferenceController.java +++ b/src/com/android/settings/deviceinfo/firmwareversion/BasebandVersionPreferenceController.java @@ -53,7 +53,8 @@ public class BasebandVersionPreferenceController extends BasePreferenceControlle } } } - return SystemProperties.get(BASEBAND_PROPERTY, - mContext.getString(R.string.device_info_default)); + return BasebandFormatter.getFormattedBaseband( + SystemProperties.get(BASEBAND_PROPERTY, + mContext.getString(R.string.device_info_default))); } } diff --git a/src/com/android/settings/deviceinfo/firmwareversion/CustomFirmwareVersionPreferenceController.java b/src/com/android/settings/deviceinfo/firmwareversion/CustomFirmwareVersionPreferenceController.java new file mode 100644 index 0000000000..292fee2c43 --- /dev/null +++ b/src/com/android/settings/deviceinfo/firmwareversion/CustomFirmwareVersionPreferenceController.java @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settings.deviceinfo.firmwareversion; + +import android.content.Context; +import android.os.SystemProperties; + +import androidx.preference.Preference; + +import com.android.settings.R; +import com.android.settings.core.BasePreferenceController; + +public class CustomFirmwareVersionPreferenceController extends BasePreferenceController { + + public CustomFirmwareVersionPreferenceController(Context context, String preferenceKey) { + super(context, preferenceKey); + } + + @Override + public int getAvailabilityStatus() { + return AVAILABLE; + } + + @Override + public CharSequence getSummary() { + String[] myVer = SystemProperties.get("ro.ice.version").split("-"); + if (!myVer[1].isEmpty() && !myVer[4].isEmpty()) + return "Sugisawa " + myVer[1] + " | " + myVer[4]; + else + return mContext.getString(R.string.unknown); + } +} diff --git a/src/com/android/settings/deviceinfo/firmwareversion/SimpleBuildNumberPreferenceController.java b/src/com/android/settings/deviceinfo/firmwareversion/SimpleBuildNumberPreferenceController.java index 53f5ff9aa9..1c84f2eab3 100644 --- a/src/com/android/settings/deviceinfo/firmwareversion/SimpleBuildNumberPreferenceController.java +++ b/src/com/android/settings/deviceinfo/firmwareversion/SimpleBuildNumberPreferenceController.java @@ -36,6 +36,6 @@ public class SimpleBuildNumberPreferenceController extends BasePreferenceControl @Override public CharSequence getSummary() { - return BidiFormatter.getInstance().unicodeWrap(Build.DISPLAY); + return BidiFormatter.getInstance().unicodeWrap(Build.ID); } } diff --git a/src/com/android/settings/display/ColorModePreferenceController.java b/src/com/android/settings/display/ColorModePreferenceController.java index 6cd4867b58..14a2241481 100644 --- a/src/com/android/settings/display/ColorModePreferenceController.java +++ b/src/com/android/settings/display/ColorModePreferenceController.java @@ -28,8 +28,11 @@ public class ColorModePreferenceController extends BasePreferenceController { @Override public int getAvailabilityStatus() { + final int[] availableColorModes = mContext.getResources().getIntArray( + com.android.internal.R.array.config_availableColorModes); return mContext.getSystemService(ColorDisplayManager.class) .isDeviceColorManaged() + && availableColorModes.length > 0 && !ColorDisplayManager.areAccessibilityTransformsEnabled(mContext) ? AVAILABLE : DISABLED_FOR_USER; } diff --git a/src/com/android/settings/display/TapToSleepPreferenceController.java b/src/com/android/settings/display/TapToSleepPreferenceController.java new file mode 100644 index 0000000000..718046ca8d --- /dev/null +++ b/src/com/android/settings/display/TapToSleepPreferenceController.java @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * Copyright (C) 2022 Project ICE + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the + * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ +package com.android.settings.display; + +import android.content.Context; +import android.provider.Settings; + +import androidx.preference.Preference; +import androidx.preference.SwitchPreference; + +import com.android.settings.core.PreferenceControllerMixin; +import com.android.settingslib.core.AbstractPreferenceController; + +public class TapToSleepPreferenceController extends AbstractPreferenceController implements + PreferenceControllerMixin, Preference.OnPreferenceChangeListener { + + private static final String KEY_TAP_TO_SLEEP = "tap_to_sleep"; + + public TapToSleepPreferenceController(Context context) { + super(context); + } + + @Override + public String getPreferenceKey() { + return KEY_TAP_TO_SLEEP; + } + + @Override + public boolean isAvailable() { + return true; + } + + @Override + public void updateState(Preference preference) { + int value = Settings.Secure.getInt( + mContext.getContentResolver(), Settings.Secure.DOUBLE_TAP_SLEEP_GESTURE, 0); + ((SwitchPreference) preference).setChecked(value != 0); + } + + @Override + public boolean onPreferenceChange(Preference preference, Object newValue) { + boolean value = (Boolean) newValue; + Settings.Secure.putInt( + mContext.getContentResolver(), Settings.Secure.DOUBLE_TAP_SLEEP_GESTURE, value ? 1 : 0); + return true; + } +} diff --git a/src/com/android/settings/gestures/GesturesSettingPreferenceController.java b/src/com/android/settings/gestures/GesturesSettingPreferenceController.java index ff069ab358..1532e0fadc 100644 --- a/src/com/android/settings/gestures/GesturesSettingPreferenceController.java +++ b/src/com/android/settings/gestures/GesturesSettingPreferenceController.java @@ -77,6 +77,8 @@ public class GesturesSettingPreferenceController extends BasePreferenceControlle controllers.add(new DoubleTapScreenPreferenceController(context, FAKE_PREF_KEY) .setConfig(ambientDisplayConfiguration)); controllers.add(new PreventRingingParentPreferenceController(context, FAKE_PREF_KEY)); + controllers.add(new VolumeButtonMusicControlPreferenceController(context, FAKE_PREF_KEY)); + controllers.add(new PowerButtonTorchGesturePreferenceController(context, FAKE_PREF_KEY)); return controllers; } } diff --git a/src/com/android/settings/gestures/HideNavbarPreferenceController.java b/src/com/android/settings/gestures/HideNavbarPreferenceController.java new file mode 100644 index 0000000000..d2f2ed8278 --- /dev/null +++ b/src/com/android/settings/gestures/HideNavbarPreferenceController.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2021 The Android Open Source Project + * Copyright (C) 2022 Project ICE + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settings.gestures; + +import android.content.Context; +import android.provider.Settings; + +import com.android.settings.R; +import com.android.settings.core.TogglePreferenceController; + +public class HideNavbarPreferenceController extends TogglePreferenceController { + + public HideNavbarPreferenceController(Context context, String key) { + super(context, key); + } + + @Override + public boolean isChecked() { + boolean onByDefault = true; + return Settings.Secure.getInt(mContext.getContentResolver(), + Settings.Secure.NAVIGATION_BAR_HINT, onByDefault ? 1 : 0) + == 1; + } + + @Override + public boolean setChecked(boolean isChecked) { + return Settings.Secure.putInt(mContext.getContentResolver(), + Settings.Secure.NAVIGATION_BAR_HINT, isChecked ? 1 : 0); + } + + @Override + public int getAvailabilityStatus() { + return SystemNavigationPreferenceController.isGestureAvailable(mContext) ? AVAILABLE + : UNSUPPORTED_ON_DEVICE; + } + + @Override + public int getSliceHighlightMenuRes() { + return R.string.menu_key_system; + } +} diff --git a/src/com/android/settings/gestures/PowerButtonTorchGesturePreferenceController.java b/src/com/android/settings/gestures/PowerButtonTorchGesturePreferenceController.java new file mode 100644 index 0000000000..b8ded8fea0 --- /dev/null +++ b/src/com/android/settings/gestures/PowerButtonTorchGesturePreferenceController.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settings.gestures; + +import static android.provider.Settings.System.TORCH_POWER_BUTTON_GESTURE; + +import android.content.Context; +import android.content.pm.PackageManager; +import android.content.SharedPreferences; +import android.provider.Settings; +import android.text.TextUtils; + +public class PowerButtonTorchGesturePreferenceController extends GesturePreferenceController { + + private final int ON = 1; + private final int OFF = 0; + + private final String PREF_KEY_VIDEO = "gesture_quick_torch_video"; + + public PowerButtonTorchGesturePreferenceController(Context context, String key) { + super(context, key); + } + + @Override + public int getAvailabilityStatus() { + return mContext.getPackageManager() + .hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH) ? AVAILABLE : + UNSUPPORTED_ON_DEVICE; + } + + @Override + public boolean isSliceable() { + return TextUtils.equals(getPreferenceKey(), "power_button_torch"); + } + + @Override + public String getVideoPrefKey() { + return PREF_KEY_VIDEO; + } + + @Override + public boolean isChecked() { + return Settings.System.getInt(mContext.getContentResolver(), TORCH_POWER_BUTTON_GESTURE, + OFF) != OFF; + } + + @Override + public boolean setChecked(boolean isChecked) { + return Settings.System.putInt(mContext.getContentResolver(), TORCH_POWER_BUTTON_GESTURE, + isChecked ? ON : OFF); + } +} diff --git a/src/com/android/settings/gestures/PowerButtonTorchSettings.java b/src/com/android/settings/gestures/PowerButtonTorchSettings.java new file mode 100644 index 0000000000..93d38b8b9f --- /dev/null +++ b/src/com/android/settings/gestures/PowerButtonTorchSettings.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settings.gestures; + +import android.content.Context; +import android.os.Bundle; +import android.provider.SearchIndexableResource; + +import com.android.internal.logging.nano.MetricsProto; +import com.android.settings.R; +import com.android.settings.dashboard.DashboardFragment; +import com.android.settings.search.BaseSearchIndexProvider; +import com.android.settingslib.core.AbstractPreferenceController; +import com.android.settingslib.core.lifecycle.Lifecycle; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class PowerButtonTorchSettings extends DashboardFragment { + + private static final String TAG = "PowerButtonTorchSettings"; + + @Override + public void onAttach(Context context) { + super.onAttach(context); + } + + @Override + public int getMetricsCategory() { + return -1; + } + + @Override + protected String getLogTag() { + return TAG; + } + + @Override + protected int getPreferenceScreenResId() { + return R.xml.power_button_torch; + } + + public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = + new BaseSearchIndexProvider() { + @Override + public List<SearchIndexableResource> getXmlResourcesToIndex( + Context context, boolean enabled) { + final SearchIndexableResource sir = new SearchIndexableResource(context); + sir.xmlResId = R.xml.power_button_torch; + return Arrays.asList(sir); + } + }; +} diff --git a/src/com/android/settings/gestures/VolumeButtonMusicControlGestureSettings.java b/src/com/android/settings/gestures/VolumeButtonMusicControlGestureSettings.java new file mode 100644 index 0000000000..b3a5e80036 --- /dev/null +++ b/src/com/android/settings/gestures/VolumeButtonMusicControlGestureSettings.java @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2019 Paranoid Android + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settings.gestures; + +import com.android.settings.R; +import com.android.settings.dashboard.DashboardFragment; +import com.android.settings.search.BaseSearchIndexProvider; + +public class VolumeButtonMusicControlGestureSettings extends DashboardFragment { + + private static final String TAG = "VolumeButtonMusicControlGestureSettings"; + + @Override + public int getMetricsCategory() { + return -1; + } + + @Override + protected String getLogTag() { + return TAG; + } + + @Override + protected int getPreferenceScreenResId() { + return R.xml.volume_button_music_control_gesture_settings; + } + + public static final SearchIndexProvider SEARCH_INDEX_DATA_PROVIDER = + new BaseSearchIndexProvider(R.xml.volume_button_music_control_gesture_settings); +} diff --git a/src/com/android/settings/gestures/VolumeButtonMusicControlPreferenceController.java b/src/com/android/settings/gestures/VolumeButtonMusicControlPreferenceController.java new file mode 100644 index 0000000000..1763980d12 --- /dev/null +++ b/src/com/android/settings/gestures/VolumeButtonMusicControlPreferenceController.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2019 Paranoid Android + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settings.gestures; + +import static android.provider.Settings.System.VOLBTN_MUSIC_CONTROLS; + +import android.content.Context; +import android.os.UserHandle; +import android.provider.Settings; +import android.text.TextUtils; + +public class VolumeButtonMusicControlPreferenceController extends GesturePreferenceController { + + private final int ON = 1; + private final int OFF = 0; + + private static final String PREF_KEY_VIDEO = "volume_button_music_control_video"; + + public VolumeButtonMusicControlPreferenceController(Context context, String key) { + super(context, key); + } + + @Override + public int getAvailabilityStatus() { + return AVAILABLE; + } + + @Override + public boolean isSliceable() { + return TextUtils.equals(getPreferenceKey(), "volume_button_music_control"); + } + + @Override + protected String getVideoPrefKey() { + return PREF_KEY_VIDEO; + } + + @Override + public boolean isChecked() { + return Settings.System.getIntForUser(mContext.getContentResolver(), VOLBTN_MUSIC_CONTROLS, + OFF, UserHandle.USER_CURRENT) == ON; + } + + @Override + public boolean setChecked(boolean isChecked) { + return Settings.System.putIntForUser(mContext.getContentResolver(), VOLBTN_MUSIC_CONTROLS, + isChecked ? ON : OFF, UserHandle.USER_CURRENT); + } +} diff --git a/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java b/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java index 5f208949e5..ec48c82ce4 100644 --- a/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java +++ b/src/com/android/settings/network/telephony/RenameMobileNetworkDialogFragment.java @@ -184,7 +184,10 @@ public class RenameMobileNetworkDialogFragment extends InstrumentedDialogFragmen phoneTitle.setVisibility(info.isOpportunistic() ? View.GONE : View.VISIBLE); final TextView phoneNumber = view.findViewById(R.id.number_value); - phoneNumber.setText(DeviceInfoUtils.getBidiFormattedPhoneNumber(getContext(), info)); + final String pn = DeviceInfoUtils.getBidiFormattedPhoneNumber(getContext(), info); + if (!TextUtils.isEmpty(pn)) { + phoneNumber.setText(pn); + } } @Override diff --git a/src/com/android/settings/slices/SlicesDatabaseHelper.java b/src/com/android/settings/slices/SlicesDatabaseHelper.java index 69ad702913..9daed69ea2 100644 --- a/src/com/android/settings/slices/SlicesDatabaseHelper.java +++ b/src/com/android/settings/slices/SlicesDatabaseHelper.java @@ -239,6 +239,6 @@ public class SlicesDatabaseHelper extends SQLiteOpenHelper { @VisibleForTesting String getBuildTag() { - return Build.FINGERPRINT; + return Build.VERSION.INCREMENTAL; } -}
\ No newline at end of file +} diff --git a/src/com/android/settings/vpn2/ConfigDialog.java b/src/com/android/settings/vpn2/ConfigDialog.java index bf0dfc9c5b..5657416784 100644 --- a/src/com/android/settings/vpn2/ConfigDialog.java +++ b/src/com/android/settings/vpn2/ConfigDialog.java @@ -524,25 +524,7 @@ class ConfigDialog extends AlertDialog implements TextWatcher, PackageManager.FEATURE_IPSEC_TUNNELS)) { Log.wtf(TAG, "FEATURE_IPSEC_TUNNELS missing from system"); } - // If the vpn is new or is not already a legacy type, - // don't allow the user to set the type to a legacy option. - // Set the mProfile.type to TYPE_IKEV2_IPSEC_USER_PASS if the VPN not exist - if (!mExists) { - mProfile.type = VpnProfile.TYPE_IKEV2_IPSEC_USER_PASS; - } - - // Remove all types which are legacy types from the typesList - if (!VpnProfile.isLegacyType(mProfile.type)) { - for (int i = mAllowedTypes.size() - 1; i >= 0; i--) { - // This must be removed from back to front in order to ensure index consistency - if (VpnProfile.isLegacyType(i)) { - mAllowedTypes.remove(i); - } - } - - types = mAllowedTypes.toArray(new String[0]); - } final ArrayAdapter<String> adapter = new ArrayAdapter<String>( getContext(), android.R.layout.simple_spinner_item, types); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java index 0c063db8a7..306576d102 100644 --- a/src/com/android/settings/wifi/WifiConfigController.java +++ b/src/com/android/settings/wifi/WifiConfigController.java @@ -166,6 +166,7 @@ public class WifiConfigController implements TextWatcher, private String mMultipleCertSetString; private String mUseSystemCertsString; private String mDoNotProvideEapUserCertString; + private String mDoNotValidateEapServerString; private Spinner mSecuritySpinner; @VisibleForTesting Spinner mEapMethodSpinner; @@ -272,6 +273,8 @@ public class WifiConfigController implements TextWatcher, mUseSystemCertsString = mContext.getString(R.string.wifi_use_system_certs); mDoNotProvideEapUserCertString = mContext.getString(R.string.wifi_do_not_provide_eap_user_cert); + mDoNotValidateEapServerString = + mContext.getString(R.string.wifi_do_not_validate_eap_server); mSsidScanButton = (ImageButton) mView.findViewById(R.id.ssid_scanner_button); mIpSettingsSpinner = (Spinner) mView.findViewById(R.id.ip_settings); @@ -544,7 +547,8 @@ public class WifiConfigController implements TextWatcher, // Disallow submit if the user has not selected a CA certificate for an EAP network // configuration. enabled = false; - } else if (mEapDomainView != null + } else if (!caCertSelection.equals(mDoNotValidateEapServerString) + && mEapDomainView != null && mView.findViewById(R.id.l_domain).getVisibility() != View.GONE && TextUtils.isEmpty(mEapDomainView.getText().toString())) { // Disallow submit if the user chooses to use a certificate for EAP server @@ -566,6 +570,7 @@ public class WifiConfigController implements TextWatcher, } void showWarningMessagesIfAppropriate() { + mView.findViewById(R.id.no_ca_cert_warning).setVisibility(View.GONE); mView.findViewById(R.id.no_user_cert_warning).setVisibility(View.GONE); mView.findViewById(R.id.no_domain_warning).setVisibility(View.GONE); mView.findViewById(R.id.ssid_too_long_warning).setVisibility(View.GONE); @@ -578,7 +583,13 @@ public class WifiConfigController implements TextWatcher, } if (mEapCaCertSpinner != null && mView.findViewById(R.id.l_ca_cert).getVisibility() != View.GONE) { - if (mEapDomainView != null + String caCertSelection = (String) mEapCaCertSpinner.getSelectedItem(); + if (caCertSelection.equals(mDoNotValidateEapServerString)) { + // Display warning if user chooses not to validate the EAP server with a + // user-supplied CA certificate in an EAP network configuration. + mView.findViewById(R.id.no_ca_cert_warning).setVisibility(View.VISIBLE); + } else if (!caCertSelection.equals(mUnspecifiedCertString) + && mEapDomainView != null && mView.findViewById(R.id.l_domain).getVisibility() != View.GONE && TextUtils.isEmpty(mEapDomainView.getText().toString())) { // Display warning if user chooses to use a certificate without restricting the @@ -719,7 +730,8 @@ public class WifiConfigController implements TextWatcher, config.enterpriseConfig.setCaCertificateAliases(null); config.enterpriseConfig.setCaPath(null); config.enterpriseConfig.setDomainSuffixMatch(mEapDomainView.getText().toString()); - if (caCert.equals(mUnspecifiedCertString)) { + if (caCert.equals(mUnspecifiedCertString) + || caCert.equals(mDoNotValidateEapServerString)) { // ca_cert already set to null, so do nothing. } else if (caCert.equals(mUseSystemCertsString)) { config.enterpriseConfig.setCaPath(SYSTEM_CA_STORE_PATH); @@ -753,7 +765,8 @@ public class WifiConfigController implements TextWatcher, } // Only set OCSP option if there is a valid CA certificate. - if (caCert.equals(mUnspecifiedCertString)) { + if (caCert.equals(mUnspecifiedCertString) + || caCert.equals(mDoNotValidateEapServerString)) { config.enterpriseConfig.setOcsp(WifiEnterpriseConfig.OCSP_NONE); } else { config.enterpriseConfig.setOcsp(mEapOcspSpinner.getSelectedItemPosition()); @@ -1057,7 +1070,7 @@ public class WifiConfigController implements TextWatcher, loadCertificates( mEapCaCertSpinner, androidKeystoreAliasLoader.getCaCertAliases(), - null /* noCertificateString */, + mDoNotValidateEapServerString /* noCertificateString */, false /* showMultipleCerts */, true /* showUsePreinstalledCertOption */); loadCertificates( @@ -1141,7 +1154,7 @@ public class WifiConfigController implements TextWatcher, } else { String[] caCerts = enterpriseConfig.getCaCertificateAliases(); if (caCerts == null) { - setSelection(mEapCaCertSpinner, mUnspecifiedCertString); + setSelection(mEapCaCertSpinner, mDoNotValidateEapServerString); } else if (caCerts.length == 1) { setSelection(mEapCaCertSpinner, caCerts[0]); } else { @@ -1152,7 +1165,7 @@ public class WifiConfigController implements TextWatcher, loadCertificates( mEapCaCertSpinner, androidKeystoreAliasLoader.getCaCertAliases(), - null /* noCertificateString */, + mDoNotValidateEapServerString /* noCertificateString */, true /* showMultipleCerts */, true /* showUsePreinstalledCertOption */); setSelection(mEapCaCertSpinner, mMultipleCertSetString); @@ -1285,7 +1298,8 @@ public class WifiConfigController implements TextWatcher, if (mView.findViewById(R.id.l_ca_cert).getVisibility() != View.GONE) { String eapCertSelection = (String) mEapCaCertSpinner.getSelectedItem(); - if (eapCertSelection.equals(mUnspecifiedCertString)) { + if (eapCertSelection.equals(mDoNotValidateEapServerString) + || eapCertSelection.equals(mUnspecifiedCertString)) { // Domain suffix matching is not relevant if the user hasn't chosen a CA // certificate yet, or chooses not to validate the EAP server. setDomainInvisible(); @@ -1546,8 +1560,7 @@ public class WifiConfigController implements TextWatcher, }).collect(Collectors.toList())); } - if (!TextUtils.isEmpty(noCertificateString) - && mAccessPointSecurity != AccessPoint.SECURITY_EAP_SUITE_B) { + if (mAccessPointSecurity != AccessPoint.SECURITY_EAP_SUITE_B) { certs.add(noCertificateString); } diff --git a/src/com/android/settings/wifi/WifiConfigController2.java b/src/com/android/settings/wifi/WifiConfigController2.java index e9206bc054..f1f0e15e6a 100644 --- a/src/com/android/settings/wifi/WifiConfigController2.java +++ b/src/com/android/settings/wifi/WifiConfigController2.java @@ -170,6 +170,7 @@ public class WifiConfigController2 implements TextWatcher, private String mMultipleCertSetString; private String mUseSystemCertsString; private String mDoNotProvideEapUserCertString; + private String mDoNotValidateEapServerString; @VisibleForTesting String mInstallCertsString; private Spinner mSecuritySpinner; @@ -271,6 +272,8 @@ public class WifiConfigController2 implements TextWatcher, mUseSystemCertsString = mContext.getString(R.string.wifi_use_system_certs); mDoNotProvideEapUserCertString = mContext.getString(R.string.wifi_do_not_provide_eap_user_cert); + mDoNotValidateEapServerString = + mContext.getString(R.string.wifi_do_not_validate_eap_server); mInstallCertsString = mContext.getString(R.string.wifi_install_credentials); mSsidScanButton = (ImageButton) mView.findViewById(R.id.ssid_scanner_button); @@ -533,7 +536,8 @@ public class WifiConfigController2 implements TextWatcher, // Disallow submit if the user has not selected a CA certificate for an EAP network // configuration. enabled = false; - } else if (mEapDomainView != null + } else if (!caCertSelection.equals(mDoNotValidateEapServerString) + && mEapDomainView != null && mView.findViewById(R.id.l_domain).getVisibility() != View.GONE && TextUtils.isEmpty(mEapDomainView.getText().toString())) { // Disallow submit if the user chooses to use a certificate for EAP server @@ -555,6 +559,7 @@ public class WifiConfigController2 implements TextWatcher, } void showWarningMessagesIfAppropriate() { + mView.findViewById(R.id.no_ca_cert_warning).setVisibility(View.GONE); mView.findViewById(R.id.no_user_cert_warning).setVisibility(View.GONE); mView.findViewById(R.id.no_domain_warning).setVisibility(View.GONE); mView.findViewById(R.id.ssid_too_long_warning).setVisibility(View.GONE); @@ -567,7 +572,13 @@ public class WifiConfigController2 implements TextWatcher, } if (mEapCaCertSpinner != null && mView.findViewById(R.id.l_ca_cert).getVisibility() != View.GONE) { - if (mEapDomainView != null + String caCertSelection = (String) mEapCaCertSpinner.getSelectedItem(); + if (caCertSelection.equals(mDoNotValidateEapServerString)) { + // Display warning if user chooses not to validate the EAP server with a + // user-supplied CA certificate in an EAP network configuration. + mView.findViewById(R.id.no_ca_cert_warning).setVisibility(View.VISIBLE); + } else if (!caCertSelection.equals(mUnspecifiedCertString) + && mEapDomainView != null && mView.findViewById(R.id.l_domain).getVisibility() != View.GONE && TextUtils.isEmpty(mEapDomainView.getText().toString())) { // Display warning if user chooses to use a certificate without restricting the @@ -718,7 +729,8 @@ public class WifiConfigController2 implements TextWatcher, config.enterpriseConfig.setCaCertificateAliases(null); config.enterpriseConfig.setCaPath(null); config.enterpriseConfig.setDomainSuffixMatch(mEapDomainView.getText().toString()); - if (caCert.equals(mUnspecifiedCertString)) { + if (caCert.equals(mUnspecifiedCertString) + || caCert.equals(mDoNotValidateEapServerString)) { // ca_cert already set to null, so do nothing. } else if (caCert.equals(mUseSystemCertsString)) { config.enterpriseConfig.setCaPath(SYSTEM_CA_STORE_PATH); @@ -751,7 +763,8 @@ public class WifiConfigController2 implements TextWatcher, } // Only set OCSP option if there is a valid CA certificate. - if (caCert.equals(mUnspecifiedCertString)) { + if (caCert.equals(mUnspecifiedCertString) + || caCert.equals(mDoNotValidateEapServerString)) { config.enterpriseConfig.setOcsp(WifiEnterpriseConfig.OCSP_NONE); } else { config.enterpriseConfig.setOcsp(mEapOcspSpinner.getSelectedItemPosition()); @@ -1051,7 +1064,7 @@ public class WifiConfigController2 implements TextWatcher, loadCertificates( mEapCaCertSpinner, androidKeystoreAliasLoader.getCaCertAliases(), - null /* noCertificateString */, + mDoNotValidateEapServerString /* noCertificateString */, false /* showMultipleCerts */, true /* showUsePreinstalledCertOption */); loadCertificates( @@ -1133,7 +1146,7 @@ public class WifiConfigController2 implements TextWatcher, } else { String[] caCerts = enterpriseConfig.getCaCertificateAliases(); if (caCerts == null) { - setSelection(mEapCaCertSpinner, mUnspecifiedCertString); + setSelection(mEapCaCertSpinner, mDoNotValidateEapServerString); } else if (caCerts.length == 1) { setSelection(mEapCaCertSpinner, caCerts[0]); } else { @@ -1143,7 +1156,7 @@ public class WifiConfigController2 implements TextWatcher, loadCertificates( mEapCaCertSpinner, androidKeystoreAliasLoader.getCaCertAliases(), - null /* noCertificateString */, + mDoNotValidateEapServerString /* noCertificateString */, true /* showMultipleCerts */, true /* showUsePreinstalledCertOption */); setSelection(mEapCaCertSpinner, mMultipleCertSetString); @@ -1276,7 +1289,8 @@ public class WifiConfigController2 implements TextWatcher, if (mView.findViewById(R.id.l_ca_cert).getVisibility() != View.GONE) { String eapCertSelection = (String) mEapCaCertSpinner.getSelectedItem(); - if (eapCertSelection.equals(mUnspecifiedCertString)) { + if (eapCertSelection.equals(mDoNotValidateEapServerString) + || eapCertSelection.equals(mUnspecifiedCertString)) { // Domain suffix matching is not relevant if the user hasn't chosen a CA // certificate yet, or chooses not to validate the EAP server. setDomainInvisible(); @@ -1539,8 +1553,7 @@ public class WifiConfigController2 implements TextWatcher, }).collect(Collectors.toList())); } - if (!TextUtils.isEmpty(noCertificateString) - && mWifiEntrySecurity != WifiEntry.SECURITY_EAP_SUITE_B) { + if (mWifiEntrySecurity != WifiEntry.SECURITY_EAP_SUITE_B) { certs.add(noCertificateString); } |