remove old anomaly code

This is dead code that should no longer be around. Note: we can't
remove the metrics constant from the proto because then someone
might try reusing it.

Test: Robotests Pass
Bug: 65599785
Change-Id: Idda679eeca739e34c2371b7aafec23a3339b7f1a
This commit is contained in:
Salvador Martinez
2017-09-13 12:36:33 -07:00
parent e4cab00ffa
commit 42f7dcc0fb
2 changed files with 2 additions and 52 deletions

View File

@@ -110,10 +110,8 @@ public class PowerUsageSummary extends PowerUsageBase implements
@VisibleForTesting
static final int MENU_HIGH_POWER_APPS = Menu.FIRST + 3;
@VisibleForTesting
static final int MENU_ADDITIONAL_BATTERY_INFO = Menu.FIRST + 4;
@VisibleForTesting
static final int MENU_TOGGLE_APPS = Menu.FIRST + 5;
private static final int MENU_HELP = Menu.FIRST + 6;
static final int MENU_TOGGLE_APPS = Menu.FIRST + 4;
private static final int MENU_HELP = Menu.FIRST + 5;
public static final int DEBUG_INFO_LOADER = 3;
@VisibleForTesting
@@ -329,10 +327,6 @@ public class PowerUsageSummary extends PowerUsageBase implements
menu.add(Menu.NONE, MENU_HIGH_POWER_APPS, Menu.NONE, R.string.high_power_apps);
if (mPowerFeatureProvider.isAdditionalBatteryInfoEnabled()) {
menu.add(Menu.NONE, MENU_ADDITIONAL_BATTERY_INFO,
Menu.NONE, R.string.additional_battery_info);
}
if (mPowerFeatureProvider.isPowerAccountingToggleEnabled()) {
menu.add(Menu.NONE, MENU_TOGGLE_APPS, Menu.NONE,
mShowAllApps ? R.string.hide_extra_apps : R.string.show_all_apps);
@@ -371,12 +365,6 @@ public class PowerUsageSummary extends PowerUsageBase implements
metricsFeatureProvider.action(context,
MetricsEvent.ACTION_SETTINGS_MENU_BATTERY_OPTIMIZATION);
return true;
case MENU_ADDITIONAL_BATTERY_INFO:
startActivity(mPowerFeatureProvider
.getAdditionalBatteryInfoIntent());
metricsFeatureProvider.action(context,
MetricsEvent.ACTION_SETTINGS_MENU_BATTERY_USAGE_ALERTS);
return true;
case MENU_TOGGLE_APPS:
mShowAllApps = !mShowAllApps;
item.setTitle(mShowAllApps ? R.string.hide_extra_apps : R.string.show_all_apps);

View File

@@ -15,7 +15,6 @@
*/
package com.android.settings.fuelgauge;
import static com.android.settings.fuelgauge.PowerUsageSummary.MENU_ADDITIONAL_BATTERY_INFO;
import static com.android.settings.fuelgauge.PowerUsageSummary.MENU_HIGH_POWER_APPS;
import static com.android.settings.fuelgauge.PowerUsageSummary.MENU_TOGGLE_APPS;
import static com.google.common.truth.Truth.assertThat;
@@ -186,8 +185,6 @@ public class PowerUsageSummaryTest {
doReturn(mock(LoaderManager.class)).when(mFragment).getLoaderManager();
when(mFragment.getActivity()).thenReturn(mSettingsActivity);
when(mAdditionalBatteryInfoMenu.getItemId())
.thenReturn(MENU_ADDITIONAL_BATTERY_INFO);
when(mToggleAppsMenu.getItemId()).thenReturn(MENU_TOGGLE_APPS);
when(mHighPowerMenu.getItemId()).thenReturn(MENU_HIGH_POWER_APPS);
when(mFeatureFactory.powerUsageFeatureProvider.getAdditionalBatteryInfoIntent())
@@ -226,33 +223,6 @@ public class PowerUsageSummaryTest {
mFragment.mAppListGroup = mAppListGroup;
}
@Test
public void testOptionsMenu_additionalBatteryInfoEnabled() {
when(mFeatureFactory.powerUsageFeatureProvider.isAdditionalBatteryInfoEnabled())
.thenReturn(true);
mFragment.onCreateOptionsMenu(mMenu, mMenuInflater);
verify(mMenu).add(Menu.NONE, MENU_ADDITIONAL_BATTERY_INFO,
Menu.NONE, R.string.additional_battery_info);
mFragment.onOptionsItemSelected(mAdditionalBatteryInfoMenu);
assertThat(mFragment.mStartActivityCalled).isTrue();
assertThat(mFragment.mStartActivityIntent).isEqualTo(ADDITIONAL_BATTERY_INFO_INTENT);
}
@Test
public void testOptionsMenu_additionalBatteryInfoDisabled() {
when(mFeatureFactory.powerUsageFeatureProvider.isAdditionalBatteryInfoEnabled())
.thenReturn(false);
mFragment.onCreateOptionsMenu(mMenu, mMenuInflater);
verify(mMenu, never()).add(Menu.NONE, MENU_ADDITIONAL_BATTERY_INFO,
Menu.NONE, R.string.additional_battery_info);
}
@Test
public void testOptionsMenu_menuHighPower_metricEventInvoked() {
mFragment.onOptionsItemSelected(mHighPowerMenu);
@@ -261,14 +231,6 @@ public class PowerUsageSummaryTest {
MetricsProto.MetricsEvent.ACTION_SETTINGS_MENU_BATTERY_OPTIMIZATION);
}
@Test
public void testOptionsMenu_menuAdditionalBattery_metricEventInvoked() {
mFragment.onOptionsItemSelected(mAdditionalBatteryInfoMenu);
verify(mFeatureFactory.metricsFeatureProvider).action(mContext,
MetricsProto.MetricsEvent.ACTION_SETTINGS_MENU_BATTERY_USAGE_ALERTS);
}
@Test
public void testOptionsMenu_menuAppToggle_metricEventInvoked() {
mFragment.onOptionsItemSelected(mToggleAppsMenu);