summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/widget/RemoteViews.java59
1 files changed, 16 insertions, 43 deletions
diff --git a/core/java/android/widget/RemoteViews.java b/core/java/android/widget/RemoteViews.java
index 1922327dce23..eb3581717637 100644
--- a/core/java/android/widget/RemoteViews.java
+++ b/core/java/android/widget/RemoteViews.java
@@ -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;
- }
- // TODO: check if isCancelled in nested views.
- mActions.add(action.initActionAsync(mTree, mParent, mApplyParams));
- }
- } finally {
- Trace.endSection();
+ mActions = new Action[count];
+ for (int i = 0; i < count && !isCancelled(); i++) {
+ // TODO: check if isCancelled in nested views.
+ 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,15 +6630,8 @@ 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();
+ for (int i = 0; i < count; i++) {
+ mActions.get(i).apply(v, parent, params);
}
}
}