diff --git a/res/values-b+sr+Latn/strings.xml b/res/values-b+sr+Latn/strings.xml index f84078e5cb4..ccf506aba9e 100644 --- a/res/values-b+sr+Latn/strings.xml +++ b/res/values-b+sr+Latn/strings.xml @@ -2940,9 +2940,9 @@ Proveri sertifikate "Više korisnika" - "Delite uređaj tako što ćete dodati nove korisnike. Svaki korisnik ima lični prostor na uređaju za prilagođene početne ekrane, naloge, aplikacije, podešavanja i još mnogo toga." - "Delite tablet tako što ćete dodati nove korisnike. Svaki korisnik ima lični prostor na tabletu za prilagođene početne ekrane, naloge, aplikacije, podešavanja i još mnogo toga." - "Delite telefon tako što ćete dodati nove korisnike. Svaki korisnik ima lični prostor na telefonu za prilagođene početne ekrane, naloge, aplikacije, podešavanja i još mnogo toga." + "Delite uređaj tako što ćete dodati nove korisnike. Svaki korisnik ima lični prostor na uređaju za prilagođene početne ekrane, naloge, aplikacije, podešavanja i drugo." + "Delite tablet tako što ćete dodati nove korisnike. Svaki korisnik ima lični prostor na tabletu za prilagođene početne ekrane, naloge, aplikacije, podešavanja i drugo." + "Delite telefon tako što ćete dodati nove korisnike. Svaki korisnik ima lični prostor na telefonu za prilagođene početne ekrane, naloge, aplikacije, podešavanja i drugo." "Korisnici i profili" "Dodaj korisnika ili profil" "Dodaj korisnika" diff --git a/res/values-hi/strings.xml b/res/values-hi/strings.xml index f7a64aaafd5..2eef0887808 100644 --- a/res/values-hi/strings.xml +++ b/res/values-hi/strings.xml @@ -224,7 +224,7 @@ "कॉल रीडयरेक्ट:" "बूट के बाद से PPP रीसेट की संख्या:" "वर्तमान नेटवर्क:" - "डेटा प्राप्त हुआ:" + "डेटा मिला:" "वॉइस सेवा:" "सिग्नल की शक्ति:" "वॉइस कॉल स्थिति:" @@ -2426,10 +2426,10 @@ "टैबलेट" "फ़ोन" "मोबाइल पैकेट भेजे गए" - "मोबाइल पैकेट प्राप्त हुए" + "मोबाइल पैकेट पाए" "मोबाइल रेडियो सक्रिय" "वाई-फ़ाई पैकेट भेजे गए" - "वाई-फ़ाई पैकेट प्राप्त हुए" + "वाई-फ़ाई पैकेट मिले" "ऑडियो" "वीडियो" "कैमरा" @@ -2653,7 +2653,7 @@ "ऐप्लिकेशन और सूचनाएं बंद हैं" "वर्क प्रोफ़ाइल निकालें" "पृष्ठभूमि डेटा" - "ऐप्लिकेशन किसी भी समय डेटा समन्वयित, भेज और प्राप्त कर सकते हैं" + "ऐप्लिकेशन किसी भी समय डेटा सिंक कर सकते हैं, भेज और पा सकते हैं" "पृष्ठभू. डेटा अक्षम करें?" "बैकग्राउंड डेटा को बंद करने से बैटरी ज़्यादा चलती है और डेटा कम खर्च होता है. हो सकता है कि कुछ ऐप अब भी बैकग्राउंड में डेटा इस्तेमाल कर रहे हों." "ऐप डेटा अपने आप सिंक करें" @@ -2774,7 +2774,7 @@ "^1"" ""^2"\n"सीमा" "निकाले गए ऐप्लिकेशन" "ऐप्लिकेशन और उपयोगकर्ताओं को निकालें" - "%1$s प्राप्त, %2$s भेजा" + "%1$s पाया, %2$s भेजा" "%2$s: करीब %1$s का उपयोग किया गया." "%2$s: आपके टैबलेट के द्वारा मापे जाने के अनुसार, करीब %1$s का उपयोग किया गया. आपके कैरियर की डेटा गणना अलग हो सकती है." "%2$s: आपके फ़ोन के द्वारा मापे जाने के अनुसार, करीब %1$s का उपयोग किया गया. आपके कैरियर की डेटा गणना अलग हो सकती है." @@ -2809,7 +2809,7 @@ "खाते की जानकारी सेव करें" "(उपयोग नहीं किया)" "(सर्वर सत्‍यापित न करें)" - "(सर्वर से प्राप्त)" + "(सर्वर से मिला)" "यह वीपीएन प्रकार हमेशा कनेक्ट नहीं रह सकता" "हमेशा-चालू VPN सिर्फ़ संख्या वाले सर्वर पतों का समर्थन करता है" "हमेशा-चालू VPN के लिए एक DNS सर्वर तय किया जाना चाहिए" @@ -2995,7 +2995,7 @@ "गंभीर धमकियां" "जान और माल के गंभीर खतरों के लिए अलर्ट पाएं" "AMBER अलर्ट" - "बाल अपहरणों के बारे में बुलेटिन प्राप्त करें" + "बाल अपहरणों के बारे में बुलेटिन पाएं" "दोहराएं" "कॉल प्रबंधक चालू करें" "इस सेवा को कॉल करने का आपका तरीका प्रबंधित करने दें." diff --git a/res/values-sr/strings.xml b/res/values-sr/strings.xml index ba6021174a3..702a15b1eee 100644 --- a/res/values-sr/strings.xml +++ b/res/values-sr/strings.xml @@ -2940,9 +2940,9 @@ Провери сертификате "Више корисника" - "Делите уређај тако што ћете додати нове кориснике. Сваки корисник има лични простор на уређају за прилагођене почетне екране, налоге, апликације, подешавања и још много тога." - "Делите таблет тако што ћете додати нове кориснике. Сваки корисник има лични простор на таблету за прилагођене почетне екране, налоге, апликације, подешавања и још много тога." - "Делите телефон тако што ћете додати нове кориснике. Сваки корисник има лични простор на телефону за прилагођене почетне екране, налоге, апликације, подешавања и још много тога." + "Делите уређај тако што ћете додати нове кориснике. Сваки корисник има лични простор на уређају за прилагођене почетне екране, налоге, апликације, подешавања и друго." + "Делите таблет тако што ћете додати нове кориснике. Сваки корисник има лични простор на таблету за прилагођене почетне екране, налоге, апликације, подешавања и друго." + "Делите телефон тако што ћете додати нове кориснике. Сваки корисник има лични простор на телефону за прилагођене почетне екране, налоге, апликације, подешавања и друго." "Корисници и профили" "Додај корисника или профил" "Додај корисника" diff --git a/src/com/android/settings/RegulatoryInfoDisplayActivity.java b/src/com/android/settings/RegulatoryInfoDisplayActivity.java index 8bc1cefec5d..4c7515d10f6 100644 --- a/src/com/android/settings/RegulatoryInfoDisplayActivity.java +++ b/src/com/android/settings/RegulatoryInfoDisplayActivity.java @@ -119,7 +119,8 @@ public class RegulatoryInfoDisplayActivity extends Activity implements } } - private int getResourceId() { + @VisibleForTesting + int getResourceId() { // Use regulatory_info by default. int resId = getResources().getIdentifier( REGULATORY_INFO_RESOURCE, "drawable", getPackageName()); @@ -134,6 +135,18 @@ public class RegulatoryInfoDisplayActivity extends Activity implements resId = id; } } + + // When hardware coo property exists, use regulatory_info__ resource if valid. + final String coo = getCoo(); + if (!TextUtils.isEmpty(coo) && !TextUtils.isEmpty(sku)) { + final String regulatory_info_coo_res = + REGULATORY_INFO_RESOURCE + "_" + sku.toLowerCase() + "_" + coo.toLowerCase(); + final int id = getResources().getIdentifier( + regulatory_info_coo_res, "drawable", getPackageName()); + if (id != 0) { + resId = id; + } + } return resId; } @@ -142,13 +155,15 @@ public class RegulatoryInfoDisplayActivity extends Activity implements finish(); // close the activity } - @VisibleForTesting - public static String getSku() { + private String getCoo() { + return SystemProperties.get("ro.boot.hardware.coo", ""); + } + + private String getSku() { return SystemProperties.get("ro.boot.hardware.sku", ""); } - @VisibleForTesting - public static String getRegulatoryInfoImageFileName() { + private String getRegulatoryInfoImageFileName() { final String sku = getSku(); if (TextUtils.isEmpty(sku)) { return DEFAULT_REGULATORY_INFO_FILEPATH; diff --git a/src/com/android/settings/biometrics/face/FaceEnrollEducation.java b/src/com/android/settings/biometrics/face/FaceEnrollEducation.java index 99d96dd6d06..011cc12ae7a 100644 --- a/src/com/android/settings/biometrics/face/FaceEnrollEducation.java +++ b/src/com/android/settings/biometrics/face/FaceEnrollEducation.java @@ -134,7 +134,10 @@ public class FaceEnrollEducation extends BiometricEnrollBase { final AccessibilityManager accessibilityManager = getApplicationContext().getSystemService( AccessibilityManager.class); if (accessibilityManager != null) { - accessibilityEnabled = accessibilityManager.isEnabled(); + // Add additional check for touch exploration. This prevents other accessibility + // features such as Live Transcribe from defaulting to the accessibility setup. + accessibilityEnabled = accessibilityManager.isEnabled() + && accessibilityManager.isTouchExplorationEnabled(); } mFooterBarMixin.setPrimaryButton(footerButton); final Context context = getApplicationContext(); diff --git a/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceController.java b/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceController.java index ff9352a7d4b..fd54f19b819 100644 --- a/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceController.java +++ b/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceController.java @@ -21,6 +21,7 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.text.TextUtils; +import android.text.format.DateFormat; import android.util.Log; import androidx.annotation.VisibleForTesting; @@ -28,9 +29,20 @@ import androidx.preference.Preference; import com.android.settings.core.BasePreferenceController; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.Locale; +import java.util.Optional; +import java.util.TimeZone; + public class MainlineModuleVersionPreferenceController extends BasePreferenceController { private static final String TAG = "MainlineModuleControl"; + private static final List VERSION_NAME_DATE_PATTERNS = Arrays.asList("yyyy-MM-dd", + "yyyy-MM"); @VisibleForTesting static final Intent MODULE_UPDATE_INTENT = @@ -81,6 +93,30 @@ public class MainlineModuleVersionPreferenceController extends BasePreferenceCon @Override public CharSequence getSummary() { - return mModuleVersion; + if (TextUtils.isEmpty(mModuleVersion)) { + return mModuleVersion; + } + + final Optional parsedDate = parseDateFromVersionName(mModuleVersion); + if (!parsedDate.isPresent()) { + Log.w("Could not parse mainline versionName (%s) as date.", mModuleVersion); + return mModuleVersion; + } + + return DateFormat.getLongDateFormat(mContext).format(parsedDate.get()); + } + + private Optional parseDateFromVersionName(String text) { + for (String pattern : VERSION_NAME_DATE_PATTERNS) { + try { + final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(pattern, + Locale.getDefault()); + simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + return Optional.of(simpleDateFormat.parse(text)); + } catch (ParseException e) { + // ignore and try next pattern + } + } + return Optional.empty(); } } diff --git a/tests/robotests/res/drawable/regulatory_info.png b/tests/robotests/res/drawable/regulatory_info.png new file mode 100644 index 00000000000..65de26c0eb2 Binary files /dev/null and b/tests/robotests/res/drawable/regulatory_info.png differ diff --git a/tests/robotests/res/drawable/regulatory_info_sku.png b/tests/robotests/res/drawable/regulatory_info_sku.png new file mode 100644 index 00000000000..65de26c0eb2 Binary files /dev/null and b/tests/robotests/res/drawable/regulatory_info_sku.png differ diff --git a/tests/robotests/res/drawable/regulatory_info_sku1_coo.png b/tests/robotests/res/drawable/regulatory_info_sku1_coo.png new file mode 100644 index 00000000000..65de26c0eb2 Binary files /dev/null and b/tests/robotests/res/drawable/regulatory_info_sku1_coo.png differ diff --git a/tests/robotests/src/com/android/settings/RegulatoryInfoDisplayActivityTest.java b/tests/robotests/src/com/android/settings/RegulatoryInfoDisplayActivityTest.java new file mode 100644 index 00000000000..d05d5d77d4a --- /dev/null +++ b/tests/robotests/src/com/android/settings/RegulatoryInfoDisplayActivityTest.java @@ -0,0 +1,83 @@ +/* + * 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; + +import static com.google.common.truth.Truth.assertThat; + +import android.os.SystemProperties; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.robolectric.Robolectric; +import org.robolectric.RobolectricTestRunner; + + +@RunWith(RobolectricTestRunner.class) +public class RegulatoryInfoDisplayActivityTest { + + private static final String SKU_PROP_KEY = "ro.boot.hardware.sku"; + private static final String COO_PROP_KEY = "ro.boot.hardware.coo"; + + private RegulatoryInfoDisplayActivity mRegulatoryInfoDisplayActivity; + + @Before + public void setUp() { + mRegulatoryInfoDisplayActivity = Robolectric.buildActivity( + RegulatoryInfoDisplayActivity.class).create().get(); + } + + @Test + public void getResourceId_noSkuProperty_shouldReturnDefaultLabel() { + SystemProperties.set(SKU_PROP_KEY, ""); + + final int expectedResId = getResourceId("regulatory_info"); + assertThat(mRegulatoryInfoDisplayActivity.getResourceId()).isEqualTo(expectedResId); + } + + @Test + public void getResourceId_noCooProperty_shouldReturnSkuLabel() { + SystemProperties.set(SKU_PROP_KEY, "sku"); + SystemProperties.set(COO_PROP_KEY, ""); + + final int expectedResId = getResourceId("regulatory_info_sku"); + assertThat(mRegulatoryInfoDisplayActivity.getResourceId()).isEqualTo(expectedResId); + } + + @Test + public void getResourceId_hasSkuAndCooProperties_shouldReturnCooLabel() { + SystemProperties.set(SKU_PROP_KEY, "sku1"); + SystemProperties.set(COO_PROP_KEY, "coo"); + + final int expectedResId = getResourceId("regulatory_info_sku1_coo"); + assertThat(mRegulatoryInfoDisplayActivity.getResourceId()).isEqualTo(expectedResId); + } + + @Test + public void getResourceId_noCorrespondingCooLabel_shouldReturnSkuLabel() { + SystemProperties.set(SKU_PROP_KEY, "sku"); + SystemProperties.set(COO_PROP_KEY, "unknown"); + + final int expectedResId = getResourceId("regulatory_info_sku"); + assertThat(mRegulatoryInfoDisplayActivity.getResourceId()).isEqualTo(expectedResId); + } + + private int getResourceId(String resourceName) { + return mRegulatoryInfoDisplayActivity.getResources().getIdentifier(resourceName, "drawable", + mRegulatoryInfoDisplayActivity.getPackageName()); + } +} diff --git a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceControllerTest.java index adddc961e06..950d96237d6 100644 --- a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/MainlineModuleVersionPreferenceControllerTest.java @@ -31,12 +31,9 @@ import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; -import android.util.FeatureFlagUtils; import androidx.preference.Preference; -import com.android.settings.core.FeatureFlags; - import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -91,7 +88,7 @@ public class MainlineModuleVersionPreferenceControllerTest { @Test public void getAvailabilityStatus_hasMainlineModulePackageInfo_available() throws Exception { - setupModulePackage(); + setupModulePackage("test version 123"); final MainlineModuleVersionPreferenceController controller = new MainlineModuleVersionPreferenceController(mContext, "key"); @@ -101,7 +98,7 @@ public class MainlineModuleVersionPreferenceControllerTest { @Test public void updateStates_canHandleIntent_setIntentToPreference() throws Exception { - setupModulePackage(); + setupModulePackage("test version 123"); when(mPackageManager.resolveActivity(MODULE_UPDATE_INTENT, 0)) .thenReturn(new ResolveInfo()); @@ -115,7 +112,7 @@ public class MainlineModuleVersionPreferenceControllerTest { @Test public void updateStates_cannotHandleIntent_setNullToPreference() throws Exception { - setupModulePackage(); + setupModulePackage("test version 123"); when(mPackageManager.resolveActivity(MODULE_UPDATE_INTENT, 0)) .thenReturn(null); @@ -127,9 +124,38 @@ public class MainlineModuleVersionPreferenceControllerTest { assertThat(mPreference.getIntent()).isNull(); } - private void setupModulePackage() throws Exception { + @Test + public void getSummary_versionIsNull_returnNull() throws Exception { + setupModulePackage(null); + + final MainlineModuleVersionPreferenceController controller = + new MainlineModuleVersionPreferenceController(mContext, "key"); + + assertThat(controller.getSummary()).isNull(); + } + + @Test + public void getSummary_versionIsMonth_returnMonth() throws Exception { + setupModulePackage("2019-05"); + + final MainlineModuleVersionPreferenceController controller = + new MainlineModuleVersionPreferenceController(mContext, "key"); + + assertThat(controller.getSummary()).isEqualTo("May 01, 2019"); + } + + @Test + public void getSummary_versionIsDate_returnDate() throws Exception { + setupModulePackage("2019-05-13"); + + final MainlineModuleVersionPreferenceController controller = + new MainlineModuleVersionPreferenceController(mContext, "key"); + + assertThat(controller.getSummary()).isEqualTo("May 13, 2019"); + } + + private void setupModulePackage(String version) throws Exception { final String provider = "test.provider"; - final String version = "test version 123"; final PackageInfo info = new PackageInfo(); info.versionName = version; when(mContext.getString(