Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 515b989f authored by Peter_Liang's avatar Peter_Liang
Browse files

Change the attribute format of htmlDescription.

After the discussion, shouldn't let developers use the general
string which is non resource id. And only support the resource id string.

Bug: 142532186
Test: manual test
Change-Id: I912effc500c72d2ac83cc344f4e4099f6f469652
parent d810b82d
Loading
Loading
Loading
Loading
+1 −12
Original line number Original line Diff line number Diff line
@@ -550,11 +550,6 @@ public class AccessibilityServiceInfo implements Parcelable {
     */
     */
    private int mHtmlDescriptionRes;
    private int mHtmlDescriptionRes;


    /**
     * Non localized html description of the accessibility service.
     */
    private String mNonLocalizedHtmlDescription;

    /**
    /**
     * Creates a new instance.
     * Creates a new instance.
     */
     */
@@ -683,10 +678,6 @@ public class AccessibilityServiceInfo implements Parcelable {
                    com.android.internal.R.styleable.AccessibilityService_htmlDescription);
                    com.android.internal.R.styleable.AccessibilityService_htmlDescription);
            if (peekedValue != null) {
            if (peekedValue != null) {
                mHtmlDescriptionRes = peekedValue.resourceId;
                mHtmlDescriptionRes = peekedValue.resourceId;
                final CharSequence nonLocalizedHtmlDescription = peekedValue.coerceToString();
                if (nonLocalizedHtmlDescription != null) {
                    mNonLocalizedHtmlDescription = nonLocalizedHtmlDescription.toString().trim();
                }
            }
            }
            asAttributes.recycle();
            asAttributes.recycle();
        } catch (NameNotFoundException e) {
        } catch (NameNotFoundException e) {
@@ -919,7 +910,7 @@ public class AccessibilityServiceInfo implements Parcelable {
    @Nullable
    @Nullable
    public String loadHtmlDescription(@NonNull PackageManager packageManager) {
    public String loadHtmlDescription(@NonNull PackageManager packageManager) {
        if (mHtmlDescriptionRes == 0) {
        if (mHtmlDescriptionRes == 0) {
            return mNonLocalizedHtmlDescription;
            return null;
        }
        }


        final ServiceInfo serviceInfo = mResolveInfo.serviceInfo;
        final ServiceInfo serviceInfo = mResolveInfo.serviceInfo;
@@ -1017,7 +1008,6 @@ public class AccessibilityServiceInfo implements Parcelable {
        parcel.writeInt(mAnimatedImageRes);
        parcel.writeInt(mAnimatedImageRes);
        parcel.writeInt(mHtmlDescriptionRes);
        parcel.writeInt(mHtmlDescriptionRes);
        parcel.writeString(mNonLocalizedDescription);
        parcel.writeString(mNonLocalizedDescription);
        parcel.writeString(mNonLocalizedHtmlDescription);
    }
    }


    private void initFromParcel(Parcel parcel) {
    private void initFromParcel(Parcel parcel) {
@@ -1039,7 +1029,6 @@ public class AccessibilityServiceInfo implements Parcelable {
        mAnimatedImageRes = parcel.readInt();
        mAnimatedImageRes = parcel.readInt();
        mHtmlDescriptionRes = parcel.readInt();
        mHtmlDescriptionRes = parcel.readInt();
        mNonLocalizedDescription = parcel.readString();
        mNonLocalizedDescription = parcel.readString();
        mNonLocalizedHtmlDescription = parcel.readString();
    }
    }


    @Override
    @Override
+2 −2
Original line number Original line Diff line number Diff line
@@ -3774,7 +3774,7 @@
        <attr name="animatedImageDrawable" format="reference"/>
        <attr name="animatedImageDrawable" format="reference"/>
        <!-- Html description of the accessibility service, to help users understand
        <!-- Html description of the accessibility service, to help users understand
             how the service can help them.-->
             how the service can help them.-->
        <attr name="htmlDescription" format="string"/>
        <attr name="htmlDescription" format="reference"/>


        <!-- Short description of the accessibility service purpose or behavior.-->
        <!-- Short description of the accessibility service purpose or behavior.-->
        <attr name="description" />
        <attr name="description" />
@@ -3795,7 +3795,7 @@
        <attr name="animatedImageDrawable" format="reference"/>
        <attr name="animatedImageDrawable" format="reference"/>
        <!-- Html description of the target of accessibility shortcut purpose or behavior, to help
        <!-- Html description of the target of accessibility shortcut purpose or behavior, to help
             users understand how the target of accessibility shortcut can help them. -->
             users understand how the target of accessibility shortcut can help them. -->
        <attr name="htmlDescription" format="string"/>
        <attr name="htmlDescription" format="reference"/>
    </declare-styleable>
    </declare-styleable>


    <!-- Use <code>print-service</code> as the root tag of the XML resource that
    <!-- Use <code>print-service</code> as the root tag of the XML resource that