summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/notification/row/RowInflaterTask.java50
-rw-r--r--packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowBuilder.kt7
2 files changed, 6 insertions, 51 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/RowInflaterTask.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/RowInflaterTask.java
index 9f634bef4c5e..35afda7084d9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/RowInflaterTask.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/RowInflaterTask.java
@@ -19,7 +19,6 @@ package com.android.systemui.statusbar.notification.row;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
-import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
@@ -90,59 +89,10 @@ public class RowInflaterTask implements InflationTask, AsyncLayoutInflater.OnInf
inflater.inflate(R.layout.status_bar_notification_row, parent, listenerExecutor, this);
}
- /**
- * Inflates a new notificationView synchronously.
- * This method is only for testing-purpose.
- */
- @VisibleForTesting
- public ExpandableNotificationRow inflateSynchronously(@NonNull Context context,
- @Nullable ViewGroup parent, @NonNull NotificationEntry entry) {
- final LayoutInflater inflater = new BasicRowInflater(context);
- inflater.setFactory2(makeRowInflater(entry));
- final ExpandableNotificationRow inflate = (ExpandableNotificationRow) inflater.inflate(
- R.layout.status_bar_notification_row,
- parent /* root */,
- false /* attachToRoot */);
- return inflate;
- }
-
private RowAsyncLayoutInflater makeRowInflater(NotificationEntry entry) {
return new RowAsyncLayoutInflater(entry, mSystemClock, mLogger);
}
- /**
- * A {@link LayoutInflater} that is copy of BasicLayoutInflater.
- */
- private static class BasicRowInflater extends LayoutInflater {
- private static final String[] sClassPrefixList =
- {"android.widget.", "android.webkit.", "android.app."};
- BasicRowInflater(Context context) {
- super(context);
- }
-
- @Override
- public LayoutInflater cloneInContext(Context newContext) {
- return new BasicRowInflater(newContext);
- }
-
- @Override
- protected View onCreateView(String name, AttributeSet attrs) throws ClassNotFoundException {
- for (String prefix : sClassPrefixList) {
- try {
- View view = createView(name, prefix, attrs);
- if (view != null) {
- return view;
- }
- } catch (ClassNotFoundException e) {
- // In this case we want to let the base class take a crack
- // at it.
- }
- }
-
- return super.onCreateView(name, attrs);
- }
- }
-
@VisibleForTesting
public static class RowAsyncLayoutInflater implements AsyncLayoutFactory {
private final NotificationEntry mEntry;
diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowBuilder.kt b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowBuilder.kt
index 0b309b59b0dc..b8dec3146a47 100644
--- a/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowBuilder.kt
+++ b/packages/SystemUI/tests/utils/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRowBuilder.kt
@@ -319,9 +319,14 @@ class ExpandableNotificationRowBuilder(
// NOTE: This flag is read when the ExpandableNotificationRow is inflated, so it needs to be
// set, but we do not want to override an existing value that is needed by a specific test.
+ val rowFuture: SettableFuture<ExpandableNotificationRow> = SettableFuture.create()
val rowInflaterTask =
RowInflaterTask(mFakeSystemClock, Mockito.mock(RowInflaterTaskLogger::class.java))
- val row = rowInflaterTask.inflateSynchronously(context, null, entry)
+ rowInflaterTask.inflate(context, null, entry, MoreExecutors.directExecutor()) { inflatedRow
+ ->
+ rowFuture.set(inflatedRow)
+ }
+ val row = rowFuture.get(1, TimeUnit.SECONDS)
entry.row = row
mIconManager.createIcons(entry)