Add a property for the declarition of accessibility purpose
AccessibilityService is a powerful service that could view the content or control the device. However, some apps using it is not for accessibility. We would like to add "isAccessibilityTool" property in the xml to distinguish its purpose. If the Accessibilityservices is not for users with disabilities, system would inform the user after enabling for a period of time. Bug: 176960226 Test: atest CtsAccessibilityTestCases#AccessibilityServiceInfoTest Change-Id: I91327470ce39a28e701fa6841f9edccc1a92ffe4
This commit is contained in:
@@ -817,6 +817,7 @@ package android {
|
||||
field public static final int installLocation = 16843447; // 0x10102b7
|
||||
field public static final int interactiveUiTimeout = 16844181; // 0x1010595
|
||||
field public static final int interpolator = 16843073; // 0x1010141
|
||||
field public static final int isAccessibilityTool = 16844353; // 0x1010641
|
||||
field public static final int isAlwaysSyncable = 16843571; // 0x1010333
|
||||
field public static final int isAsciiCapable = 16843753; // 0x10103e9
|
||||
field public static final int isAuxiliary = 16843647; // 0x101037f
|
||||
@@ -3101,6 +3102,7 @@ package android.accessibilityservice {
|
||||
method public int getNonInteractiveUiTimeoutMillis();
|
||||
method public android.content.pm.ResolveInfo getResolveInfo();
|
||||
method public String getSettingsActivityName();
|
||||
method public boolean isAccessibilityTool();
|
||||
method public String loadDescription(android.content.pm.PackageManager);
|
||||
method public CharSequence loadSummary(android.content.pm.PackageManager);
|
||||
method public void setInteractiveUiTimeoutMillis(@IntRange(from=0) int);
|
||||
|
||||
@@ -579,6 +579,13 @@ public class AccessibilityServiceInfo implements Parcelable {
|
||||
*/
|
||||
private int mHtmlDescriptionRes;
|
||||
|
||||
/**
|
||||
* Whether the service is for accessibility.
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
private boolean mIsAccessibilityTool = false;
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
*/
|
||||
@@ -708,6 +715,8 @@ public class AccessibilityServiceInfo implements Parcelable {
|
||||
if (peekedValue != null) {
|
||||
mHtmlDescriptionRes = peekedValue.resourceId;
|
||||
}
|
||||
mIsAccessibilityTool = asAttributes.getBoolean(
|
||||
R.styleable.AccessibilityService_isAccessibilityTool, false);
|
||||
asAttributes.recycle();
|
||||
} catch (NameNotFoundException e) {
|
||||
throw new XmlPullParserException( "Unable to create context for: "
|
||||
@@ -1035,6 +1044,15 @@ public class AccessibilityServiceInfo implements Parcelable {
|
||||
|| mResolveInfo.serviceInfo.directBootAware;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates if the service is used to assist users with disabilities.
|
||||
*
|
||||
* @return {@code true} if the property is set to true.
|
||||
*/
|
||||
public boolean isAccessibilityTool() {
|
||||
return mIsAccessibilityTool;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -1061,6 +1079,7 @@ public class AccessibilityServiceInfo implements Parcelable {
|
||||
parcel.writeInt(mAnimatedImageRes);
|
||||
parcel.writeInt(mHtmlDescriptionRes);
|
||||
parcel.writeString(mNonLocalizedDescription);
|
||||
parcel.writeBoolean(mIsAccessibilityTool);
|
||||
}
|
||||
|
||||
private void initFromParcel(Parcel parcel) {
|
||||
@@ -1082,6 +1101,7 @@ public class AccessibilityServiceInfo implements Parcelable {
|
||||
mAnimatedImageRes = parcel.readInt();
|
||||
mHtmlDescriptionRes = parcel.readInt();
|
||||
mNonLocalizedDescription = parcel.readString();
|
||||
mIsAccessibilityTool = parcel.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1136,6 +1156,8 @@ public class AccessibilityServiceInfo implements Parcelable {
|
||||
stringBuilder.append(", ");
|
||||
stringBuilder.append("summary: ").append(mNonLocalizedSummary);
|
||||
stringBuilder.append(", ");
|
||||
stringBuilder.append("isAccessibilityTool: ").append(mIsAccessibilityTool);
|
||||
stringBuilder.append(", ");
|
||||
appendCapabilities(stringBuilder, mCapabilities);
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
@@ -3853,6 +3853,15 @@
|
||||
<!-- Attribute whether the accessibility service wants to be able to take screenshot. -->
|
||||
<attr name="canTakeScreenshot" format="boolean" />
|
||||
|
||||
<!-- Attribute indicating whether the accessibility service is used to assist users with
|
||||
disabilities. This criteria might be defined by the installer. The default is false.
|
||||
<p>
|
||||
Note: If this flag is false, system will show a notification after a duration to
|
||||
inform the user about the privacy implications of the service.
|
||||
</p>
|
||||
-->
|
||||
<attr name="isAccessibilityTool" format="boolean" />
|
||||
|
||||
<!-- Animated image of the accessibility service purpose or behavior, to help users
|
||||
understand how the service can help them.-->
|
||||
<attr name="animatedImageDrawable" format="reference"/>
|
||||
|
||||
@@ -3087,6 +3087,7 @@
|
||||
<public name="dataExtractionRules"/>
|
||||
<public name="passwordsActivity"/>
|
||||
<public name="selectableAsDefault"/>
|
||||
<public name="isAccessibilityTool"/>
|
||||
</public-group>
|
||||
|
||||
<public-group type="drawable" first-id="0x010800b5">
|
||||
|
||||
Reference in New Issue
Block a user