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

Commit a33243eb authored by Svetoslav's avatar Svetoslav
Browse files

Optimize loading of resource name when reported to accessibility.

Loading of the resource id name was unnecessarily complex and
was generating spam in the log as a result.

bug:8153518

Change-Id: Ib2c1118fd36b86ba8ce803ba3190fa01ab06e8c3
parent 3c672189
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package android.view;

import android.app.ActivityThread;
import android.content.Context;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Bundle;
@@ -218,13 +216,8 @@ final class AccessibilityInteractionController {
                root = mViewRootImpl.mView;
            }
            if (root != null) {
                int resolvedViewId = root.getContext().getResources().getIdentifier(
                        viewId, "id", root.getContext().getPackageName());
                if (resolvedViewId <= 0) {
                    resolvedViewId = ((Context) ActivityThread.currentActivityThread()
                            .getSystemContext()).getResources()
                            .getIdentifier(viewId, "id", "android");
                }
                final int resolvedViewId = root.getContext().getResources()
                        .getIdentifier(viewId, null, null);
                if (resolvedViewId <= 0) {
                    return;
                }
+2 −11
Original line number Diff line number Diff line
@@ -5022,22 +5022,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            if ((mAttachInfo.mAccessibilityFetchFlags
                    & AccessibilityNodeInfo.FLAG_REPORT_VIEW_IDS) != 0) {
                String viewId = null;
                try {
                    viewId = getResources().getResourceName(mID);
                } catch (Resources.NotFoundException nfe) {
                    /* ignore */
                }
                if (viewId == null) {
                    try {
                        viewId = ((Context) ActivityThread.currentActivityThread()
                                .getSystemContext()).getResources().getResourceName(mID);
                    String viewId = getResources().getResourceName(mID);
                    info.setViewIdResourceName(viewId);
                } catch (Resources.NotFoundException nfe) {
                    /* ignore */
                }
            }
                info.setViewIdResourceName(viewId);
            }
        }
        if (mLabelForId != View.NO_ID) {