Merge "Clarify text shown in a11y service warning dialog"

This commit is contained in:
Phil Weaver
2018-12-11 17:15:06 +00:00
committed by Android (Google) Code Review
3 changed files with 12 additions and 69 deletions

View File

@@ -38,20 +38,13 @@
android:textAppearance="?android:attr/textAppearanceMedium"/> android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView <TextView
android:id="@+id/capabilities_header" android:id="@+id/accessibility_service_warning"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="10dip" android:padding="10dip"
android:textAlignment="viewStart" android:textAlignment="viewStart"
android:textAppearance="?android:attr/textAppearanceMedium"/> android:textAppearance="?android:attr/textAppearanceMedium"/>
<LinearLayout
android:id="@+id/capabilities"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dip"/>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>

View File

@@ -4830,11 +4830,12 @@
example="TalkBack">%1$s</xliff:g> affects data encryption, you need to confirm your password. example="TalkBack">%1$s</xliff:g> affects data encryption, you need to confirm your password.
</string> </string>
<!-- Title for the capability of an accessibility service to receive events and keys. --> <!-- Warning that explains that accessibility services have a lot of access to user data [CHAR LIMIT=NONE] -->
<string name="capability_title_receiveAccessibilityEvents">Observe your actions</string> <string name="accessibility_service_warning"><xliff:g id="service"
<!-- Description for the capability of an accessibility service to receive events and keys. --> example="TalkBack">%1$s</xliff:g> is requesting full control of this device. The service
<string name="capability_desc_receiveAccessibilityEvents">Receive notifications when you\u2019re can read the screen and act on behalf of users with accessibility needs.
interacting with an app.</string> This level of control is not appropriate for most apps.
</string>
<!-- Title for a warning about disabling an accessibility service. [CHAR LIMIT=NONE] --> <!-- Title for a warning about disabling an accessibility service. [CHAR LIMIT=NONE] -->
<string name="disable_service_title">Stop <xliff:g id="service" example="TalkBack">%1$s</xliff:g>?</string> <string name="disable_service_title">Stop <xliff:g id="service" example="TalkBack">%1$s</xliff:g>?</string>

View File

@@ -43,8 +43,8 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
/** /**
* Utility class for creating the dialog that asks users for explicit permission to grant * Utility class for creating the dialog that asks users for explicit permission for an
* all of the requested capabilities to an accessibility service before the service is enabled * accessibility service to access user data before the service is enabled
*/ */
public class AccessibilityServiceWarning { public class AccessibilityServiceWarning {
public static Dialog createCapabilitiesDialog(Activity parentActivity, public static Dialog createCapabilitiesDialog(Activity parentActivity,
@@ -117,60 +117,9 @@ public class AccessibilityServiceWarning {
encryptionWarningView.setVisibility(View.GONE); encryptionWarningView.setVisibility(View.GONE);
} }
TextView capabilitiesHeaderView = (TextView) content.findViewById( TextView serviceWarningTextView = content.findViewById(R.id.accessibility_service_warning);
R.id.capabilities_header); serviceWarningTextView.setText(context.getString(R.string.accessibility_service_warning,
capabilitiesHeaderView.setText(context.getString(R.string.capabilities_list_title, getServiceName(context, info)));
getServiceName(context, info)));
LinearLayout capabilitiesView = (LinearLayout) content.findViewById(R.id.capabilities);
// This capability is implicit for all services.
View capabilityView = inflater.inflate(
com.android.internal.R.layout.app_permission_item_old, null);
ImageView imageView = (ImageView) capabilityView.findViewById(
com.android.internal.R.id.perm_icon);
imageView.setImageDrawable(context.getDrawable(
com.android.internal.R.drawable.ic_text_dot));
TextView labelView = (TextView) capabilityView.findViewById(
com.android.internal.R.id.permission_group);
labelView.setText(context.getString(
R.string.capability_title_receiveAccessibilityEvents));
TextView descriptionView = (TextView) capabilityView.findViewById(
com.android.internal.R.id.permission_list);
descriptionView.setText(
context.getString(R.string.capability_desc_receiveAccessibilityEvents));
List<AccessibilityServiceInfo.CapabilityInfo> capabilities =
info.getCapabilityInfos(context);
capabilitiesView.addView(capabilityView);
// Service-specific capabilities.
final int capabilityCount = capabilities.size();
for (int i = 0; i < capabilityCount; i++) {
AccessibilityServiceInfo.CapabilityInfo capability = capabilities.get(i);
capabilityView = inflater.inflate(
com.android.internal.R.layout.app_permission_item_old, null);
imageView = (ImageView) capabilityView.findViewById(
com.android.internal.R.id.perm_icon);
imageView.setImageDrawable(context.getDrawable(
com.android.internal.R.drawable.ic_text_dot));
labelView = (TextView) capabilityView.findViewById(
com.android.internal.R.id.permission_group);
labelView.setText(context.getString(capability.titleResId));
descriptionView = (TextView) capabilityView.findViewById(
com.android.internal.R.id.permission_list);
descriptionView.setText(context.getString(capability.descResId));
capabilitiesView.addView(capabilityView);
}
return content; return content;
} }