Increase timeout of contextual card pre-check.

- Also add logs for the binding time of each card.

Bug: 123043695
Test: robotest
Change-Id: Iba666f60bccb27658e43af992ce80be98e5ff7ea
This commit is contained in:
Yi-Ling Chuang
2019-01-31 13:23:28 +08:00
parent 2a736c6ed3
commit 1f595d9659
2 changed files with 8 additions and 1 deletions

View File

@@ -51,7 +51,7 @@ public class ContextualCardLoader extends AsyncLoaderCompat<List<ContextualCard>
@VisibleForTesting
static final int DEFAULT_CARD_COUNT = 4;
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";
@@ -170,6 +170,7 @@ public class ContextualCardLoader extends AsyncLoaderCompat<List<ContextualCard>
@VisibleForTesting
boolean isCardEligibleToDisplay(ContextualCard card) {
final long startTime = System.currentTimeMillis();
if (card.isCustomCard()) {
return true;
}
@@ -190,6 +191,10 @@ public class ContextualCardLoader extends AsyncLoaderCompat<List<ContextualCard>
provider.release();
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)) {
Log.w(TAG, "Failed to bind slice, not eligible for display " + uri);
return false;