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

Commit 3a7e8317 authored by ELIYAZ MOMIN (xWF)'s avatar ELIYAZ MOMIN (xWF) Committed by Android (Google) Code Review
Browse files

Revert "Add tracing to RemoteViews"

This reverts commit 63ffeb40.

Reason for revert: <
Potential culprit for b/361066871  - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted.>

Change-Id: I2485859558f4151cbc5f3d6ca2fc9841d5ead3da
parent 63ffeb40
Loading
Loading
Loading
Loading
+16 −43
Original line number Diff line number Diff line
@@ -83,7 +83,6 @@ import android.os.Parcelable;
import android.os.Process;
import android.os.RemoteException;
import android.os.StrictMode;
import android.os.Trace;
import android.os.UserHandle;
import android.system.Os;
import android.text.TextUtils;
@@ -6247,18 +6246,6 @@ public class RemoteViews implements Parcelable, Filter {

    private View inflateView(Context context, RemoteViews rv, @Nullable ViewGroup parent,
            @StyleRes int applyThemeResId, @Nullable ColorResources colorResources) {
        try {
            Trace.beginSection(rv.hasDrawInstructions()
                    ? "RemoteViews#inflateViewWithDrawInstructions"
                    : "RemoteViews#inflateView");
            return inflateViewInternal(context, rv, parent, applyThemeResId, colorResources);
        } finally {
            Trace.endSection();
        }
    }

    private View inflateViewInternal(Context context, RemoteViews rv, @Nullable ViewGroup parent,
            @StyleRes int applyThemeResId, @Nullable ColorResources colorResources) {
        // RemoteViews may be built by an application installed in another
        // user. So build a context that loads resources from that user but
        // still returns the current users userId so settings like data / time formats
@@ -6397,7 +6384,7 @@ public class RemoteViews implements Parcelable, Filter {

        private View mResult;
        private ViewTree mTree;
        private List<Action> mActions;
        private Action[] mActions;
        private Exception mError;

        private AsyncApplyTask(
@@ -6424,20 +6411,11 @@ public class RemoteViews implements Parcelable, Filter {

                if (mRV.mActions != null) {
                    int count = mRV.mActions.size();
                    mActions = new ArrayList<>(count);
                    try {
                        Trace.beginSection(hasDrawInstructions()
                                ? "RemoteViews#initActionAsyncWithDrawInstructions"
                                : "RemoteViews#initActionAsync");
                        for (Action action : mRV.mActions) {
                            if (isCancelled()) {
                                break;
                            }
                    mActions = new Action[count];
                    for (int i = 0; i < count && !isCancelled(); i++) {
                        // TODO: check if isCancelled in nested views.
                            mActions.add(action.initActionAsync(mTree, mParent, mApplyParams));
                        }
                    } finally {
                        Trace.endSection();
                        mActions[i] = mRV.mActions.get(i)
                                .initActionAsync(mTree, mParent, mApplyParams);
                    }
                } else {
                    mActions = null;
@@ -6459,7 +6437,14 @@ public class RemoteViews implements Parcelable, Filter {

                try {
                    if (mActions != null) {
                        mRV.performApply(viewTree.mRoot, mParent, mApplyParams, mActions);

                        ActionApplyParams applyParams = mApplyParams.clone();
                        if (applyParams.handler == null) {
                            applyParams.handler = DEFAULT_INTERACTION_HANDLER;
                        }
                        for (Action a : mActions) {
                            a.apply(viewTree.mRoot, mParent, applyParams);
                        }
                    }
                    // If the parent of the view is has is a root, resolve the recycling.
                    if (mTopLevel && mResult instanceof ViewGroup) {
@@ -6635,11 +6620,6 @@ public class RemoteViews implements Parcelable, Filter {
    }

    private void performApply(View v, ViewGroup parent, ActionApplyParams params) {
        performApply(v, parent, params, mActions);
    }

    private void performApply(
            View v, ViewGroup parent, ActionApplyParams params, List<Action> actions) {
        params = params.clone();
        if (params.handler == null) {
            params.handler = DEFAULT_INTERACTION_HANDLER;
@@ -6650,16 +6630,9 @@ public class RemoteViews implements Parcelable, Filter {
        }
        if (mActions != null) {
            final int count = mActions.size();
            try {
                Trace.beginSection(hasDrawInstructions()
                        ? "RemoteViews#applyActionsWithDrawInstructions"
                        : "RemoteViews#applyActions");
            for (int i = 0; i < count; i++) {
                mActions.get(i).apply(v, parent, params);
            }
            } finally {
                Trace.endSection();
            }
        }
    }