Add restrict and unrestrict dialog

Add a fake unrestrict tip so we could reuse the BatteryTipDialogFragment
to build the unrestrict dialog.

After this cl, restrict dialog has two types:
1. dialog to only restrict one app
2. dialog to restrict more than one app

Will add dialog to restrict more than 5 apps when strings are finalized.

Bug: 72385333
Bug: 72227981
Test: RunSettingsRoboTests
Change-Id: Ib0328f0386efad525b331fd713dd15d060a1a649
This commit is contained in:
jackqdyulei
2018-01-25 18:00:01 -08:00
parent ab0cde6bad
commit 99a2de41ef
16 changed files with 517 additions and 106 deletions

View File

@@ -25,6 +25,7 @@ import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.fuelgauge.batterytip.AppInfo;
import java.util.ArrayList;
import java.util.List;
/**
@@ -33,9 +34,15 @@ import java.util.List;
public class RestrictAppTip extends BatteryTip {
private List<AppInfo> mRestrictAppList;
public RestrictAppTip(@StateType int state, List<AppInfo> highUsageApps) {
public RestrictAppTip(@StateType int state, List<AppInfo> restrictApps) {
super(TipType.APP_RESTRICTION, state, true /* showDialog */);
mRestrictAppList = highUsageApps;
mRestrictAppList = restrictApps;
}
public RestrictAppTip(@StateType int state, AppInfo appInfo) {
super(TipType.APP_RESTRICTION, state, true /* showDialog */);
mRestrictAppList = new ArrayList<>();
mRestrictAppList.add(appInfo);
}
@VisibleForTesting