From afa6b79c209a81e28b61005344ee55ebbe6eae73 Mon Sep 17 00:00:00 2001 From: Claudiu Ghioc Date: Fri, 3 Mar 2023 14:06:25 +0100 Subject: [PATCH] Update strings for glasses and nearby_device_streaming * update prompt strings for the two new CDM profiles with versions approved by UX Bug: 261147998 Test: manually Change-Id: Ic705986864164fec99f444a3d02a22cd3641fc23 Signed-off-by: Claudiu Ghioc --- .../res/values/strings.xml | 24 ++++++++----------- .../CompanionDeviceActivity.java | 5 +++- .../CompanionDeviceResources.java | 17 +++++++++---- .../CompanionVendorHelperDialogFragment.java | 8 ++++--- 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/packages/CompanionDeviceManager/res/values/strings.xml b/packages/CompanionDeviceManager/res/values/strings.xml index b8427613d8ce3..82e5a7f0682a0 100644 --- a/packages/CompanionDeviceManager/res/values/strings.xml +++ b/packages/CompanionDeviceManager/res/values/strings.xml @@ -36,17 +36,19 @@ The app is needed to manage your %1$s. %2$s will be allowed to sync info, like the name of someone calling, and access these permissions: - + + Allow <strong>%1$s</strong> to manage <strong>%2$s</strong>? + glasses - This app is needed to manage %1$s. %2$s will be allowed to interact with your notifications and access your Phone, SMS, Contacts, Microphone and Nearby devices permissions. + This app is needed to manage %1$s. %2$s will be allowed to interact with your notifications and access your Phone, SMS, Contacts, Microphone and Nearby devices permissions. - The app is needed to manage %1$s. %2$s will be allowed to interact with these permissions: + This app will be allowed to access these permissions on your phone: @@ -81,17 +83,13 @@ %1$s is requesting permission on behalf of your %2$s to access your phone\u2019s photos, media, and notifications - - Allow <strong>%1$s</strong> to perform this action from your phone - - - Cross-device services + Allow <strong>%1$s</strong> to take this action? - %1$s is requesting permission on behalf of your %2$s to stream content to nearby devices + %1$s is requesting permission on behalf of your %2$s to stream apps and other system features to nearby devices @@ -161,7 +159,7 @@ Apps - Nearby Device Streaming + Streaming Can make and manage phone calls @@ -179,8 +177,7 @@ Can access your calendar - - Can record audio using the microphone + Can record audio Can find, connect to, and determine the relative position of nearby devices @@ -195,7 +192,6 @@ - - Stream content to a nearby device + Stream apps and other system features from your phone diff --git a/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionDeviceActivity.java b/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionDeviceActivity.java index 918f9c681c5a2..8316f9df323fe 100644 --- a/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionDeviceActivity.java +++ b/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionDeviceActivity.java @@ -30,6 +30,7 @@ import static com.android.companiondevicemanager.CompanionDeviceDiscoveryService import static com.android.companiondevicemanager.CompanionDeviceResources.MULTI_DEVICES_SUMMARIES; import static com.android.companiondevicemanager.CompanionDeviceResources.PERMISSION_TYPES; import static com.android.companiondevicemanager.CompanionDeviceResources.PROFILES_NAME; +import static com.android.companiondevicemanager.CompanionDeviceResources.PROFILES_NAME_MULTI; import static com.android.companiondevicemanager.CompanionDeviceResources.PROFILE_ICON; import static com.android.companiondevicemanager.CompanionDeviceResources.SUMMARIES; import static com.android.companiondevicemanager.CompanionDeviceResources.SUPPORTED_PROFILES; @@ -571,6 +572,7 @@ public class CompanionDeviceActivity extends FragmentActivity implements final String deviceProfile = mRequest.getDeviceProfile(); final String profileName; + final String profileNameMulti; final Spanned summary; final Drawable profileIcon; final int summaryResourceId; @@ -580,6 +582,7 @@ public class CompanionDeviceActivity extends FragmentActivity implements } profileName = getString(PROFILES_NAME.get(deviceProfile)); + profileNameMulti = getString(PROFILES_NAME_MULTI.get(deviceProfile)); profileIcon = getIcon(this, PROFILE_ICON.get(deviceProfile)); summaryResourceId = MULTI_DEVICES_SUMMARIES.get(deviceProfile); @@ -590,7 +593,7 @@ public class CompanionDeviceActivity extends FragmentActivity implements } final Spanned title = getHtmlFromResources( - this, R.string.chooser_title, profileName, appLabel); + this, R.string.chooser_title, profileNameMulti, appLabel); mTitle.setText(title); mSummary.setText(summary); diff --git a/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionDeviceResources.java b/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionDeviceResources.java index e3fd3545ca4b2..7aed13960b08d 100644 --- a/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionDeviceResources.java +++ b/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionDeviceResources.java @@ -59,7 +59,7 @@ final class CompanionDeviceResources { map.put(DEVICE_PROFILE_COMPUTER, R.string.title_computer); map.put(DEVICE_PROFILE_NEARBY_DEVICE_STREAMING, R.string.title_nearby_device_streaming); map.put(DEVICE_PROFILE_WATCH, R.string.confirmation_title); - map.put(DEVICE_PROFILE_GLASSES, R.string.confirmation_title); + map.put(DEVICE_PROFILE_GLASSES, R.string.confirmation_title_glasses); map.put(null, R.string.confirmation_title); TITLES = unmodifiableMap(map); @@ -97,7 +97,7 @@ final class CompanionDeviceResources { static { final Map map = new ArrayMap<>(); map.put(DEVICE_PROFILE_WATCH, R.string.summary_watch); - map.put(DEVICE_PROFILE_GLASSES, R.string.summary_glasses); + map.put(DEVICE_PROFILE_GLASSES, R.string.summary_glasses_multi_device); map.put(null, R.string.summary_generic); MULTI_DEVICES_SUMMARIES = unmodifiableMap(map); @@ -113,6 +113,16 @@ final class CompanionDeviceResources { PROFILES_NAME = unmodifiableMap(map); } + static final Map PROFILES_NAME_MULTI; + static { + final Map map = new ArrayMap<>(); + map.put(DEVICE_PROFILE_GLASSES, R.string.profile_name_generic); + map.put(DEVICE_PROFILE_WATCH, R.string.profile_name_watch); + map.put(null, R.string.profile_name_generic); + + PROFILES_NAME_MULTI = unmodifiableMap(map); + } + static final Map PROFILE_ICON; static { final Map map = new ArrayMap<>(); @@ -133,7 +143,6 @@ final class CompanionDeviceResources { SUPPORTED_PROFILES = unmodifiableSet(set); } - static final Set SUPPORTED_SELF_MANAGED_PROFILES; static { final Set set = new ArraySet<>(); @@ -145,6 +154,4 @@ final class CompanionDeviceResources { SUPPORTED_SELF_MANAGED_PROFILES = unmodifiableSet(set); } - - } diff --git a/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionVendorHelperDialogFragment.java b/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionVendorHelperDialogFragment.java index eae14a6ac1757..8f32dbb86d04a 100644 --- a/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionVendorHelperDialogFragment.java +++ b/packages/CompanionDeviceManager/src/com/android/companiondevicemanager/CompanionVendorHelperDialogFragment.java @@ -21,6 +21,7 @@ import static android.companion.AssociationRequest.DEVICE_PROFILE_COMPUTER; import static android.companion.AssociationRequest.DEVICE_PROFILE_NEARBY_DEVICE_STREAMING; import static com.android.companiondevicemanager.Utils.getApplicationIcon; +import static com.android.companiondevicemanager.Utils.getApplicationLabel; import static com.android.companiondevicemanager.Utils.getHtmlFromResources; import android.annotation.Nullable; @@ -105,9 +106,11 @@ public class CompanionVendorHelperDialogFragment extends DialogFragment { final String packageName = request.getPackageName(); final CharSequence displayName = request.getDisplayName(); final int userId = request.getUserId(); + final CharSequence appLabel; try { applicationIcon = getApplicationIcon(getContext(), packageName); + appLabel = getApplicationLabel(getContext(), packageName, userId); } catch (PackageManager.NameNotFoundException e) { Log.e(TAG, "Package u" + userId + "/" + packageName + " not found."); mListener.onShowHelperDialogFailed(); @@ -119,7 +122,7 @@ public class CompanionVendorHelperDialogFragment extends DialogFragment { mAppIcon = view.findViewById(R.id.app_icon); mButton = view.findViewById(R.id.btn_back); - final Spanned title; + final CharSequence title; final Spanned summary; switch (deviceProfile) { @@ -136,8 +139,7 @@ public class CompanionVendorHelperDialogFragment extends DialogFragment { break; case DEVICE_PROFILE_NEARBY_DEVICE_STREAMING: - title = getHtmlFromResources(getContext(), - R.string.helper_title_nearby_device_streaming); + title = appLabel; summary = getHtmlFromResources( getContext(), R.string.helper_summary_nearby_device_streaming, title, displayName);