FileDocCategorySizeDatePackage
RankingReconsideration.javaAPI DocAndroid 5.1 API2691Thu Mar 12 22:22:42 GMT 2015com.android.server.notification

RankingReconsideration

public abstract class RankingReconsideration extends Object implements Runnable
Represents future work required to extract signals from notifications for ranking. {@hide}

Fields Summary
private static final long
IMMEDIATE
private static final int
START
private static final int
RUNNING
private static final int
DONE
private static final int
CANCELLED
private int
mState
private long
mDelay
protected String
mKey
Constructors Summary
public RankingReconsideration(String key)


       
        this(key, IMMEDIATE);
    
public RankingReconsideration(String key, long delay)

        mDelay = delay;
        mKey = key;
        mState = START;
    
Methods Summary
public abstract voidapplyChangesLocked(NotificationRecord record)
Apply any computed changes to the notification record. This method will be called on the main service thread, synchronized on he mNotificationList.

param
record The locked record to be updated.

public booleancancel(boolean mayInterruptIfRunning)

        if (mState == START) {  // can't cancel if running or done
            mState = CANCELLED;
            return true;
        }
        return false;
    
public longgetDelay(java.util.concurrent.TimeUnit unit)

        return unit.convert(mDelay, TimeUnit.MILLISECONDS);
    
public java.lang.StringgetKey()

        return mKey;
    
public booleanisCancelled()

        return mState == CANCELLED;
    
public booleanisDone()

        return mState == DONE;
    
public voidrun()

        if (mState == START) {
            mState = RUNNING;

            work();

            mState = DONE;
            synchronized (this) {
                notifyAll();
            }
        }
    
public abstract voidwork()
Analyse the notification. This will be called on a worker thread. To avoid concurrency issues, do not use held references to modify the {@link NotificationRecord}.