Refine the update process of battery tip
1. When device is rotated, don't update the battery tip 2. When user go back to battery main page from other page, start battery tip update process 3. In RestrictAppTip, if there aren't restricted apps anymore, hide the tip. Bug: 74467010 Test: RunSettingsRobotests Change-Id: I300bcc5b487d587f6618e340ac074fe416dcc1b2
This commit is contained in:
@@ -17,8 +17,8 @@
|
||||
package com.android.settings.fuelgauge.batterytip;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.support.v14.preference.PreferenceFragment;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceGroup;
|
||||
import android.support.v7.preference.PreferenceScreen;
|
||||
@@ -34,6 +34,7 @@ import com.android.settings.fuelgauge.batterytip.tips.SummaryTip;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.core.instrumentation.MetricsFeatureProvider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -44,6 +45,7 @@ import java.util.Map;
|
||||
public class BatteryTipPreferenceController extends BasePreferenceController {
|
||||
private static final String TAG = "BatteryTipPreferenceController";
|
||||
private static final int REQUEST_ANOMALY_ACTION = 0;
|
||||
private static final String KEY_BATTERY_TIPS = "key_battery_tips";
|
||||
|
||||
private BatteryTipListener mBatteryTipListener;
|
||||
private List<BatteryTip> mBatteryTips;
|
||||
@@ -138,6 +140,17 @@ public class BatteryTipPreferenceController extends BasePreferenceController {
|
||||
return super.handlePreferenceTreeClick(preference);
|
||||
}
|
||||
|
||||
public void restoreInstanceState(Bundle bundle) {
|
||||
if (bundle != null) {
|
||||
List<BatteryTip> batteryTips = bundle.getParcelableArrayList(KEY_BATTERY_TIPS);
|
||||
updateBatteryTips(batteryTips);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveInstanceState(Bundle outState) {
|
||||
outState.putParcelableList(KEY_BATTERY_TIPS, mBatteryTips);
|
||||
}
|
||||
|
||||
/**
|
||||
* Listener to give the control back to target fragment
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user