Adds a menu item for additional battery info to battery settings.
Bug: 33352540 Test: No additional test failures. Change-Id: Ibfc1a9463c93d3c087ed712fe45d3d0717472c6a
This commit is contained in:
@@ -26,6 +26,7 @@ import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.os.Process;
|
||||
import android.os.UserHandle;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.support.v7.preference.Preference;
|
||||
import android.support.v7.preference.PreferenceGroup;
|
||||
import android.text.TextUtils;
|
||||
@@ -43,6 +44,7 @@ import com.android.settings.Settings.HighPowerApplicationsActivity;
|
||||
import com.android.settings.SettingsActivity;
|
||||
import com.android.settings.applications.ManageApplications;
|
||||
import com.android.settings.dashboard.SummaryLoader;
|
||||
import com.android.settings.overlay.FeatureFactory;
|
||||
import com.android.settingslib.BatteryInfo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -67,7 +69,9 @@ public class PowerUsageSummary extends PowerUsageBase {
|
||||
|
||||
private static final int MENU_STATS_TYPE = Menu.FIRST;
|
||||
private static final int MENU_HIGH_POWER_APPS = Menu.FIRST + 3;
|
||||
private static final int MENU_HELP = Menu.FIRST + 4;
|
||||
@VisibleForTesting
|
||||
static final int MENU_ADDITIONAL_BATTERY_INFO = Menu.FIRST + 4;
|
||||
private static final int MENU_HELP = Menu.FIRST + 5;
|
||||
|
||||
private BatteryHistoryPreference mHistPref;
|
||||
private PreferenceGroup mAppListGroup;
|
||||
@@ -130,12 +134,20 @@ public class PowerUsageSummary extends PowerUsageBase {
|
||||
@Override
|
||||
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
|
||||
if (DEBUG) {
|
||||
menu.add(0, MENU_STATS_TYPE, 0, R.string.menu_stats_total)
|
||||
menu.add(Menu.NONE, MENU_STATS_TYPE, Menu.NONE, R.string.menu_stats_total)
|
||||
.setIcon(com.android.internal.R.drawable.ic_menu_info_details)
|
||||
.setAlphabeticShortcut('t');
|
||||
}
|
||||
|
||||
menu.add(0, MENU_HIGH_POWER_APPS, 0, R.string.high_power_apps);
|
||||
menu.add(Menu.NONE, MENU_HIGH_POWER_APPS, Menu.NONE, R.string.high_power_apps);
|
||||
|
||||
PowerUsageFeatureProvider powerUsageFeatureProvider =
|
||||
FeatureFactory.getFactory(getContext()).getPowerUsageFeatureProvider(getContext());
|
||||
if (powerUsageFeatureProvider != null &&
|
||||
powerUsageFeatureProvider.isAdditionalBatteryInfoEnabled()) {
|
||||
menu.add(Menu.NONE, MENU_ADDITIONAL_BATTERY_INFO,
|
||||
Menu.NONE, R.string.additional_battery_info);
|
||||
}
|
||||
super.onCreateOptionsMenu(menu, inflater);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user