Add battery history details activity.
Adds a full-screen version of the battery history visualization, which you can get to by tapping on the battery history chart in the summary screen. Change-Id: Ibca5ef3d0883ff6ffa80b6ddca3c8ac838c85842
This commit is contained in:
@@ -90,6 +90,8 @@ public class PowerUsageSummary extends PreferenceActivity implements Runnable {
|
||||
protected void onCreate(Bundle icicle) {
|
||||
super.onCreate(icicle);
|
||||
|
||||
mStats = (BatteryStatsImpl)getLastNonConfigurationInstance();
|
||||
|
||||
addPreferencesFromResource(R.xml.power_usage_summary);
|
||||
mBatteryInfo = IBatteryStats.Stub.asInterface(
|
||||
ServiceManager.getService("batteryinfo"));
|
||||
@@ -97,6 +99,11 @@ public class PowerUsageSummary extends PreferenceActivity implements Runnable {
|
||||
mPowerProfile = new PowerProfile(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object onRetainNonConfigurationInstance() {
|
||||
return mStats;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
@@ -115,6 +122,15 @@ public class PowerUsageSummary extends PreferenceActivity implements Runnable {
|
||||
|
||||
@Override
|
||||
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
||||
if (preference instanceof BatteryHistoryPreference) {
|
||||
Parcel hist = Parcel.obtain();
|
||||
mStats.writeToParcelWithoutUids(hist, 0);
|
||||
byte[] histData = hist.marshall();
|
||||
Intent intent = new Intent(this, BatteryHistoryDetail.class);
|
||||
intent.putExtra(BatteryHistoryDetail.EXTRA_STATS, histData);
|
||||
startActivity(intent);
|
||||
return super.onPreferenceTreeClick(preferenceScreen, preference);
|
||||
}
|
||||
if (!(preference instanceof PowerGaugePreference)) {
|
||||
return false;
|
||||
}
|
||||
|
Reference in New Issue
Block a user