Implement new dismissal behaviour of contextual card
Currently, if a contextual card gets dismissed, it will be gone forever. After this change, all cards being dismissed can be shown again after a certain amount of time(e.g one day). In order to calculate the amount of time, CARD_DISMISSED column is replaced with DISMISSED_TIMESTAMP. Once a card gets dismissed, a timestamp will be recorded for a corresponding card. In this change, some methods are moved from CardDatabaseHelper to ContextualCardFeatureProvider. So OEMs could replace the providers with their own ones to get cards and have different dismissal behaviours. Bug: 143055685 Test: rototests Change-Id: I00ace98991cabcbfcae4fc47a44e9448683d680c
This commit is contained in:
@@ -16,10 +16,25 @@
|
||||
|
||||
package com.android.settings.homepage.contextualcards;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
|
||||
import androidx.slice.Slice;
|
||||
|
||||
/** Feature provider for the contextual card feature. */
|
||||
public interface ContextualCardFeatureProvider {
|
||||
/** Get contextual cards from the card provider */
|
||||
Cursor getContextualCards();
|
||||
|
||||
/**
|
||||
* Mark a specific {@link ContextualCard} as dismissed with dismissal signal in the database
|
||||
* to indicate that the card has been dismissed.
|
||||
*
|
||||
* @param context Context
|
||||
* @param cardName The card name of the ContextualCard which is dismissed by user.
|
||||
* @return The number of rows updated
|
||||
*/
|
||||
int markCardAsDismissed(Context context, String cardName);
|
||||
|
||||
/** Log package when user clicks contextual notification channel card. */
|
||||
void logNotificationPackage(Slice slice);
|
||||
|
||||
Reference in New Issue
Block a user