Add BatteryTipDetector and LowBatteryTip stuffs.

This cl adds the infra of BatteryTipDetector and use LowBatteryTip
as an example(tip model + detector).

Also add SummaryTipDetector and related tests

Bug: 70570352
Test: RunSettingsRoboTests

Change-Id: Icf1349b6ede9eb7ee5ed69b39ee3a2661ac660fa
This commit is contained in:
jackqdyulei
2017-12-14 11:15:04 -08:00
parent 03a5612355
commit 5f0b09648b
12 changed files with 504 additions and 4 deletions

View File

@@ -31,7 +31,7 @@ import java.lang.annotation.RetentionPolicy;
* Each {@link BatteryTip} contains basic data(e.g. title, summary, icon) as well as the
* pre-defined action(e.g. turn on battery saver)
*/
public abstract class BatteryTip {
public abstract class BatteryTip implements Comparable<BatteryTip> {
@Retention(RetentionPolicy.SOURCE)
@IntDef({StateType.NEW,
StateType.HANDLED,
@@ -114,4 +114,13 @@ public abstract class BatteryTip {
public int getState() {
return mState;
}
public boolean isVisible() {
return mState != StateType.INVISIBLE;
}
@Override
public int compareTo(BatteryTip o) {
return mType - o.mType;
}
}