Commit edc53019 authored by Alexander Cooper's avatar Alexander Cooper Committed by Commit Bot

Show better strings for AR when missing OS Camera Permissions

Currently when a user is attempting to use the (Chrome) AR Permission,
a default message pops up indicating that the (OS) Camera Permission is
also required. However, these strings may be confusing to the users as
they simply indicate that the requested setting is turned off in Android
Settings, and there is no corresponding AR session.  These strings help
inform the user that AR requires access to the Camera.

Fixed: 1059328
Change-Id: Ia228e97bb4553dad4dfe5ba85f74fe16fdf76a39
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2146083Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Auto-Submit: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/master@{#759833}
parent 32ee32c4
......@@ -118,8 +118,13 @@ class PermissionParamsListBuilder {
ApiCompatibilityUtils.getNotificationSettingsIntent(),
null /* androidPermissions */);
} else if (!hasAndroidPermission(permission.type)) {
permissionParams.warningTextResource =
R.string.page_info_android_permission_blocked;
if (permission.type == ContentSettingsType.AR) {
permissionParams.warningTextResource =
R.string.page_info_android_ar_camera_blocked;
} else {
permissionParams.warningTextResource =
R.string.page_info_android_permission_blocked;
}
permissionParams.clickCallback = createPermissionClickCallback(
null /* intentOverride */,
PermissionUtil.getAndroidPermissionsForContentSetting(permission.type));
......
......@@ -473,9 +473,7 @@ public class SiteSettingsCategory {
} else if (type == ContentSettingsType.MEDIASTREAM_CAMERA) {
permission_string = R.string.android_camera_permission_off;
} else if (type == ContentSettingsType.AR) {
// TODO(https://crbug.com/1058055): Use the missing camera permission
// text until we get guidance from UX team.
permission_string = R.string.android_camera_permission_off;
permission_string = R.string.android_ar_camera_permission_off;
} else if (type == ContentSettingsType.NOTIFICATIONS) {
permission_string = R.string.android_notifications_permission_off;
}
......
......@@ -47,6 +47,7 @@ import org.chromium.components.page_info.SystemSettingsActivityRequiredListener;
import org.chromium.ui.base.AndroidPermissionDelegate;
import org.chromium.ui.base.PermissionCallback;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -74,6 +75,7 @@ public class PermissionParamsListBuilderUnitTest {
when(mWebsitePreferenceBridgeMock.isPermissionControlledByDSE(
anyInt(), anyString(), anyBoolean()))
.thenReturn(false);
FakePermissionDelegate.clearBlockedPermissions();
AndroidPermissionDelegate permissionDelegate = new FakePermissionDelegate();
mSettingsActivityRequiredListener = new FakeSystemSettingsActivityRequiredListener();
mPermissionParamsListBuilder = new PermissionParamsListBuilder(
......@@ -127,6 +129,21 @@ public class PermissionParamsListBuilderUnitTest {
mSettingsActivityRequiredListener.getIntentOverride().getAction());
}
@Test
public void arNotificationWhenCameraBlocked() {
FakePermissionDelegate.blockPermission(android.Manifest.permission.CAMERA);
mPermissionParamsListBuilder.addPermissionEntry(
"Test", ContentSettingsType.AR, ContentSettingValues.ALLOW);
List<PageInfoView.PermissionRowParams> rows =
mPermissionParamsListBuilder.build().permissions;
assertEquals(1, rows.size());
PageInfoView.PermissionRowParams permissionParams = rows.get(0);
assertEquals(
R.string.page_info_android_ar_camera_blocked, permissionParams.warningTextResource);
}
@Test
@Features.EnableFeatures(SiteSettingsFeatureList.APP_NOTIFICATION_STATUS_MESSAGING)
public void appNotificationStatusMessagingWhenNotificationsDisabled() {
......@@ -181,9 +198,19 @@ public class PermissionParamsListBuilderUnitTest {
}
private static class FakePermissionDelegate implements AndroidPermissionDelegate {
private static List<String> sBlockedPermissions = new ArrayList<String>();
private static void blockPermission(String permission) {
sBlockedPermissions.add(permission);
}
private static void clearBlockedPermissions() {
sBlockedPermissions.clear();
}
@Override
public boolean hasPermission(String permission) {
return true;
return !sBlockedPermissions.contains(permission);
}
@Override
......
......@@ -1011,6 +1011,9 @@ Chromium is unable to recover your settings.
<!-- Runtime permission strings -->
<if expr="is_android">
<message name="IDS_INFOBAR_MISSING_AR_CAMERA_PERMISSION_TEXT" desc="Text shown in an infobar when a website has requested access to augmented reality capabilities, but Chrome is missing the Android camera permission.">
Chromium needs permission to access your camera to create a 3D map of your surroundings
</message>
<message name="IDS_INFOBAR_MISSING_CAMERA_PERMISSION_TEXT" desc="Text shown in an infobar when a website has requested access to the camera capabilities, but Chrome is missing the Android camera permission.">
Chromium needs permission to access your camera for this site
</message>
......
35b7c52493cfe4792a83416ffef1304347b7a991
\ No newline at end of file
......@@ -1030,6 +1030,9 @@ Google Chrome is unable to recover your settings.
<!-- Runtime permission strings -->
<if expr="is_android">
<message name="IDS_INFOBAR_MISSING_AR_CAMERA_PERMISSION_TEXT" desc="Text shown in an infobar when a website has requested access to augmented reality capabilities, but Chrome is missing the Android camera permission.">
Chrome needs permission to access your camera to create a 3D map of your surroundings
</message>
<message name="IDS_INFOBAR_MISSING_CAMERA_PERMISSION_TEXT" desc="Text shown in an infobar when a website has requested access to the camera capabilities, but Chrome is missing the Android camera permission.">
Chrome needs permission to access your camera for this site
</message>
......
e7d01efce32bdacc2334e27f6ad565640bae33e5
\ No newline at end of file
......@@ -62,7 +62,7 @@ infobars::InfoBar* PermissionUpdateInfoBarDelegate::Create(
ContentSettingsType::MEDIASTREAM_CAMERA) {
message_id = IDS_INFOBAR_MISSING_CAMERA_PERMISSION_TEXT;
} else if (content_settings_type == ContentSettingsType::AR) {
message_id = IDS_INFOBAR_MISSING_CAMERA_PERMISSION_TEXT;
message_id = IDS_INFOBAR_MISSING_AR_CAMERA_PERMISSION_TEXT;
} else {
NOTREACHED();
}
......
......@@ -1193,6 +1193,9 @@ Your Google account may have other forms of browsing history like searches and a
<message name="IDS_ANDROID_CAMERA_PERMISSION_OFF" desc="The message to show when the camera permission needs to be turned on not just in Chrome, but also in Android settings.">
To let Chrome access your camera, also turn on camera in <ph name="BEGIN_LINK">&lt;link&gt;</ph>Android Settings<ph name="END_LINK">&lt;/link&gt;</ph>.
</message>
<message name="IDS_ANDROID_AR_CAMERA_PERMISSION_OFF" desc="The message to show when the camera permission needs to be turned on in Android settings in order to use Augmented Reality.">
To let Chrome use AR, also turn on camera in <ph name="BEGIN_LINK">&lt;link&gt;</ph>Android Settings<ph name="END_LINK">&lt;/link&gt;</ph>.
</message>
<message name="IDS_ANDROID_NOTIFICATIONS_PERMISSION_OFF" desc="The message to show when the notifications permission needs to be turned on not just in Chrome, but also in Android settings.">
To let Chrome send you notifications, also turn on notifications in <ph name="BEGIN_LINK">&lt;link&gt;</ph>Android Settings<ph name="END_LINK">&lt;/link&gt;</ph>.
</message>
......@@ -2213,6 +2216,9 @@ To change this setting, <ph name="BEGIN_LINK">&lt;resetlink&gt;</ph>reset sync<p
<message name="IDS_PAGE_INFO_ANDROID_PERMISSION_BLOCKED" desc="The label used in the Page Info dialog to indicate a permission has been blocked within Android settings">
Turned off in Android settings
</message>
<message name="IDS_PAGE_INFO_ANDROID_AR_CAMERA_BLOCKED" desc="The label used in the Page Info dialog for the AR permission to indicate that Camera has been disabled for the device in Android settings">
Camera is turned off in Android settings
</message>
<message name="IDS_PAGE_INFO_ANDROID_LOCATION_BLOCKED" desc="The label used in the Page Info dialog to indicate that location has been been disabled for the device in Android settings">
Turned off for this device
</message>
......
......@@ -130,9 +130,7 @@ public class AndroidPermissionRequester {
ContentSettingsType.MEDIASTREAM_CAMERA)) {
deniedStringId = R.string.infobar_missing_camera_permission_text;
} else if (deniedContentSettings.contains(ContentSettingsType.AR)) {
// TODO(https://crbug.com/1058055): Use the missing camera permission
// text until we get guidance from UX team.
deniedStringId = R.string.infobar_missing_camera_permission_text;
deniedStringId = R.string.infobar_missing_ar_camera_permission_text;
}
}
......
......@@ -168,6 +168,9 @@
</translations>
<release allow_pseudo="false" seq="1">
<messages fallback_to_english="true">
<message name="IDS_INFOBAR_MISSING_AR_CAMERA_PERMISSION_TEXT" desc="Text shown in an infobar when a website has requested access to augmented reality capabilities, but Chrome is missing the Android camera permission.">
Chrome needs permission to access your camera to create a 3D map of your surroundings.
</message>
<message name="IDS_INFOBAR_MISSING_CAMERA_PERMISSION_TEXT" desc="Text shown in an infobar when a website has requested access to the camera capabilities, but Chrome is missing the Android camera permission.">
Chrome needs permission to access your camera for this site.
</message>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment