@Test public void testGetExpiry() { Uri uri = Uri.parse("content: long timestamp = System.currentTimeMillis(); long ttl = TimeUnit.DAYS.toMillis(1); Slice ttlSlice = new Slice.Builder(uri) .addText("Some text", null) .addLong(timestamp, null) .addLong(timestamp, null, SliceHints.HINT_LAST_UPDATED) .addLong(ttl, null, SliceHints.HINT_TTL) .build(); SliceMetadata si1 = SliceMetadata.from(mContext, ttlSlice); long retrievedTtl = si1.getExpiry(); assertEquals(ttl, retrievedTtl); Slice noTtlSlice = new Slice.Builder(uri) .addText("Some text", null) .addLong(timestamp, null).build(); SliceMetadata si2 = SliceMetadata.from(mContext, noTtlSlice); long retrievedTtl2 = si2.getExpiry(); assertEquals(0, retrievedTtl2); }
public long getExpiry() { return mExpiry; }
SliceMetadata { public long getExpiry() { return mExpiry; } }
SliceMetadata { public long getExpiry() { return mExpiry; } private  SliceMetadata(@NonNull Context context, @NonNull Slice slice); }
SliceMetadata { public long getExpiry() { return mExpiry; } private  SliceMetadata(@NonNull Context context, @NonNull Slice slice); static SliceMetadata from(@NonNull Context context, @NonNull Slice slice); @Nullable List<SliceItem> getSliceActions(); @Nullable SliceAction getPrimaryAction(); @EventInfo.SliceRowType int getHeaderType(); boolean hasLargeMode(); List<SliceAction> getToggles(); @Nullable PendingIntent getInputRangeAction(); @Nullable Pair<Integer, Integer> getRange(); @NonNull int getRangeValue(); @Nullable List<String> getSliceKeywords(); int getLoadingState(); long getExpiry(); long getLastUpdatedTime(); boolean isPermissionSlice(); @Nullable @RestrictTo(RestrictTo.Scope.LIBRARY) static List<SliceItem> getSliceActions(@NonNull Slice slice); }
SliceMetadata { public long getExpiry() { return mExpiry; } private  SliceMetadata(@NonNull Context context, @NonNull Slice slice); static SliceMetadata from(@NonNull Context context, @NonNull Slice slice); @Nullable List<SliceItem> getSliceActions(); @Nullable SliceAction getPrimaryAction(); @EventInfo.SliceRowType int getHeaderType(); boolean hasLargeMode(); List<SliceAction> getToggles(); @Nullable PendingIntent getInputRangeAction(); @Nullable Pair<Integer, Integer> getRange(); @NonNull int getRangeValue(); @Nullable List<String> getSliceKeywords(); int getLoadingState(); long getExpiry(); long getLastUpdatedTime(); boolean isPermissionSlice(); @Nullable @RestrictTo(RestrictTo.Scope.LIBRARY) static List<SliceItem> getSliceActions(@NonNull Slice slice); static final int LOADED_NONE; static final int LOADED_PARTIAL; static final int LOADED_ALL; }