Merge "Support the rich content for accessibility service (2/n)"
This commit is contained in:
@@ -299,6 +299,7 @@ package android {
|
||||
field public static final int animateFirstView = 16843477; // 0x10102d5
|
||||
field public static final int animateLayoutChanges = 16843506; // 0x10102f2
|
||||
field public static final int animateOnClick = 16843356; // 0x101025c
|
||||
field public static final int animatedImageDrawable = 16844298; // 0x101060a
|
||||
field public static final int animation = 16843213; // 0x10101cd
|
||||
field public static final int animationCache = 16842989; // 0x10100ed
|
||||
field public static final int animationDuration = 16843026; // 0x1010112
|
||||
@@ -723,6 +724,7 @@ package android {
|
||||
field public static final int host = 16842792; // 0x1010028
|
||||
field public static final int hotSpotX = 16844055; // 0x1010517
|
||||
field public static final int hotSpotY = 16844056; // 0x1010518
|
||||
field public static final int htmlDescription = 16844299; // 0x101060b
|
||||
field public static final int hyphenationFrequency = 16843998; // 0x10104de
|
||||
field public static final int icon = 16842754; // 0x1010002
|
||||
field @Deprecated public static final int iconPreview = 16843337; // 0x1010249
|
||||
@@ -2926,6 +2928,7 @@ package android.accessibilityservice {
|
||||
method public int describeContents();
|
||||
method public static String feedbackTypeToString(int);
|
||||
method public static String flagToString(int);
|
||||
method public int getAnimatedImageRes();
|
||||
method @Deprecated public boolean getCanRetrieveWindowContent();
|
||||
method public int getCapabilities();
|
||||
method @Deprecated public String getDescription();
|
||||
@@ -2935,6 +2938,7 @@ package android.accessibilityservice {
|
||||
method public android.content.pm.ResolveInfo getResolveInfo();
|
||||
method public String getSettingsActivityName();
|
||||
method public String loadDescription(android.content.pm.PackageManager);
|
||||
method @Nullable public String loadHtmlDescription(@NonNull android.content.pm.PackageManager);
|
||||
method public CharSequence loadSummary(android.content.pm.PackageManager);
|
||||
method public void setInteractiveUiTimeoutMillis(@IntRange(from=0) int);
|
||||
method public void setNonInteractiveUiTimeoutMillis(@IntRange(from=0) int);
|
||||
|
||||
@@ -20,6 +20,8 @@ import static android.content.pm.PackageManager.FEATURE_FINGERPRINT;
|
||||
|
||||
import android.annotation.IntDef;
|
||||
import android.annotation.IntRange;
|
||||
import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.annotation.UnsupportedAppUsage;
|
||||
import android.compat.annotation.ChangeId;
|
||||
import android.compat.annotation.EnabledAfter;
|
||||
@@ -511,6 +513,21 @@ public class AccessibilityServiceInfo implements Parcelable {
|
||||
@EnabledAfter(targetSdkVersion = android.os.Build.VERSION_CODES.Q)
|
||||
private static final long REQUEST_ACCESSIBILITY_BUTTON_CHANGE = 136293963L;
|
||||
|
||||
/**
|
||||
* Resource id of the animated image of the accessibility service.
|
||||
*/
|
||||
private int mAnimatedImageRes;
|
||||
|
||||
/**
|
||||
* Resource id of the html description of the accessibility service.
|
||||
*/
|
||||
private int mHtmlDescriptionRes;
|
||||
|
||||
/**
|
||||
* Non localized html description of the accessibility service.
|
||||
*/
|
||||
private String mNonLocalizedHtmlDescription;
|
||||
|
||||
/**
|
||||
* Creates a new instance.
|
||||
*/
|
||||
@@ -626,6 +643,20 @@ public class AccessibilityServiceInfo implements Parcelable {
|
||||
mNonLocalizedSummary = nonLocalizedSummary.toString().trim();
|
||||
}
|
||||
}
|
||||
peekedValue = asAttributes.peekValue(
|
||||
com.android.internal.R.styleable.AccessibilityService_animatedImageDrawable);
|
||||
if (peekedValue != null) {
|
||||
mAnimatedImageRes = peekedValue.resourceId;
|
||||
}
|
||||
peekedValue = asAttributes.peekValue(
|
||||
com.android.internal.R.styleable.AccessibilityService_htmlDescription);
|
||||
if (peekedValue != null) {
|
||||
mHtmlDescriptionRes = peekedValue.resourceId;
|
||||
final CharSequence nonLocalizedHtmlDescription = peekedValue.coerceToString();
|
||||
if (nonLocalizedHtmlDescription != null) {
|
||||
mNonLocalizedHtmlDescription = nonLocalizedHtmlDescription.toString().trim();
|
||||
}
|
||||
}
|
||||
asAttributes.recycle();
|
||||
} catch (NameNotFoundException e) {
|
||||
throw new XmlPullParserException( "Unable to create context for: "
|
||||
@@ -726,6 +757,18 @@ public class AccessibilityServiceInfo implements Parcelable {
|
||||
return mSettingsActivityName;
|
||||
}
|
||||
|
||||
/**
|
||||
* The animated image resource id.
|
||||
* <p>
|
||||
* <strong>Statically set from
|
||||
* {@link AccessibilityService#SERVICE_META_DATA meta-data}.</strong>
|
||||
* </p>
|
||||
* @return The animated image resource id.
|
||||
*/
|
||||
public int getAnimatedImageRes() {
|
||||
return mAnimatedImageRes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this service can retrieve the current window's content.
|
||||
* <p>
|
||||
@@ -832,6 +875,29 @@ public class AccessibilityServiceInfo implements Parcelable {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The localized html description of the accessibility service.
|
||||
* <p>
|
||||
* <strong>Statically set from
|
||||
* {@link AccessibilityService#SERVICE_META_DATA meta-data}.</strong>
|
||||
* </p>
|
||||
* @return The localized html description.
|
||||
*/
|
||||
@Nullable
|
||||
public String loadHtmlDescription(@NonNull PackageManager packageManager) {
|
||||
if (mHtmlDescriptionRes == 0) {
|
||||
return mNonLocalizedHtmlDescription;
|
||||
}
|
||||
|
||||
final ServiceInfo serviceInfo = mResolveInfo.serviceInfo;
|
||||
final CharSequence htmlDescription = packageManager.getText(serviceInfo.packageName,
|
||||
mHtmlDescriptionRes, serviceInfo.applicationInfo);
|
||||
if (htmlDescription != null) {
|
||||
return htmlDescription.toString().trim();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the recommended time that non-interactive controls need to remain on the screen to
|
||||
* support the user.
|
||||
@@ -915,7 +981,10 @@ public class AccessibilityServiceInfo implements Parcelable {
|
||||
parcel.writeInt(mSummaryResId);
|
||||
parcel.writeString(mNonLocalizedSummary);
|
||||
parcel.writeInt(mDescriptionResId);
|
||||
parcel.writeInt(mAnimatedImageRes);
|
||||
parcel.writeInt(mHtmlDescriptionRes);
|
||||
parcel.writeString(mNonLocalizedDescription);
|
||||
parcel.writeString(mNonLocalizedHtmlDescription);
|
||||
}
|
||||
|
||||
private void initFromParcel(Parcel parcel) {
|
||||
@@ -934,7 +1003,10 @@ public class AccessibilityServiceInfo implements Parcelable {
|
||||
mSummaryResId = parcel.readInt();
|
||||
mNonLocalizedSummary = parcel.readString();
|
||||
mDescriptionResId = parcel.readInt();
|
||||
mAnimatedImageRes = parcel.readInt();
|
||||
mHtmlDescriptionRes = parcel.readInt();
|
||||
mNonLocalizedDescription = parcel.readString();
|
||||
mNonLocalizedHtmlDescription = parcel.readString();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3750,6 +3750,14 @@
|
||||
</p>
|
||||
-->
|
||||
<attr name="canRequestFingerprintGestures" 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"/>
|
||||
<!-- Html description of the accessibility service, to help users understand
|
||||
how the service can help them.-->
|
||||
<attr name="htmlDescription" format="string"/>
|
||||
|
||||
<!-- Short description of the accessibility service purpose or behavior.-->
|
||||
<attr name="description" />
|
||||
<!-- Brief summary of the accessibility service purpose or behavior. -->
|
||||
|
||||
@@ -3002,6 +3002,8 @@
|
||||
<public name="forceQueryable" />
|
||||
<!-- @hide @SystemApi -->
|
||||
<public name="resourcesMap" />
|
||||
<public name="animatedImageDrawable"/>
|
||||
<public name="htmlDescription"/>
|
||||
</public-group>
|
||||
|
||||
<public-group type="drawable" first-id="0x010800b5">
|
||||
|
||||
Reference in New Issue
Block a user