Only register conditions receiver when needed.
1. Update the dnd receiver to listen when dashboard summary running. - remove the dnd receiver from Android manifest, and create it inside the dnd condition. - add lifecycle implementation to condition manager, so that the dnd condition can know when to register and unregister the receiver. - remove getReceiverClass() from dnd condition so that its receiver will not be disabled by the default condition handling when condition is silenced. 2. Remove all other conditions receiver from Android manifest. - the broadcast receivers for HotspotCondition, AirplaneModeCondition, CellularDataCondition from the manifest and create them inside the condition classes. - update Condition.onSilenceChanged() to register/unregister the receivers instead of enable/disable the receiver class. Change-Id: Iea6288382680df2b02884d1934b8db85daae404c Fix: 35968517 Test: make RunSettingsRoboTests
This commit is contained in:
@@ -92,6 +92,7 @@ public class DashboardSummary extends InstrumentedFragment
|
||||
mSummaryLoader = new SummaryLoader(activity, CategoryKey.CATEGORY_HOMEPAGE);
|
||||
|
||||
mConditionManager = ConditionManager.get(activity, false);
|
||||
getLifecycle().addObserver(mConditionManager);
|
||||
mSuggestionParser = new SuggestionParser(activity,
|
||||
activity.getSharedPreferences(SUGGESTIONS, 0), R.xml.suggestion_ordering);
|
||||
mSuggestionsChecks = new SuggestionsChecks(getContext());
|
||||
|
Reference in New Issue
Block a user