diff options
22 files changed, 103 insertions, 77 deletions
diff --git a/PermissionController/res/values-ar/strings.xml b/PermissionController/res/values-ar/strings.xml index 5381d11b4..e22ec0182 100644 --- a/PermissionController/res/values-ar/strings.xml +++ b/PermissionController/res/values-ar/strings.xml @@ -475,7 +475,7 @@ <string name="permgrouprequest_device_aware_storage_isolated" msgid="6463062962458809752">"هل تريد السماح لـ <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> بالوصول إلى الصور والوسائط على <b><xliff:g id="DEVICE_NAME">%2$s</xliff:g></b>؟"</string> <string name="permgrouprequest_contacts" msgid="8391550064551053695">"هل تريد السماح لتطبيق <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> بالوصول إلى جهات الاتصال؟"</string> <string name="permgrouprequest_device_aware_contacts" msgid="731025863972535928">"هل تريد السماح لـ <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> بالوصول إلى جهات اتصالك على <b><xliff:g id="DEVICE_NAME">%2$s</xliff:g></b>؟"</string> - <string name="permgrouprequest_location" msgid="6990232580121067883">"هل تريد السماح لتطبيق <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> بالوصول إلى الموقع الجغرافي لهذا الجهاز؟"</string> + <string name="permgrouprequest_location" msgid="6990232580121067883">"هل مطلوب السماح لتطبيق <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> بالوصول إلى الموقع الجغرافي لهذا الجهاز؟"</string> <string name="permgrouprequest_device_aware_location" msgid="6075412127429878638">"هل تريد السماح لـ <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> بالوصول إلى الموقع الجغرافي الخاص بـ <b><xliff:g id="DEVICE_NAME">%2$s</xliff:g></b>؟"</string> <string name="permgrouprequestdetail_location" msgid="2635935335778429894">"لن يكون بإمكان التطبيق الوصول إلى الموقع الجغرافي إلا عند استخدامك لهذا التطبيق."</string> <string name="permgroupbackgroundrequest_location" msgid="1085680897265734809">"هل تريد السماح لتطبيق <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> بالوصول إلى الموقع الجغرافي لهذا الجهاز؟"</string> @@ -495,7 +495,7 @@ <string name="permgrouprequest_coarselocation_imagetext" msgid="8650605041483025297">"تقريبي"</string> <string name="permgrouprequest_calendar" msgid="1493150855673603806">"هل تريد السماح لتطبيق <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> بالوصول إلى التقويم؟"</string> <string name="permgrouprequest_device_aware_calendar" msgid="7161929851377463612">"هل تريد السماح لـ <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> بالوصول إلى تقويمك على <b><xliff:g id="DEVICE_NAME">%2$s</xliff:g></b>؟"</string> - <string name="permgrouprequest_sms" msgid="5672063688745420991">"هل تريد السماح لتطبيق <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> بإرسال رسائل SMS وعرضها؟"</string> + <string name="permgrouprequest_sms" msgid="5672063688745420991">"هل مطلوب السماح لتطبيق <xliff:g id="APP_NAME">%1$s</xliff:g> بإرسال رسائل SMS وعرضها؟"</string> <string name="permgrouprequest_device_aware_sms" msgid="6639977653040502291">"هل تريد السماح لـ <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> بإرسال الرسائل القصيرة وعرضها على <b><xliff:g id="DEVICE_NAME">%2$s</xliff:g></b>؟"</string> <string name="permgrouprequest_storage" msgid="8717773092518621602">"هل تريد السماح لتطبيق <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> بالوصول إلى الصور والوسائط والملفات على جهازك؟"</string> <string name="permgrouprequest_device_aware_storage" msgid="6933251810928606636">"هل تريد السماح لـ <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> بالوصول إلى الصور والوسائط والملفات على <b><xliff:g id="DEVICE_NAME">%2$s</xliff:g></b>؟"</string> diff --git a/PermissionController/res/values-cs/strings.xml b/PermissionController/res/values-cs/strings.xml index 8ca485fbe..a48d5afb9 100644 --- a/PermissionController/res/values-cs/strings.xml +++ b/PermissionController/res/values-cs/strings.xml @@ -383,7 +383,7 @@ <string name="role_emergency_search_keywords" msgid="1920007722599213358">"v případě nouze"</string> <string name="role_home_label" msgid="3871847846649769412">"Výchozí aplikace pro domácnost"</string> <string name="role_home_short_label" msgid="8544733747952272337">"Vstupní aplikace"</string> - <string name="role_home_description" msgid="7997371519626556675">"Aplikace (tzv. spouštěče), které nahrazují plochu na zařízení Android a dávají vám přístup\\nk obsahu a funkcím zařízení."</string> + <string name="role_home_description" msgid="7997371519626556675">"Aplikace (tzv. spouštěče), které nahrazují plochu na zařízení Android a dávají vám přístup k obsahu a funkcím zařízení."</string> <string name="role_home_request_title" msgid="738136983453341081">"Nastavit <xliff:g id="APP_NAME">%1$s</xliff:g> jako výchozí aplikaci pro domácnost?"</string> <string name="role_home_request_description" msgid="2658833966716057673">"Není potřeba žádné oprávnění"</string> <string name="role_home_search_keywords" msgid="3830755001192666285">"spouštěč"</string> diff --git a/PermissionController/res/values-hu/strings.xml b/PermissionController/res/values-hu/strings.xml index 997dc71e2..038f0161f 100644 --- a/PermissionController/res/values-hu/strings.xml +++ b/PermissionController/res/values-hu/strings.xml @@ -495,7 +495,7 @@ <string name="permgrouprequest_coarselocation_imagetext" msgid="8650605041483025297">"Hozzávetőleges"</string> <string name="permgrouprequest_calendar" msgid="1493150855673603806">"Engedélyezi a(z) <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> számára, hogy hozzáférjen a naptárhoz?"</string> <string name="permgrouprequest_device_aware_calendar" msgid="7161929851377463612">"Engedélyezi a(z) <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> számára, hogy hozzáférjen a naptárához ezen az eszközön: <b><xliff:g id="DEVICE_NAME">%2$s</xliff:g>’s</b>?"</string> - <string name="permgrouprequest_sms" msgid="5672063688745420991">"Engedélyezi a(z) <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> számára, hogy SMS-eket küldhessen és tekinthessen meg?"</string> + <string name="permgrouprequest_sms" msgid="5672063688745420991">"Engedélyezi a(z) <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> számára SMS-ek küldését és megtekintését?"</string> <string name="permgrouprequest_device_aware_sms" msgid="6639977653040502291">"Engedélyezi a(z) <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> számára az SMS-ek küldését és megtekintését ezen az eszközön: <b><xliff:g id="DEVICE_NAME">%2$s</xliff:g></b>?"</string> <string name="permgrouprequest_storage" msgid="8717773092518621602">"Engedélyezi a(z) <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> számára, hogy hozzáférjen az eszközön tárolt fotókhoz, médiatartalmakhoz és fájlokhoz?"</string> <string name="permgrouprequest_device_aware_storage" msgid="6933251810928606636">"Engedélyezi a(z) <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> számára, hogy fotókhoz, médiatartalmakhoz és fájlokhoz férjen hozzá ezen az eszközön: <b><xliff:g id="DEVICE_NAME">%2$s</xliff:g></b>?"</string> diff --git a/PermissionController/res/values-ja/strings.xml b/PermissionController/res/values-ja/strings.xml index 43e204b69..0be93d464 100644 --- a/PermissionController/res/values-ja/strings.xml +++ b/PermissionController/res/values-ja/strings.xml @@ -491,8 +491,8 @@ <string name="permgrouprequest_device_aware_fineupgrade" msgid="4453775952305587571">"<b><xliff:g id="DEVICE_NAME">%2$s</xliff:g></b>の位置情報に対する <b><xliff:g id="APP_NAME"><b>%1$s</b></xliff:g></b> のアクセス権を「おおよそ」から「正確」に変更しますか?"</string> <string name="permgrouprequest_coarselocation" msgid="7244605063736425232">"このデバイスのおおよその位置情報へのアクセスを <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> に許可しますか?"</string> <string name="permgrouprequest_device_aware_coarselocation" msgid="8367540370912066757">"<b><xliff:g id="DEVICE_NAME">%2$s</xliff:g></b>のおおよその位置情報へのアクセスを <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> に許可しますか?"</string> - <string name="permgrouprequest_finelocation_imagetext" msgid="1313062433398914334">"正確"</string> - <string name="permgrouprequest_coarselocation_imagetext" msgid="8650605041483025297">"おおよそ"</string> + <string name="permgrouprequest_finelocation_imagetext" msgid="1313062433398914334">"正確な位置"</string> + <string name="permgrouprequest_coarselocation_imagetext" msgid="8650605041483025297">"おおよその位置"</string> <string name="permgrouprequest_calendar" msgid="1493150855673603806">"カレンダーへのアクセスを「<b><xliff:g id="APP_NAME">%1$s</xliff:g></b>」に許可しますか?"</string> <string name="permgrouprequest_device_aware_calendar" msgid="7161929851377463612">"<b><xliff:g id="DEVICE_NAME">%2$s</xliff:g></b>内のカレンダーへのアクセスを <b><xliff:g id="APP_NAME">%1$s</xliff:g></b> に許可しますか?"</string> <string name="permgrouprequest_sms" msgid="5672063688745420991">"SMS メッセージの送信と表示を「<b><xliff:g id="APP_NAME">%1$s</xliff:g></b>」に許可しますか?"</string> diff --git a/PermissionController/res/values-mk/strings.xml b/PermissionController/res/values-mk/strings.xml index 5f2735642..d8ba89c77 100644 --- a/PermissionController/res/values-mk/strings.xml +++ b/PermissionController/res/values-mk/strings.xml @@ -628,7 +628,7 @@ <string name="safety_center_background_location_access_reminder_summary" msgid="7431657777510537658">"Апликацијава може секогаш да пристапува до вашата локација, дури и кога е затворена.\n\nНа одредени апликации за безбедност и итни случаи им е потребен пристап до вашата локација во заднината за правилно да функционираат."</string> <string name="safety_center_background_location_access_revoked" msgid="6972274943343442213">"Пристапот е променет"</string> <string name="safety_center_view_recent_location_access" msgid="3524391299490678243">"Погледнете го неодамнешното користење на локацијата"</string> - <string name="privacy_controls_title" msgid="7605929972256835199">"Контроли на приватноста"</string> + <string name="privacy_controls_title" msgid="7605929972256835199">"Контроли за приватност"</string> <string name="camera_toggle_title" msgid="1251201397431837666">"Пристап до камерата"</string> <string name="mic_toggle_title" msgid="2649991093496110162">"Пристап до микрофонот"</string> <string name="perm_toggle_description" msgid="7801326363741451379">"За апликации и услуги"</string> diff --git a/PermissionController/res/values-nb/strings.xml b/PermissionController/res/values-nb/strings.xml index e2930ac8a..3835d7573 100644 --- a/PermissionController/res/values-nb/strings.xml +++ b/PermissionController/res/values-nb/strings.xml @@ -443,7 +443,7 @@ <string name="default_app_recommended" msgid="5669584821778942909">"Optimalisert for enheten"</string> <string name="default_app_others" msgid="7793029848126079876">"Andre"</string> <string name="default_app_none" msgid="9084592086808194457">"Ingen"</string> - <string name="default_app_system_default" msgid="6218386768175513760">"(System-&shy;standard)"</string> + <string name="default_app_system_default" msgid="6218386768175513760">"(System-&#173;standard)"</string> <string name="default_app_no_apps" msgid="115720991680586885">"Ingen apper"</string> <string name="default_payment_app_other_nfc_services" msgid="5957633798695758917">"Andre NFC-tjenester"</string> <string name="car_default_app_selected" msgid="5416420830430644174">"Valgt"</string> diff --git a/PermissionController/res/values-pl/strings.xml b/PermissionController/res/values-pl/strings.xml index 8316ac98c..0aefe4a69 100644 --- a/PermissionController/res/values-pl/strings.xml +++ b/PermissionController/res/values-pl/strings.xml @@ -348,7 +348,7 @@ <string name="no_apps_allowed" msgid="7718822655254468631">"Nie zezwolono żadnym aplikacjom"</string> <string name="no_apps_allowed_full" msgid="8011716991498934104">"Brak aplikacji z uprawnieniami dla wszystkich plików"</string> <string name="no_apps_allowed_scoped" msgid="4908850477787659501">"Brak aplikacji z uprawnieniami tylko dla multimediów"</string> - <string name="no_apps_denied" msgid="7663435886986784743">"Nie zabroniono dostępu żadnym aplikacjom"</string> + <string name="no_apps_denied" msgid="7663435886986784743">"Nie odmówiono dostępu żadnym aplikacjom"</string> <string name="car_permission_selected" msgid="180837028920791596">"Wybrana"</string> <string name="settings" msgid="5409109923158713323">"Ustawienia"</string> <string name="accessibility_service_dialog_title_single" msgid="7956432823014102366">"Usługa <xliff:g id="SERVICE_NAME">%s</xliff:g> ma pełny dostęp do urządzenia"</string> diff --git a/PermissionController/res/values-ru-v33/strings.xml b/PermissionController/res/values-ru-v33/strings.xml index b45662712..5506ccd97 100644 --- a/PermissionController/res/values-ru-v33/strings.xml +++ b/PermissionController/res/values-ru-v33/strings.xml @@ -41,7 +41,7 @@ <string name="safety_center_qs_privacy_control" msgid="1160682635058529673">"Переключатель: <xliff:g id="PRIVACY_CONTROL_TITLE">%1$s</xliff:g> (<xliff:g id="PRIVACY_CONTROL_STATUS">%2$s</xliff:g>)"</string> <string name="safety_center_qs_toggle_action" msgid="5920465736488119255">"Переключатель"</string> <string name="safety_center_qs_open_action" msgid="2760200829912423728">"Открыть"</string> - <string name="safety_center_review_settings_button" msgid="938981137942443930">"Перейти в настройки"</string> + <string name="safety_center_review_settings_button" msgid="938981137942443930">"Открыть настройки"</string> <string name="safety_center_gear_label" msgid="5175877094379694098">"Настройки"</string> <string name="safety_center_info_label" msgid="8993181584061825412">"Информация"</string> </resources> diff --git a/PermissionController/res/values/strings.xml b/PermissionController/res/values/strings.xml index 5714a2460..f5a997674 100644 --- a/PermissionController/res/values/strings.xml +++ b/PermissionController/res/values/strings.xml @@ -1409,9 +1409,7 @@ <!-- Content for dialog shown when the user should confirm an incident / bug report. [CHAR LIMIT=none] --> - <string name="incident_report_dialog_text">"<xliff:g id="app_name" example="Gmail">%1$s</xliff:g> is requesting to upload a bug report from this device taken on <xliff:g id="date" example="December 26, 2018">%2$s</xliff:g> at <xliff:g id="time" example="1:20 PM">%3$s</xliff:g>. Bug reports include personal information about your device or logged by apps, for example, user names, location data, device identifiers, and network information. Only share bug reports with people and apps you trust with this information. - -Allow <xliff:g id="app_name" example="Gmail">%4$s</xliff:g> to upload a bug report?"</string> + <string name="incident_report_dialog_text">"<xliff:g id="app_name" example="Gmail">%1$s</xliff:g> is requesting to upload a bug report from this device taken on <xliff:g id="date" example="December 26, 2018">%2$s</xliff:g> at <xliff:g id="time" example="1:20 PM">%3$s</xliff:g>. Bug reports include personal information about your device or logged by apps, for example, user names, location data, device identifiers, and network information. Only share bug reports with people and apps you trust with this information.\n\nAllow <xliff:g id="app_name" example="Gmail">%4$s</xliff:g> to upload a bug report?"</string> <!-- Content for dialog shown when there was an error parsing the incident / bug report. [CHAR LIMIT=none] --> @@ -2031,17 +2029,15 @@ Allow <xliff:g id="app_name" example="Gmail">%4$s</xliff:g> to upload a bug repo <!--Title for dialog displayed to tell user that settings are blocked due to the phone state (such as being in a call with an unknown number) [CHAR LIMIT=50] --> <string name="enhanced_confirmation_phone_state_dialog_title">Can\u2019t complete action during call</string> <!--Content for dialog displayed to tell user that settings are blocked due to the phone state (such as being in a call with an unknown number) [CHAR LIMIT=NONE] --> - <string name="enhanced_confirmation_phone_state_dialog_desc"><xliff:g id="setting_description" example="allowing apps to install other apps">%1$s</xliff:g>\n\n - This setting is blocked to protect your device and data</string> + <string name="enhanced_confirmation_phone_state_dialog_desc">This setting is blocked to protect your device and data.<xliff:g id="scam_use_setting_description" example="scammers may ask you to allow apps to install other apps">%1$s</xliff:g></string> <!--Content explaining that the "install other apps" setting is blocked due to the phone state in a dialog displayed to the user [CHAR LIMIT=NONE] --> - <string name="enhanced_confirmation_phone_state_dialog_install_desc_prefix">Scammers may try to install harmful apps by asking you to install unknown apps from a new source.</string> + <string name="enhanced_confirmation_phone_state_dialog_install_desc"><xliff:g id="empty_line">\n\n</xliff:g>Scammers may try to install harmful apps by asking you to install unknown apps from a new source.</string> <!--Content explaining that the "enable accessibility service" setting is blocked due to the phone state in a dialog displayed to the user [CHAR LIMIT=NONE] --> - <string name="enhanced_confirmation_phone_state_dialog_a11y_desc_prefix">Scammers may try to take control of your device by asking you to allow accessibility access for an app.</string> - - <!--Content explaining that a generic setting is blocked due to the phone state in a dialog displayed to the user [CHAR LIMIT=NONE] --> - <string name="enhanced_confirmation_phone_state_dialog_generic_desc_prefix">Scammers may attempt to harm your device with this setting.</string> + <string name="enhanced_confirmation_phone_state_dialog_a11y_desc"><xliff:g id="empty_line">\n\n</xliff:g>Scammers may try to take control of your device by asking you to allow accessibility access for an app.</string> + <!--Content explaining that a generic setting is blocked due to the phone state in a dialog displayed to the user. currently empty [CHAR LIMIT=NONE] --> + <string name="enhanced_confirmation_phone_state_dialog_generic_desc" /> <!--Title for dialog displayed to tell user that permissions are blocked by setting restrictions [CHAR LIMIT=50] --> <string name="enhanced_confirmation_dialog_title_permission">App was denied access to <xliff:g id="permission_name" example="contacts">%1$s</xliff:g></string> diff --git a/PermissionController/src/com/android/permissioncontroller/ecm/EnhancedConfirmationDialogActivity.kt b/PermissionController/src/com/android/permissioncontroller/ecm/EnhancedConfirmationDialogActivity.kt index d3c7e3a0b..c5191938e 100644 --- a/PermissionController/src/com/android/permissioncontroller/ecm/EnhancedConfirmationDialogActivity.kt +++ b/PermissionController/src/com/android/permissioncontroller/ecm/EnhancedConfirmationDialogActivity.kt @@ -153,8 +153,8 @@ class EnhancedConfirmationDialogActivity : FragmentActivity() { var message: CharSequence? if (settingType == SettingType.BLOCKED_DUE_TO_PHONE_STATE) { title = settingType.titleRes?.let { context.getString(it) } - val messagePrefix = getPhoneStateMessagePrefix(context, settingIdentifier) - message = settingType.messageRes?.let { context.getString(it, messagePrefix) } + val settingMessage = getPhoneStateSettingMessage(context, settingIdentifier) + message = settingType.messageRes?.let { context.getString(it, settingMessage) } } else { val url = context.getString(R.string.help_url_action_disabled_by_restricted_settings) @@ -165,18 +165,17 @@ class EnhancedConfirmationDialogActivity : FragmentActivity() { return Setting(title, message) } - private fun getPhoneStateMessagePrefix( + private fun getPhoneStateSettingMessage( context: Context, settingsIdentifier: String, ): String { return context.getString( when (settingsIdentifier) { AppOpsManager.OPSTR_BIND_ACCESSIBILITY_SERVICE -> - R.string.enhanced_confirmation_phone_state_dialog_a11y_desc_prefix + R.string.enhanced_confirmation_phone_state_dialog_a11y_desc AppOpsManager.OPSTR_REQUEST_INSTALL_PACKAGES -> - R.string.enhanced_confirmation_phone_state_dialog_install_desc_prefix - else -> - R.string.enhanced_confirmation_phone_state_dialog_generic_desc_prefix + R.string.enhanced_confirmation_phone_state_dialog_install_desc + else -> R.string.enhanced_confirmation_phone_state_dialog_generic_desc } ) } @@ -278,7 +277,7 @@ class EnhancedConfirmationDialogActivity : FragmentActivity() { return AlertDialog.Builder(dialogActivity) .setView(createDialogView(dialogActivity, title, message)) - .setPositiveButton(R.string.enhanced_confirmation_dialog_ok) { _, _ -> + .setPositiveButton(R.string.dialog_close) { _, _ -> dialogActivity.onDialogResult(DialogResult.Okay) } .create() diff --git a/PermissionController/src/com/android/permissioncontroller/role/ui/DefaultAppChildFragment.java b/PermissionController/src/com/android/permissioncontroller/role/ui/DefaultAppChildFragment.java index a396c190a..814a312c6 100644 --- a/PermissionController/src/com/android/permissioncontroller/role/ui/DefaultAppChildFragment.java +++ b/PermissionController/src/com/android/permissioncontroller/role/ui/DefaultAppChildFragment.java @@ -16,6 +16,8 @@ package com.android.permissioncontroller.role.ui; +import static com.android.permissioncontroller.PermissionControllerStatsLog.ROLE_SETTINGS_FRAGMENT_ACTION_REPORTED; + import android.app.Activity; import android.app.role.RoleManager; import android.content.Context; @@ -41,6 +43,7 @@ import androidx.preference.TwoStatePreference; import com.android.modules.utils.build.SdkLevel; import com.android.permission.flags.Flags; +import com.android.permissioncontroller.PermissionControllerStatsLog; import com.android.permissioncontroller.R; import com.android.permissioncontroller.permission.utils.Utils; import com.android.permissioncontroller.role.utils.PackageUtils; @@ -78,8 +81,8 @@ public class DefaultAppChildFragment<PF extends PreferenceFragmentCompat DefaultAppChildFragment.class.getName() + ".preference.OTHER_NFC_SERVICES"; private static final String PREFERENCE_EXTRA_PACKAGE_NAME = DefaultAppChildFragment.class.getName() + ".extra.PACKAGE_NAME"; - private static final String PREFERENCE_EXTRA_USER = DefaultAppChildFragment.class.getName() - + ".extra.USER"; + private static final String PREFERENCE_EXTRA_UID = DefaultAppChildFragment.class.getName() + + ".extra.UID"; @NonNull private String mRoleName; @@ -309,7 +312,7 @@ public class DefaultAppChildFragment<PF extends PreferenceFragmentCompat context, applicationInfo.packageName, user.getIdentifier())); Bundle extras = preference.getExtras(); extras.putString(PREFERENCE_EXTRA_PACKAGE_NAME, applicationInfo.packageName); - extras.putParcelable(PREFERENCE_EXTRA_USER, user); + extras.putInt(PREFERENCE_EXTRA_UID, applicationInfo.uid); } } else { preference = roleApplicationPreference.asTwoStatePreference(); @@ -352,24 +355,25 @@ public class DefaultAppChildFragment<PF extends PreferenceFragmentCompat } else { String packageName = preference.getExtras().getString(PREFERENCE_EXTRA_PACKAGE_NAME); - UserHandle user = - preference.getExtras().getParcelable(PREFERENCE_EXTRA_USER); + int uid = preference.getExtras().getInt(PREFERENCE_EXTRA_UID); CharSequence confirmationMessage = RoleUiBehaviorUtils.getConfirmationMessage(mRole, packageName, requireContext()); if (confirmationMessage != null) { - DefaultAppConfirmationDialogFragment.show(packageName, user, confirmationMessage, + DefaultAppConfirmationDialogFragment.show(packageName, uid, confirmationMessage, this); } else { - setDefaultApp(packageName, user); + setDefaultApp(packageName, uid); } } return true; } @Override - public void setDefaultApp(@NonNull String packageName, @NonNull UserHandle user) { - mViewModel.setDefaultApp(packageName, user); + public void setDefaultApp(@NonNull String packageName, int uid) { + PermissionControllerStatsLog.write( + ROLE_SETTINGS_FRAGMENT_ACTION_REPORTED, uid, packageName, mRoleName); + mViewModel.setDefaultApp(packageName, UserHandle.getUserHandleForUid(uid)); } private void addNonPaymentNfcServicesPreference(@NonNull PreferenceScreen preferenceScreen, diff --git a/PermissionController/src/com/android/permissioncontroller/role/ui/DefaultAppConfirmationDialogFragment.java b/PermissionController/src/com/android/permissioncontroller/role/ui/DefaultAppConfirmationDialogFragment.java index 5f399a0b8..9a9606291 100644 --- a/PermissionController/src/com/android/permissioncontroller/role/ui/DefaultAppConfirmationDialogFragment.java +++ b/PermissionController/src/com/android/permissioncontroller/role/ui/DefaultAppConfirmationDialogFragment.java @@ -20,11 +20,9 @@ import android.app.AlertDialog; import android.app.Dialog; import android.content.Intent; import android.os.Bundle; -import android.os.UserHandle; import androidx.annotation.NonNull; import androidx.annotation.Nullable; -import androidx.core.os.BundleCompat; import androidx.fragment.app.DialogFragment; import androidx.fragment.app.Fragment; @@ -34,27 +32,27 @@ import androidx.fragment.app.Fragment; public class DefaultAppConfirmationDialogFragment extends DialogFragment { private String mPackageName; - private UserHandle mUser; + private int mUid; private CharSequence mMessage; /** * Create a new instance of this fragment. * * @param packageName the package name of the application - * @param user the user the specified package is running in + * @param uid the UID the specified package is running in * @param message the confirmation message * * @return a new instance of this fragment * - * @see #show(String, UserHandle, CharSequence, Fragment) + * @see #show(String, int, CharSequence, Fragment) */ @NonNull public static DefaultAppConfirmationDialogFragment newInstance(@NonNull String packageName, - @NonNull UserHandle user, @NonNull CharSequence message) { + int uid, @NonNull CharSequence message) { DefaultAppConfirmationDialogFragment fragment = new DefaultAppConfirmationDialogFragment(); Bundle arguments = new Bundle(); arguments.putString(Intent.EXTRA_PACKAGE_NAME, packageName); - arguments.putParcelable(Intent.EXTRA_USER, user); + arguments.putInt(Intent.EXTRA_UID, uid); arguments.putCharSequence(Intent.EXTRA_TEXT, message); fragment.setArguments(arguments); return fragment; @@ -64,15 +62,15 @@ public class DefaultAppConfirmationDialogFragment extends DialogFragment { * Show a new instance of this fragment. * * @param packageName the package name of the application - * @param user the user the specified package is running in + * @param uid the UID the specified package is running in * @param message the confirmation message * @param fragment the parent fragment * - * @see #newInstance(String, UserHandle, CharSequence) + * @see #newInstance(String, int, CharSequence) */ - public static void show(@NonNull String packageName, @NonNull UserHandle user, + public static void show(@NonNull String packageName, int uid, @NonNull CharSequence message, @NonNull Fragment fragment) { - newInstance(packageName, user, message).show(fragment.getChildFragmentManager(), null); + newInstance(packageName, uid, message).show(fragment.getChildFragmentManager(), null); } @Override @@ -81,7 +79,7 @@ public class DefaultAppConfirmationDialogFragment extends DialogFragment { Bundle arguments = getArguments(); mPackageName = arguments.getString(Intent.EXTRA_PACKAGE_NAME); - mUser = BundleCompat.getParcelable(arguments, Intent.EXTRA_USER, UserHandle.class); + mUid = arguments.getInt(Intent.EXTRA_UID); mMessage = arguments.getCharSequence(Intent.EXTRA_TEXT); } @@ -97,7 +95,7 @@ public class DefaultAppConfirmationDialogFragment extends DialogFragment { private void onOk() { Listener listener = (Listener) getParentFragment(); - listener.setDefaultApp(mPackageName, mUser); + listener.setDefaultApp(mPackageName, mUid); } /** @@ -110,6 +108,6 @@ public class DefaultAppConfirmationDialogFragment extends DialogFragment { * * @param packageName the package name of the application */ - void setDefaultApp(@NonNull String packageName, @NonNull UserHandle user); + void setDefaultApp(@NonNull String packageName, int uid); } } diff --git a/SafetyCenter/OWNERS b/SafetyCenter/OWNERS index d9039e915..229331d3c 100644 --- a/SafetyCenter/OWNERS +++ b/SafetyCenter/OWNERS @@ -4,7 +4,6 @@ simonjw@google.com davidcoffin@google.com elliotsisteron@google.com fiscella@google.com -shrigupt@google.com jtomljanovic@google.com deweytyl@google.com maxspencer@google.com diff --git a/SafetyCenter/Resources/res/values-mk-v35/strings.xml b/SafetyCenter/Resources/res/values-mk-v35/strings.xml index c4fc4bd17..1201ae74f 100644 --- a/SafetyCenter/Resources/res/values-mk-v35/strings.xml +++ b/SafetyCenter/Resources/res/values-mk-v35/strings.xml @@ -21,7 +21,7 @@ <string name="cellular_network_security_summary" msgid="7319307247487475572">"Тип мрежа, шифрирање, контроли за известувања"</string> <string name="biometrics_title_for_private_profile" msgid="542819107383037820"></string> <string name="privacy_title" msgid="7047524783080782769">"Приватност"</string> - <string name="privacy_sources_title" msgid="309304028326660956">"Контроли на приватноста"</string> + <string name="privacy_sources_title" msgid="309304028326660956">"Контроли за приватност"</string> <string name="privacy_sources_summary" msgid="2165270848857537278">"Дозволи, контроли"</string> <string name="privacy_additional_title" msgid="4239060639056083649"></string> <string name="private_space_title" msgid="6158245041481535879">"Приватен простор"</string> diff --git a/SafetyCenter/Resources/res/values-mk/strings.xml b/SafetyCenter/Resources/res/values-mk/strings.xml index 2b2414d0d..379a5234b 100644 --- a/SafetyCenter/Resources/res/values-mk/strings.xml +++ b/SafetyCenter/Resources/res/values-mk/strings.xml @@ -33,9 +33,9 @@ <string name="permission_manager_title" msgid="5277347862821255015">"Управувач со дозволи"</string> <string name="permission_manager_summary" msgid="8099852107340970790">"Го контролира пристапот на апликациите до вашите податоци"</string> <string name="permission_manager_search_terms" msgid="2895147613099694722">"Дозволи, Управувач со дозволи"</string> - <string name="privacy_controls_title" msgid="5322875777945432395">"Контроли за приватноста"</string> + <string name="privacy_controls_title" msgid="5322875777945432395">"Контроли за приватност"</string> <string name="privacy_controls_summary" msgid="2402066941190435424">"Го контролира пристапот на уредот до микрофонот, камерата и друго"</string> - <string name="privacy_controls_search_terms" msgid="3774472175934304165">"Приватност, Контроли на приватноста"</string> + <string name="privacy_controls_search_terms" msgid="3774472175934304165">"Приватност, Контроли за приватност"</string> <string name="advanced_title" msgid="8745436380690561172">"Повеќе поставки"</string> <string name="advanced_security_title" msgid="1126833338772188155">"Повеќе поставки за безбедност"</string> <string name="advanced_security_summary" msgid="6172253327022425123">"Шифрирање, акредитиви и друго"</string> diff --git a/tests/cts/rolemultiuser/src/android/app/rolemultiuser/cts/RoleManagerMultiUserTest.kt b/tests/cts/rolemultiuser/src/android/app/rolemultiuser/cts/RoleManagerMultiUserTest.kt index a303d2ae4..f070fa9aa 100644 --- a/tests/cts/rolemultiuser/src/android/app/rolemultiuser/cts/RoleManagerMultiUserTest.kt +++ b/tests/cts/rolemultiuser/src/android/app/rolemultiuser/cts/RoleManagerMultiUserTest.kt @@ -71,7 +71,6 @@ import com.android.compatibility.common.util.UiAutomatorUtils2.waitFindObject import com.android.compatibility.common.util.UiAutomatorUtils2.waitFindObjectOrNull import com.google.common.truth.Truth.assertThat import com.google.common.truth.Truth.assertWithMessage -import java.util.Objects import java.util.concurrent.CompletableFuture import java.util.concurrent.TimeUnit import java.util.function.Consumer @@ -317,7 +316,7 @@ class RoleManagerMultiUserTest { // initialUser needs to be not the targetUser val targetActiveUser = users().current().userHandle() val initialUser = - if (Objects.equals(targetActiveUser, deviceState.initialUser().userHandle())) { + if (targetActiveUser == deviceState.initialUser().userHandle()) { deviceState.workProfile().userHandle() } else { deviceState.initialUser().userHandle() @@ -1648,7 +1647,12 @@ class RoleManagerMultiUserTest { getUiDevice().waitForIdle() // CollapsingToolbar title can't be found by text, so using description instead. - assertNull(waitFindObjectOrNull(By.desc(PROFILE_GROUP_EXCLUSIVITY_ROLE_LABEL))) + assertNull( + waitFindObjectOrNull( + By.desc(PROFILE_GROUP_EXCLUSIVITY_ROLE_LABEL), + IDLE_TIMEOUT_MILLIS, + ) + ) pressBack() pressBack() @@ -1684,7 +1688,12 @@ class RoleManagerMultiUserTest { getUiDevice().waitForIdle() // CollapsingToolbar title can't be found by text, so using description instead. - assertNull(waitFindObjectOrNull(By.desc(PROFILE_GROUP_EXCLUSIVITY_ROLE_LABEL))) + assertNull( + waitFindObjectOrNull( + By.desc(PROFILE_GROUP_EXCLUSIVITY_ROLE_LABEL), + IDLE_TIMEOUT_MILLIS, + ) + ) pressBack() pressBack() @@ -1819,7 +1828,8 @@ class RoleManagerMultiUserTest { if (isWatch) { assertNull( waitFindObjectOrNull( - By.clickable(true).checked(true).hasDescendant(By.text(targetAppLabel)) + By.clickable(true).checked(true).hasDescendant(By.text(targetAppLabel)), + IDLE_TIMEOUT_MILLIS, ) ) } else { @@ -1827,7 +1837,8 @@ class RoleManagerMultiUserTest { waitFindObjectOrNull( By.clickable(true) .hasDescendant(By.checkable(true).checked(true)) - .hasDescendant(By.text(targetAppLabel)) + .hasDescendant(By.text(targetAppLabel)), + IDLE_TIMEOUT_MILLIS, ) ) } @@ -1898,7 +1909,8 @@ class RoleManagerMultiUserTest { if (isWatch) { assertNull( waitFindObjectOrNull( - By.clickable(true).checked(true).hasDescendant(By.text(targetAppLabel)) + By.clickable(true).checked(true).hasDescendant(By.text(targetAppLabel)), + IDLE_TIMEOUT_MILLIS, ) ) } else { @@ -1906,7 +1918,8 @@ class RoleManagerMultiUserTest { waitFindObjectOrNull( By.clickable(true) .hasDescendant(By.checkable(true).checked(true)) - .hasDescendant(By.text(targetAppLabel)) + .hasDescendant(By.text(targetAppLabel)), + IDLE_TIMEOUT_MILLIS, ) ) } @@ -2072,10 +2085,8 @@ class RoleManagerMultiUserTest { } } - @Throws(java.lang.Exception::class) private fun installAppForAllUsers() { SystemUtil.runShellCommandOrThrow("pm install -r --user all $APP_APK_PATH") - SystemUtil.waitForBroadcasts() } private fun uninstallAppForAllUsers() { @@ -2102,8 +2113,7 @@ class RoleManagerMultiUserTest { } val result: Pair<Int, Intent?> = clickButtonAndWaitForResult(allow) val expectedResult = - if (allow && Objects.equals(targetActiveUser, users().instrumented().userHandle())) - Activity.RESULT_OK + if (allow && targetActiveUser == users().instrumented().userHandle()) Activity.RESULT_OK else Activity.RESULT_CANCELED assertThat(result.first).isEqualTo(expectedResult) @@ -2121,7 +2131,8 @@ class RoleManagerMultiUserTest { } private fun roleRequestNotShown() { - val requestRoleItem = waitFindObjectOrNull(By.textStartsWith(APP_LABEL)) + val requestRoleItem = + waitFindObjectOrNull(By.textStartsWith(APP_LABEL), IDLE_TIMEOUT_MILLIS) assertNull(requestRoleItem) val result: Pair<Int, Intent?> = waitForResult() @@ -2151,9 +2162,9 @@ class RoleManagerMultiUserTest { ) { for (userReference in users().profileGroup(deviceState.initialUser())) { val user = userReference.userHandle() - if (Objects.equals(user, expectedActiveUser)) { - val roleHolders = - roleManager.getRoleHoldersAsUser(PROFILE_GROUP_EXCLUSIVITY_ROLE_NAME, user) + val roleHolders = + roleManager.getRoleHoldersAsUser(PROFILE_GROUP_EXCLUSIVITY_ROLE_NAME, user) + if (user == expectedActiveUser) { assertWithMessage( "Expected user ${user.identifier} to have a role holder for " + " $PROFILE_GROUP_EXCLUSIVITY_ROLE_NAME" @@ -2172,9 +2183,7 @@ class RoleManagerMultiUserTest { "Expected user ${user.identifier} to not have a role holder for" + " $PROFILE_GROUP_EXCLUSIVITY_ROLE_NAME" ) - .that( - roleManager.getRoleHoldersAsUser(PROFILE_GROUP_EXCLUSIVITY_ROLE_NAME, user) - ) + .that(roleHolders) .isEmpty() } } @@ -2186,7 +2195,7 @@ class RoleManagerMultiUserTest { for (userReference in users().profileGroup(deviceState.initialUser())) { val userRoleManager = getRoleManagerForUser(userReference) val user = userReference.userHandle() - if (Objects.equals(user, expectedActiveUser)) { + if (user == expectedActiveUser) { assertWithMessage("Expected default application for user ${user.identifier}") .that( userRoleManager.getDefaultApplication(PROFILE_GROUP_EXCLUSIVITY_ROLE_NAME) @@ -2254,6 +2263,7 @@ class RoleManagerMultiUserTest { companion object { private const val TIMEOUT_MILLIS: Long = (15 * 1000).toLong() + private const val IDLE_TIMEOUT_MILLIS: Long = (2 * 1000).toLong() private const val PROFILE_GROUP_EXCLUSIVITY_ROLE_NAME = RoleManager.ROLE_RESERVED_FOR_TESTING_PROFILE_GROUP_EXCLUSIVITY private const val PROFILE_GROUP_EXCLUSIVITY_ROLE_LABEL = diff --git a/tests/cts/safetycenter/AndroidTest.xml b/tests/cts/safetycenter/AndroidTest.xml index 6d8c3069c..ed161f0b6 100644 --- a/tests/cts/safetycenter/AndroidTest.xml +++ b/tests/cts/safetycenter/AndroidTest.xml @@ -47,6 +47,10 @@ <!-- Disable syncing to prevent overwriting flags during testing. --> <option name="run-command" value="device_config set_sync_disabled_for_tests persistent" /> <option name="teardown-command" value="device_config set_sync_disabled_for_tests none" /> + <!-- Belt-and-braces attempt to dismiss keyguard. Tradefed should have already done this + for us, but this is a precaution in an attempt to mitigate b/379620557. --> + <option name="run-command" value="input keyevent KEYCODE_WAKEUP" /> + <option name="run-command" value="wm dismiss-keyguard" /> <!-- Dismiss any system dialogs (e.g. crashes, ANR). --> <option name="run-command" value="am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS --receiver-foreground" /> </target_preparer> diff --git a/tests/functional/safetycenter/multiusers/AndroidTest.xml b/tests/functional/safetycenter/multiusers/AndroidTest.xml index 20032357a..bfb7fdbf2 100644 --- a/tests/functional/safetycenter/multiusers/AndroidTest.xml +++ b/tests/functional/safetycenter/multiusers/AndroidTest.xml @@ -47,6 +47,10 @@ <!-- Disable syncing to prevent overwriting flags during testing. --> <option name="run-command" value="device_config set_sync_disabled_for_tests persistent" /> <option name="teardown-command" value="device_config set_sync_disabled_for_tests none" /> + <!-- Belt-and-braces attempt to dismiss keyguard. Tradefed should have already done this + for us, but this is a precaution in an attempt to mitigate b/379620557. --> + <option name="run-command" value="input keyevent KEYCODE_WAKEUP" /> + <option name="run-command" value="wm dismiss-keyguard" /> <!-- Dismiss any system dialogs (e.g. crashes, ANR). --> <option name="run-command" value="am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS --receiver-foreground" /> </target_preparer> diff --git a/tests/functional/safetycenter/safetycenteractivity/AndroidTest.xml b/tests/functional/safetycenter/safetycenteractivity/AndroidTest.xml index a1826653f..ee79dcd2a 100644 --- a/tests/functional/safetycenter/safetycenteractivity/AndroidTest.xml +++ b/tests/functional/safetycenter/safetycenteractivity/AndroidTest.xml @@ -47,6 +47,10 @@ <!-- Disable syncing to prevent overwriting flags during testing. --> <option name="run-command" value="device_config set_sync_disabled_for_tests persistent" /> <option name="teardown-command" value="device_config set_sync_disabled_for_tests none" /> + <!-- Belt-and-braces attempt to dismiss keyguard. Tradefed should have already done this + for us, but this is a precaution in an attempt to mitigate b/379620557. --> + <option name="run-command" value="input keyevent KEYCODE_WAKEUP" /> + <option name="run-command" value="wm dismiss-keyguard" /> <!-- Dismiss any system dialogs (e.g. crashes, ANR). --> <option name="run-command" value="am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS --receiver-foreground" /> </target_preparer> diff --git a/tests/functional/safetycenter/singleuser/AndroidTest.xml b/tests/functional/safetycenter/singleuser/AndroidTest.xml index af040eb6f..f778ca93e 100644 --- a/tests/functional/safetycenter/singleuser/AndroidTest.xml +++ b/tests/functional/safetycenter/singleuser/AndroidTest.xml @@ -47,8 +47,8 @@ <!-- Disable syncing to prevent overwriting flags during testing. --> <option name="run-command" value="device_config set_sync_disabled_for_tests persistent" /> <option name="teardown-command" value="device_config set_sync_disabled_for_tests none" /> - <!-- TODO(b/379928062): Ensure device not on lockscreen. Reassess when keyguard bug is - closed --> + <!-- Belt-and-braces attempt to dismiss keyguard. Tradefed should have already done this + for us, but this is a precaution in an attempt to mitigate b/379620557. --> <option name="run-command" value="input keyevent KEYCODE_WAKEUP" /> <option name="run-command" value="wm dismiss-keyguard" /> <!-- Dismiss any system dialogs (e.g. crashes, ANR). --> diff --git a/tests/functional/safetycenter/subpages/AndroidTest.xml b/tests/functional/safetycenter/subpages/AndroidTest.xml index c3245e9d7..ac493841f 100644 --- a/tests/functional/safetycenter/subpages/AndroidTest.xml +++ b/tests/functional/safetycenter/subpages/AndroidTest.xml @@ -47,6 +47,10 @@ <!-- Disable syncing to prevent overwriting flags during testing. --> <option name="run-command" value="device_config set_sync_disabled_for_tests persistent" /> <option name="teardown-command" value="device_config set_sync_disabled_for_tests none" /> + <!-- Belt-and-braces attempt to dismiss keyguard. Tradefed should have already done this + for us, but this is a precaution in an attempt to mitigate b/379620557. --> + <option name="run-command" value="input keyevent KEYCODE_WAKEUP" /> + <option name="run-command" value="wm dismiss-keyguard" /> <!-- Dismiss any system dialogs (e.g. crashes, ANR). --> <option name="run-command" value="am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS --receiver-foreground" /> </target_preparer> diff --git a/tests/hostside/safetycenter/AndroidTest.xml b/tests/hostside/safetycenter/AndroidTest.xml index a28b70c3c..41f0bcc40 100644 --- a/tests/hostside/safetycenter/AndroidTest.xml +++ b/tests/hostside/safetycenter/AndroidTest.xml @@ -32,6 +32,10 @@ <!-- Disable syncing to prevent overwriting flags during testing. --> <option name="run-command" value="device_config set_sync_disabled_for_tests persistent" /> <option name="teardown-command" value="device_config set_sync_disabled_for_tests none" /> + <!-- Belt-and-braces attempt to dismiss keyguard. Tradefed should have already done this + for us, but this is a precaution in an attempt to mitigate b/379620557. --> + <option name="run-command" value="input keyevent KEYCODE_WAKEUP" /> + <option name="run-command" value="wm dismiss-keyguard" /> <!-- Dismiss any system dialogs (e.g. crashes, ANR). --> <option name="run-command" value="am broadcast -a android.intent.action.CLOSE_SYSTEM_DIALOGS --receiver-foreground" /> </target_preparer> |