Merge "Increase timeout of contextual card pre-check."

This commit is contained in:
TreeHugger Robot
2019-02-12 04:38:35 +00:00
committed by Android (Google) Code Review
2 changed files with 8 additions and 1 deletions

View File

@@ -52,7 +52,7 @@ public class ContextualCardLoader extends AsyncLoaderCompat<List<ContextualCard>
@VisibleForTesting @VisibleForTesting
static final int DEFAULT_CARD_COUNT = 4; static final int DEFAULT_CARD_COUNT = 4;
static final int CARD_CONTENT_LOADER_ID = 1; static final int CARD_CONTENT_LOADER_ID = 1;
static final long CARD_CONTENT_LOADER_TIMEOUT_MS = DateUtils.SECOND_IN_MILLIS; static final long CARD_CONTENT_LOADER_TIMEOUT_MS = DateUtils.SECOND_IN_MILLIS * 3;
private static final String TAG = "ContextualCardLoader"; private static final String TAG = "ContextualCardLoader";
@@ -175,6 +175,7 @@ public class ContextualCardLoader extends AsyncLoaderCompat<List<ContextualCard>
@VisibleForTesting @VisibleForTesting
boolean isCardEligibleToDisplay(ContextualCard card) { boolean isCardEligibleToDisplay(ContextualCard card) {
final long startTime = System.currentTimeMillis();
if (card.isCustomCard()) { if (card.isCustomCard()) {
return true; return true;
} }
@@ -195,6 +196,10 @@ public class ContextualCardLoader extends AsyncLoaderCompat<List<ContextualCard>
provider.release(); provider.release();
final Slice slice = Slice.bindSlice(mContext, uri, SUPPORTED_SPECS); final Slice slice = Slice.bindSlice(mContext, uri, SUPPORTED_SPECS);
//TODO(b/123668403): remove the log here once we do the change with FutureTask
final long bindTime = System.currentTimeMillis() - startTime;
Log.d(TAG, "Binding time for " + uri + " = " + bindTime);
if (slice == null || slice.hasHint(HINT_ERROR)) { if (slice == null || slice.hasHint(HINT_ERROR)) {
Log.w(TAG, "Failed to bind slice, not eligible for display " + uri); Log.w(TAG, "Failed to bind slice, not eligible for display " + uri);
return false; return false;

View File

@@ -188,6 +188,8 @@ public class ContextualCardManager implements ContextualCardLoader.CardContentLo
@Override @Override
public void onFinishCardLoading(List<ContextualCard> cards) { public void onFinishCardLoading(List<ContextualCard> cards) {
final long loadTime = System.currentTimeMillis() - mStartTime; final long loadTime = System.currentTimeMillis() - mStartTime;
//TODO(b/123668403): remove the log here once we do the change with FutureTask
Log.d(TAG, "Total loading time = " + loadTime);
final List<ContextualCard> cardsToKeep = getCardsToKeep(cards); final List<ContextualCard> cardsToKeep = getCardsToKeep(cards);
//navigate back to the homepage or after card dismissal //navigate back to the homepage or after card dismissal