Remove the battery optimization menu
Change-Id: I129f2c39dba506dabef2cf543e71f70cfd1e7fdf Fixes: 73189468 Test: Test still pass
This commit is contained in:
@@ -86,9 +86,6 @@ public class PowerUsageSummary extends PowerUsageBase implements OnLongClickList
|
|||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static final int BATTERY_TIP_LOADER = 2;
|
static final int BATTERY_TIP_LOADER = 2;
|
||||||
private static final int MENU_STATS_TYPE = Menu.FIRST;
|
private static final int MENU_STATS_TYPE = Menu.FIRST;
|
||||||
@VisibleForTesting
|
|
||||||
static final int MENU_HIGH_POWER_APPS = Menu.FIRST + 3;
|
|
||||||
private static final int MENU_HELP = Menu.FIRST + 5;
|
|
||||||
public static final int DEBUG_INFO_LOADER = 3;
|
public static final int DEBUG_INFO_LOADER = 3;
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
@@ -257,8 +254,6 @@ public class PowerUsageSummary extends PowerUsageBase implements OnLongClickList
|
|||||||
.setAlphabeticShortcut('t');
|
.setAlphabeticShortcut('t');
|
||||||
}
|
}
|
||||||
|
|
||||||
menu.add(Menu.NONE, MENU_HIGH_POWER_APPS, Menu.NONE, R.string.high_power_apps);
|
|
||||||
|
|
||||||
super.onCreateOptionsMenu(menu, inflater);
|
super.onCreateOptionsMenu(menu, inflater);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,15 +278,6 @@ public class PowerUsageSummary extends PowerUsageBase implements OnLongClickList
|
|||||||
}
|
}
|
||||||
refreshUi();
|
refreshUi();
|
||||||
return true;
|
return true;
|
||||||
case MENU_HIGH_POWER_APPS:
|
|
||||||
Bundle args = new Bundle();
|
|
||||||
args.putString(ManageApplications.EXTRA_CLASSNAME,
|
|
||||||
HighPowerApplicationsActivity.class.getName());
|
|
||||||
sa.startPreferencePanel(this, ManageApplications.class.getName(), args,
|
|
||||||
R.string.high_power_apps, null, null, 0);
|
|
||||||
metricsFeatureProvider.action(context,
|
|
||||||
MetricsEvent.ACTION_SETTINGS_MENU_BATTERY_OPTIMIZATION);
|
|
||||||
return true;
|
|
||||||
default:
|
default:
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
@@ -15,8 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.android.settings.fuelgauge;
|
package com.android.settings.fuelgauge;
|
||||||
|
|
||||||
import static com.android.settings.fuelgauge.PowerUsageSummary.MENU_HIGH_POWER_APPS;
|
|
||||||
|
|
||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import static org.mockito.Matchers.any;
|
import static org.mockito.Matchers.any;
|
||||||
@@ -108,14 +106,6 @@ public class PowerUsageSummaryTest {
|
|||||||
|
|
||||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
|
|
||||||
private Menu mMenu;
|
|
||||||
@Mock
|
|
||||||
private MenuItem mToggleAppsMenu;
|
|
||||||
@Mock
|
|
||||||
private MenuItem mHighPowerMenu;
|
|
||||||
@Mock
|
|
||||||
private MenuInflater mMenuInflater;
|
|
||||||
@Mock
|
@Mock
|
||||||
private BatterySipper mNormalBatterySipper;
|
private BatterySipper mNormalBatterySipper;
|
||||||
@Mock
|
@Mock
|
||||||
@@ -169,7 +159,6 @@ public class PowerUsageSummaryTest {
|
|||||||
doReturn(mock(LoaderManager.class)).when(mFragment).getLoaderManager();
|
doReturn(mock(LoaderManager.class)).when(mFragment).getLoaderManager();
|
||||||
|
|
||||||
when(mFragment.getActivity()).thenReturn(mSettingsActivity);
|
when(mFragment.getActivity()).thenReturn(mSettingsActivity);
|
||||||
when(mHighPowerMenu.getItemId()).thenReturn(MENU_HIGH_POWER_APPS);
|
|
||||||
when(mFeatureFactory.powerUsageFeatureProvider.getAdditionalBatteryInfoIntent())
|
when(mFeatureFactory.powerUsageFeatureProvider.getAdditionalBatteryInfoIntent())
|
||||||
.thenReturn(sAdditionalBatteryInfoIntent);
|
.thenReturn(sAdditionalBatteryInfoIntent);
|
||||||
when(mBatteryHelper.getTotalPower()).thenReturn(TOTAL_POWER);
|
when(mBatteryHelper.getTotalPower()).thenReturn(TOTAL_POWER);
|
||||||
@@ -204,14 +193,6 @@ public class PowerUsageSummaryTest {
|
|||||||
mFragment.mBatteryUtils = spy(new BatteryUtils(mRealContext));
|
mFragment.mBatteryUtils = spy(new BatteryUtils(mRealContext));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testOptionsMenu_menuHighPower_metricEventInvoked() {
|
|
||||||
mFragment.onOptionsItemSelected(mHighPowerMenu);
|
|
||||||
|
|
||||||
verify(mFeatureFactory.metricsFeatureProvider).action(mContext,
|
|
||||||
MetricsProto.MetricsEvent.ACTION_SETTINGS_MENU_BATTERY_OPTIMIZATION);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUpdateLastFullChargePreference_showCorrectSummary() {
|
public void testUpdateLastFullChargePreference_showCorrectSummary() {
|
||||||
doReturn(mRealContext).when(mFragment).getContext();
|
doReturn(mRealContext).when(mFragment).getContext();
|
||||||
|
Reference in New Issue
Block a user