diff --git a/res/values-eu/strings.xml b/res/values-eu/strings.xml index 697ebb2a106..f5264484357 100644 --- a/res/values-eu/strings.xml +++ b/res/values-eu/strings.xml @@ -871,7 +871,7 @@ "Ez dago erabilgarri, Wifi-sareen bilaketa desaktibatuta dagoelako" "Erabiltzeko, hautatu sareen balorazioen hornitzaile bat" "Saihestu konexio ahulak" - "Ez erabili Wi-Fi sareak ez badute Interneteko konexio onik" + "Ez erabili wifi-sareak ez badute Interneteko konexio onik" "Erabili Interneteko konexio ona duten sareak soilik" "Konektatu sare irekietara" "Konektatu automatikoki kalitate handiko sare publikoetara" diff --git a/res/values-gl/strings.xml b/res/values-gl/strings.xml index 7febea83378..f5ca5f3753c 100644 --- a/res/values-gl/strings.xml +++ b/res/values-gl/strings.xml @@ -3361,8 +3361,8 @@ "Notificacións automáticas" "Prioridade das notificacións automáticas" "Define automaticamente como discretas as notificacións con prioridade baixa" - "Suxestións de accións e respostas" - "Mostra automaticamente suxestións de accións e respostas" + "Accións suxeridas e respostas" + "Mostra automaticamente accións suxeridas e respostas" "Permitir adiar notificacións" "Ocultar iconas das notificacións discretas" "As iconas das notificacións discretas non se mostran na barra de estado" diff --git a/res/values-in/strings.xml b/res/values-in/strings.xml index 286a90a1830..8e518526dac 100644 --- a/res/values-in/strings.xml +++ b/res/values-in/strings.xml @@ -572,7 +572,7 @@ "Cegah orang lain menggunakan perangkat ini tanpa izin Anda dengan mengaktifkan fitur perlindungan perangkat. Pilih kunci layar yang ingin Anda gunakan." "Cegah orang lain menggunakan ponsel ini tanpa izin Anda dengan mengaktifkan fitur perlindungan perangkat. Pilih kunci layar yang ingin Anda gunakan." "Pilih metode kunci layar cadangan" - "Pilih metode kunci layar backup" + "Pilih metode kunci layar cadangan" "Opsi kunci layar" "Opsi kunci layar" "Kunci layar" @@ -603,7 +603,7 @@ "Face unlock + PIN" "Face unlock + Sandi" "Lanjutkan tanpa face unlock" - "Anda dapat membuka kunci ponsel menggunakan wajah. Demi keamanan, opsi ini memerlukan kunci layar backup." + "Anda dapat membuka kunci ponsel menggunakan wajah. Demi keamanan, opsi ini memerlukan kunci layar cadangan." "Dinonaktifkan oleh admin, kebijakan enkripsi, atau penyimpanan kredensial" "Tidak ada" "Geser" @@ -1528,7 +1528,7 @@ "Penyimpanan portabel" "Siapkan nanti" "Format ^1 ini?" - "^1 perlu diformat untuk menyimpan aplikasi, file, dan media. \n\nMemformat akan menghapus konten yang ada di ^2. Agar konten tidak hilang, backup ke ^3 atau perangkat lain." + "^1 perlu diformat untuk menyimpan aplikasi, file, dan media. \n\nMemformat akan menghapus konten yang ada di ^2. Agar konten tidak hilang, cadangkan ke ^3 atau perangkat lain." "Format ^1" "Pindahkan konten ke ^1?" "Anda dapat memindahkan file, media, dan aplikasi tertentu ke ^1 ini. \n\nPemindahan ini akan mengosongkan ^2 dari penyimpanan tablet dan memerlukan waktu sekitar ^3." @@ -2603,12 +2603,12 @@ "Data pribadi" "Cadangkan data saya" "Mencadangkan data aplikasi, sandi Wi-Fi, dan setelan lainnya ke server Google" - "Akun backup" - "Kelola akun backup" + "Akun cadangan" + "Kelola akun cadangan" "Sertakan data aplikasi" "Pemulihan otomatis" - "Pulihkan backup setelan dan data saat menginstal ulang aplikasi" - "Layanan backup tidak aktif" + "Pulihkan cadangan setelan dan data saat menginstal ulang aplikasi" + "Layanan pencadangan tidak aktif" "Saat ini, tidak ada akun yang menyimpan data cadangan" "Berhenti mencadangkan sandi Wi-Fi, bookmark, setelan lainnya, dan data aplikasi, serta menghapus semua salinan di server Google?" @@ -3103,7 +3103,7 @@ "Akun" "Tidak ada akun yang ditambahkan" "Aplikasi default" - "Bahasa, gestur, waktu, backup" + "Bahasa, gestur, waktu, pencadangan" "Setelan" "wifi, wi-fi, sambungan jaringan, internet, nirkabel, data, wi fi" "Notifikasi Wi‑Fi, notifikasi wi‑fi" diff --git a/res/values-pl/strings.xml b/res/values-pl/strings.xml index 3501a341b1d..3a9a0e05c4b 100644 --- a/res/values-pl/strings.xml +++ b/res/values-pl/strings.xml @@ -2110,14 +2110,14 @@ "Czas użycia" "Ułatwienia dostępu" "Ustawienia ułatwień dostępu" - "Czytniki, wyświetlacz, sterowanie interakcjami" + "Czytniki, wyświetlacz, zarządzanie interakcjami" "Dla niedowidzących" "Możesz dostosować urządzenie do swoich potrzeb. Ułatwienia dostępu możesz zawsze zmienić w Ustawieniach." "Zmień rozmiar czcionki" "Czytniki ekranu" "Dźwięk i tekst na ekranie" "Wyświetlacz" - "Sterowanie interakcjami" + "Zarządzanie interakcjami" "Pobrane usługi" "Eksperymentalne" "Flagi funkcji" diff --git a/src/com/android/settings/biometrics/face/FaceSettingsLockscreenBypassPreferenceController.java b/src/com/android/settings/biometrics/face/FaceSettingsLockscreenBypassPreferenceController.java index 15fab260dc9..e717cb2008b 100644 --- a/src/com/android/settings/biometrics/face/FaceSettingsLockscreenBypassPreferenceController.java +++ b/src/com/android/settings/biometrics/face/FaceSettingsLockscreenBypassPreferenceController.java @@ -47,10 +47,10 @@ public class FaceSettingsLockscreenBypassPreferenceController @Override public boolean isChecked() { - boolean defaultValue = mContext.getResources().getBoolean( - com.android.internal.R.bool.config_faceAuthDismissesKeyguard); - return Settings.Secure.getInt(mContext.getContentResolver(), - Settings.Secure.FACE_UNLOCK_DISMISSES_KEYGUARD, defaultValue ? 1 : 0) != 0; + int defaultValue = mContext.getResources().getBoolean( + com.android.internal.R.bool.config_faceAuthDismissesKeyguard) ? 1 : 0; + return Settings.Secure.getIntForUser(mContext.getContentResolver(), + Settings.Secure.FACE_UNLOCK_DISMISSES_KEYGUARD, defaultValue, getUserId()) != 0; } @Override @@ -81,7 +81,8 @@ public class FaceSettingsLockscreenBypassPreferenceController } if (mFaceManager != null && mFaceManager.isHardwareDetected()) { - return mFaceManager.hasEnrolledTemplates() ? AVAILABLE : DISABLED_DEPENDENT_SETTING; + return mFaceManager.hasEnrolledTemplates(getUserId()) + ? AVAILABLE : DISABLED_DEPENDENT_SETTING; } else { return UNSUPPORTED_ON_DEVICE; } diff --git a/src/com/android/settings/wifi/NetworkRequestDialogFragment.java b/src/com/android/settings/wifi/NetworkRequestDialogFragment.java index eb7d78fd789..4762403f4db 100644 --- a/src/com/android/settings/wifi/NetworkRequestDialogFragment.java +++ b/src/com/android/settings/wifi/NetworkRequestDialogFragment.java @@ -340,6 +340,7 @@ public class NetworkRequestDialogFragment extends InstrumentedDialogFragment imp // Throws error dialog. final NetworkRequestErrorDialogFragment fragment = NetworkRequestErrorDialogFragment .newInstance(); + fragment.setRejectCallback(mUserSelectionCallback); final Bundle bundle = new Bundle(); bundle.putSerializable(NetworkRequestErrorDialogFragment.DIALOG_TYPE, type); fragment.setArguments(bundle); diff --git a/src/com/android/settings/wifi/NetworkRequestErrorDialogFragment.java b/src/com/android/settings/wifi/NetworkRequestErrorDialogFragment.java index 261d3131e49..98194743bb6 100644 --- a/src/com/android/settings/wifi/NetworkRequestErrorDialogFragment.java +++ b/src/com/android/settings/wifi/NetworkRequestErrorDialogFragment.java @@ -20,8 +20,10 @@ import android.app.Dialog; import android.app.settings.SettingsEnums; import android.content.DialogInterface; import android.os.Bundle; +import android.net.wifi.WifiManager.NetworkRequestUserSelectionCallback; import androidx.annotation.NonNull; +import androidx.annotation.Nullable; import androidx.appcompat.app.AlertDialog; import com.android.settings.R; @@ -36,6 +38,8 @@ public class NetworkRequestErrorDialogFragment extends InstrumentedDialogFragmen public static final String DIALOG_TYPE = "DIALOG_ERROR_TYPE"; public enum ERROR_DIALOG_TYPE {TIME_OUT, ABORT} + @Nullable + private NetworkRequestUserSelectionCallback mRejectCallback; public static NetworkRequestErrorDialogFragment newInstance() { return new NetworkRequestErrorDialogFragment(); @@ -49,7 +53,7 @@ public class NetworkRequestErrorDialogFragment extends InstrumentedDialogFragmen public void onCancel(@NonNull DialogInterface dialog) { super.onCancel(dialog); // Wants to finish the activity when user clicks back key or outside of the dialog. - getActivity().finish(); + rejectNetworkRequestAndFinish(); } @Override @@ -65,10 +69,12 @@ public class NetworkRequestErrorDialogFragment extends InstrumentedDialogFragmen builder.setMessage(R.string.network_connection_timeout_dialog_message) .setPositiveButton(R.string.network_connection_timeout_dialog_ok, (dialog, which) -> startScanningDialog()) - .setNegativeButton(R.string.cancel, (dialog, which) -> getActivity().finish()); + .setNegativeButton(R.string.cancel, + (dialog, which) -> rejectNetworkRequestAndFinish()); } else { builder.setMessage(R.string.network_connection_errorstate_dialog_message) - .setPositiveButton(R.string.okay, (dialog, which) -> getActivity().finish()); + .setPositiveButton(R.string.okay, + (dialog, which) -> rejectNetworkRequestAndFinish()); } return builder.create(); } @@ -78,9 +84,23 @@ public class NetworkRequestErrorDialogFragment extends InstrumentedDialogFragmen return SettingsEnums.WIFI_SCANNING_NEEDED_DIALOG; } + // Sets the callback for fragment to reject this request. + public void setRejectCallback(NetworkRequestUserSelectionCallback rejectCallback) { + mRejectCallback = rejectCallback; + } + protected void startScanningDialog() { final NetworkRequestDialogFragment fragment = NetworkRequestDialogFragment.newInstance(); fragment.show(getActivity().getSupportFragmentManager(), NetworkRequestErrorDialogFragment.class.getSimpleName()); } + + private void rejectNetworkRequestAndFinish() { + if (getActivity() != null) { + if (mRejectCallback != null) { + mRejectCallback.reject(); + } + getActivity().finish(); + } + } } diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java index 8e0da6b1181..12d5a9082ad 100644 --- a/src/com/android/settings/wifi/WifiConfigController.java +++ b/src/com/android/settings/wifi/WifiConfigController.java @@ -987,7 +987,9 @@ public class WifiConfigController implements TextWatcher, } mView.findViewById(R.id.eap).setVisibility(View.VISIBLE); + boolean initiateEnterpriseNetworkUi = false; if (mEapMethodSpinner == null) { + initiateEnterpriseNetworkUi = true; mEapMethodSpinner = (Spinner) mView.findViewById(R.id.method); mEapMethodSpinner.setOnItemSelectedListener(this); mPhase2Spinner = (Spinner) mView.findViewById(R.id.phase2); @@ -1045,7 +1047,7 @@ public class WifiConfigController implements TextWatcher, } // Modifying an existing network - if (mAccessPoint != null && mAccessPoint.isSaved()) { + if (initiateEnterpriseNetworkUi && mAccessPoint != null && mAccessPoint.isSaved()) { final WifiEnterpriseConfig enterpriseConfig = mAccessPoint.getConfig().enterpriseConfig; final int eapMethod = enterpriseConfig.getEapMethod(); final int phase2Method = enterpriseConfig.getPhase2Method(); diff --git a/tests/robotests/src/com/android/settings/wifi/NetworkRequestErrorDialogFragmentTest.java b/tests/robotests/src/com/android/settings/wifi/NetworkRequestErrorDialogFragmentTest.java index 303f6af6721..c7b1a89d57f 100644 --- a/tests/robotests/src/com/android/settings/wifi/NetworkRequestErrorDialogFragmentTest.java +++ b/tests/robotests/src/com/android/settings/wifi/NetworkRequestErrorDialogFragmentTest.java @@ -18,11 +18,13 @@ package com.android.settings.wifi; import static com.google.common.truth.Truth.assertThat; +import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.internal.verification.VerificationModeFactory.times; import android.content.DialogInterface; +import android.net.wifi.WifiManager.NetworkRequestUserSelectionCallback; import android.os.Bundle; import android.widget.Button; @@ -32,6 +34,8 @@ import androidx.fragment.app.FragmentActivity; import com.android.settings.R; import com.android.settings.testutils.shadow.ShadowAlertDialogCompat; import com.android.settings.wifi.NetworkRequestErrorDialogFragment.ERROR_DIALOG_TYPE; +import com.android.settingslib.wifi.WifiTracker; +import com.android.settingslib.wifi.WifiTrackerFactory; import org.junit.Before; import org.junit.Test; @@ -47,12 +51,17 @@ public class NetworkRequestErrorDialogFragmentTest { private FragmentActivity mActivity; private NetworkRequestErrorDialogFragment mFragment; + private WifiTracker mWifiTracker; @Before public void setUp() { mActivity = Robolectric.setupActivity(FragmentActivity.class); mFragment = spy(NetworkRequestErrorDialogFragment.newInstance()); mFragment.show(mActivity.getSupportFragmentManager(), null); + + // Prevents NPE when calling up NetworkRequestDialogFragment. + mWifiTracker = mock(WifiTracker.class); + WifiTrackerFactory.setTestingWifiTracker(mWifiTracker); } @Test @@ -111,4 +120,17 @@ public class NetworkRequestErrorDialogFragmentTest { negativeButton.performClick(); assertThat(alertDialog.isShowing()).isFalse(); } + + @Test + public void clickNegativeButton_shouldCallReject() { + final NetworkRequestUserSelectionCallback rejectCallback = + mock(NetworkRequestUserSelectionCallback.class); + mFragment.setRejectCallback(rejectCallback); + + final AlertDialog alertDialog = ShadowAlertDialogCompat.getLatestAlertDialog(); + final Button negativeButton = alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE); + negativeButton.performClick(); + + verify(rejectCallback, times(1)).reject(); + } } diff --git a/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java b/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java index dd7ecde0063..669a2e68436 100644 --- a/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java +++ b/tests/robotests/src/com/android/settings/wifi/WifiConfigControllerTest.java @@ -28,6 +28,8 @@ import static org.mockito.Mockito.when; import android.content.Context; import android.net.wifi.WifiConfiguration; +import android.net.wifi.WifiEnterpriseConfig; +import android.net.wifi.WifiEnterpriseConfig.Eap; import android.net.wifi.WifiManager; import android.os.ServiceSpecificException; import android.security.KeyStore; @@ -469,4 +471,22 @@ public class WifiConfigControllerTest { final int selectedItemPosition = eapMethodSpinner.getSelectedItemPosition(); assertThat(eapMethodSpinner.getSelectedItem().toString()).isEqualTo("TLS"); } + + @Test + public void selectEapMethod_savedAccessPoint_shouldGetCorrectPosition() { + when(mAccessPoint.isSaved()).thenReturn(true); + when(mAccessPoint.getSecurity()).thenReturn(AccessPoint.SECURITY_EAP); + final WifiConfiguration mockWifiConfig = mock(WifiConfiguration.class); + final WifiEnterpriseConfig mockWifiEnterpriseConfig = mock(WifiEnterpriseConfig.class); + when(mockWifiEnterpriseConfig.getEapMethod()).thenReturn(Eap.PEAP); + mockWifiConfig.enterpriseConfig = mockWifiEnterpriseConfig ; + when(mAccessPoint.getConfig()).thenReturn(mockWifiConfig); + mController = new TestWifiConfigController(mConfigUiBase, mView, mAccessPoint, + WifiConfigUiBase.MODE_MODIFY); + final Spinner eapMethodSpinner = mView.findViewById(R.id.method); + + eapMethodSpinner.setSelection(Eap.TLS); + + assertThat(eapMethodSpinner.getSelectedItemPosition()).isEqualTo(Eap.TLS); + } }