Add impl for force stop action

Also refactor the AnomalyAction so it could take source id as
a parameter, which represents the fragment that invokes it.

Bug: 36924669
Test: RunSettingsRoboTests
Change-Id: Ib53865f92e1a6f1e9dcc1480c0c74fbcfb0226f4
This commit is contained in:
jackqdyulei
2017-05-01 16:32:50 -07:00
parent 5a24c1b84c
commit 66242d0e3d
11 changed files with 161 additions and 18 deletions

View File

@@ -42,11 +42,19 @@ public class AnomalySummaryPreferenceController {
List<Anomaly> mAnomalies;
private SettingsActivity mSettingsActivity;
/**
* Metrics key about fragment that create this controller
*
* @see com.android.internal.logging.nano.MetricsProto.MetricsEvent
*/
private int mMetricsKey;
public AnomalySummaryPreferenceController(SettingsActivity activity,
PreferenceFragment fragment) {
PreferenceFragment fragment, int metricsKey) {
mFragment = fragment;
mSettingsActivity = activity;
mAnomalyPreference = mFragment.getPreferenceScreen().findPreference(ANOMALY_KEY);
mMetricsKey = metricsKey;
hideHighUsagePreference();
}
@@ -54,7 +62,8 @@ public class AnomalySummaryPreferenceController {
if (mAnomalies != null && ANOMALY_KEY.equals(preference.getKey())) {
if (mAnomalies.size() == 1) {
final Anomaly anomaly = mAnomalies.get(0);
AnomalyDialogFragment dialogFragment = AnomalyDialogFragment.newInstance(anomaly);
AnomalyDialogFragment dialogFragment = AnomalyDialogFragment.newInstance(anomaly,
mMetricsKey);
dialogFragment.setTargetFragment(mFragment, REQUEST_ANOMALY_ACTION);
dialogFragment.show(mFragment.getFragmentManager(), TAG);
} else {