diff --git a/res/values/strings.xml b/res/values/strings.xml index 8c7b6f4789f..e1ecdce638b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -4773,6 +4773,10 @@ Low battery capacity Battery can\'t provide good battery life + + Turn on smart battery manager + + Turn on to optimize battery usage Phone used heavily diff --git a/src/com/android/settings/fuelgauge/PowerUsageSummary.java b/src/com/android/settings/fuelgauge/PowerUsageSummary.java index 205ac0b15a8..ec54291e3ed 100644 --- a/src/com/android/settings/fuelgauge/PowerUsageSummary.java +++ b/src/com/android/settings/fuelgauge/PowerUsageSummary.java @@ -266,7 +266,7 @@ public class PowerUsageSummary extends PowerUsageBase implements OnLongClickList KEY_APP_LIST, lifecycle, activity, this); controllers.add(mBatteryAppListPreferenceController); mBatteryTipPreferenceController = new BatteryTipPreferenceController(context, - KEY_BATTERY_TIP, this, this); + KEY_BATTERY_TIP, (SettingsActivity) getActivity(), this, this); controllers.add(mBatteryTipPreferenceController); controllers.add(new BatterySaverController(context, getLifecycle())); controllers.add(new BatteryPercentagePreferenceController(context)); diff --git a/src/com/android/settings/fuelgauge/batterytip/BatteryTipDialogFragment.java b/src/com/android/settings/fuelgauge/batterytip/BatteryTipDialogFragment.java index 3e091b3b44c..942c42b43a7 100644 --- a/src/com/android/settings/fuelgauge/batterytip/BatteryTipDialogFragment.java +++ b/src/com/android/settings/fuelgauge/batterytip/BatteryTipDialogFragment.java @@ -27,8 +27,10 @@ import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import com.android.settings.R; +import com.android.settings.SettingsActivity; import com.android.settings.core.instrumentation.InstrumentedDialogFragment; import com.android.settings.fuelgauge.batterytip.BatteryTipPreferenceController.BatteryTipListener; +import com.android.settings.fuelgauge.batterytip.actions.BatteryTipAction; import com.android.settings.fuelgauge.batterytip.tips.BatteryTip; import com.android.settings.fuelgauge.batterytip.tips.HighUsageTip; @@ -97,7 +99,11 @@ public class BatteryTipDialogFragment extends InstrumentedDialogFragment impleme if (lsn == null) { return; } - mBatteryTip.action(); + final BatteryTipAction action = BatteryTipUtils.getActionForBatteryTip(mBatteryTip, + (SettingsActivity) getActivity(), this); + if (action != null) { + action.handlePositiveAction(); + } lsn.onBatteryTipHandled(mBatteryTip); } diff --git a/src/com/android/settings/fuelgauge/batterytip/BatteryTipLoader.java b/src/com/android/settings/fuelgauge/batterytip/BatteryTipLoader.java index a1db57a409a..fc6aa57d6ef 100644 --- a/src/com/android/settings/fuelgauge/batterytip/BatteryTipLoader.java +++ b/src/com/android/settings/fuelgauge/batterytip/BatteryTipLoader.java @@ -25,6 +25,7 @@ import com.android.settings.fuelgauge.BatteryUtils; import com.android.settings.fuelgauge.batterytip.detectors.BatteryTipDetector; import com.android.settings.fuelgauge.batterytip.detectors.HighUsageDetector; import com.android.settings.fuelgauge.batterytip.detectors.LowBatteryDetector; +import com.android.settings.fuelgauge.batterytip.detectors.SmartBatteryDetector; import com.android.settings.fuelgauge.batterytip.detectors.SummaryDetector; import com.android.settings.fuelgauge.batterytip.tips.BatteryTip; import com.android.settings.fuelgauge.batterytip.tips.LowBatteryTip; @@ -68,6 +69,8 @@ public class BatteryTipLoader extends AsyncLoader> { addBatteryTipFromDetector(tips, new LowBatteryDetector(policy, batteryInfo)); addBatteryTipFromDetector(tips, new HighUsageDetector(getContext(), policy, mBatteryStatsHelper)); + addBatteryTipFromDetector(tips, + new SmartBatteryDetector(policy, getContext().getContentResolver())); // Add summary detector at last since it need other detectors to update the mVisibleTips addBatteryTipFromDetector(tips, new SummaryDetector(policy, mVisibleTips)); diff --git a/src/com/android/settings/fuelgauge/batterytip/BatteryTipPreferenceController.java b/src/com/android/settings/fuelgauge/batterytip/BatteryTipPreferenceController.java index 9aa70c55264..9f5209fdd69 100644 --- a/src/com/android/settings/fuelgauge/batterytip/BatteryTipPreferenceController.java +++ b/src/com/android/settings/fuelgauge/batterytip/BatteryTipPreferenceController.java @@ -23,7 +23,9 @@ import android.support.v7.preference.Preference; import android.support.v7.preference.PreferenceGroup; import android.support.v7.preference.PreferenceScreen; +import com.android.settings.SettingsActivity; import com.android.settings.core.BasePreferenceController; +import com.android.settings.fuelgauge.batterytip.actions.BatteryTipAction; import com.android.settings.fuelgauge.batterytip.tips.BatteryTip; import com.android.settings.fuelgauge.batterytip.tips.SummaryTip; @@ -41,6 +43,7 @@ public class BatteryTipPreferenceController extends BasePreferenceController { private BatteryTipListener mBatteryTipListener; private List mBatteryTips; private Map mBatteryTipMap; + private SettingsActivity mSettingsActivity; @VisibleForTesting PreferenceGroup mPreferenceGroup; @VisibleForTesting @@ -48,15 +51,17 @@ public class BatteryTipPreferenceController extends BasePreferenceController { PreferenceFragment mFragment; public BatteryTipPreferenceController(Context context, String preferenceKey) { - this(context, preferenceKey, null, null); + this(context, preferenceKey, null, null, null); } public BatteryTipPreferenceController(Context context, String preferenceKey, - PreferenceFragment fragment, BatteryTipListener batteryTipListener) { + SettingsActivity settingsActivity, PreferenceFragment fragment, + BatteryTipListener batteryTipListener) { super(context, preferenceKey); mBatteryTipListener = batteryTipListener; mBatteryTipMap = new HashMap<>(); mFragment = fragment; + mSettingsActivity = settingsActivity; } @Override @@ -107,7 +112,11 @@ public class BatteryTipPreferenceController extends BasePreferenceController { dialogFragment.setTargetFragment(mFragment, REQUEST_ANOMALY_ACTION); dialogFragment.show(mFragment.getFragmentManager(), TAG); } else { - batteryTip.action(); + final BatteryTipAction action = BatteryTipUtils.getActionForBatteryTip(batteryTip, + mSettingsActivity, mFragment); + if (action != null) { + action.handlePositiveAction(); + } if (mBatteryTipListener != null) { mBatteryTipListener.onBatteryTipHandled(batteryTip); } diff --git a/src/com/android/settings/fuelgauge/batterytip/BatteryTipUtils.java b/src/com/android/settings/fuelgauge/batterytip/BatteryTipUtils.java new file mode 100644 index 00000000000..d10fa371529 --- /dev/null +++ b/src/com/android/settings/fuelgauge/batterytip/BatteryTipUtils.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settings.fuelgauge.batterytip; + +import android.app.Fragment; + +import com.android.settings.SettingsActivity; +import com.android.settings.fuelgauge.batterytip.actions.BatteryTipAction; +import com.android.settings.fuelgauge.batterytip.actions.SmartBatteryAction; +import com.android.settings.fuelgauge.batterytip.tips.BatteryTip; + +/** + * Utility class for {@link BatteryTip} + */ +public class BatteryTipUtils { + + /** + * Get a corresponding action based on {@code batteryTip} + * @param batteryTip used to detect which action to choose + * @param settingsActivity used to populate {@link BatteryTipAction} + * @param fragment used to populate {@link BatteryTipAction} + * @return an action for {@code batteryTip} + */ + public static BatteryTipAction getActionForBatteryTip(BatteryTip batteryTip, + SettingsActivity settingsActivity, Fragment fragment) { + switch (batteryTip.getType()) { + case BatteryTip.TipType.SMART_BATTERY_MANAGER: + return new SmartBatteryAction(settingsActivity, fragment); + default: + return null; + } + } +} diff --git a/src/com/android/settings/fuelgauge/batterytip/actions/BatteryTipAction.java b/src/com/android/settings/fuelgauge/batterytip/actions/BatteryTipAction.java new file mode 100644 index 00000000000..9fa69fd02c0 --- /dev/null +++ b/src/com/android/settings/fuelgauge/batterytip/actions/BatteryTipAction.java @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settings.fuelgauge.batterytip.actions; + +import android.content.Context; + +import com.android.settings.core.instrumentation.MetricsFeatureProvider; + +/** + * Abstract class for battery tip action, which is triggered if we need to handle the battery tip + */ +public abstract class BatteryTipAction { + protected Context mContext; + + public BatteryTipAction(Context context) { + mContext = context; + } + + /** + * Handle the action when user clicks positive button + */ + public abstract void handlePositiveAction(); +} diff --git a/src/com/android/settings/fuelgauge/batterytip/actions/SmartBatteryAction.java b/src/com/android/settings/fuelgauge/batterytip/actions/SmartBatteryAction.java new file mode 100644 index 00000000000..a19471e6d7b --- /dev/null +++ b/src/com/android/settings/fuelgauge/batterytip/actions/SmartBatteryAction.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settings.fuelgauge.batterytip.actions; + +import android.app.Fragment; +import android.os.UserHandle; +import android.support.v14.preference.PreferenceFragment; + +import com.android.settings.R; +import com.android.settings.SettingsActivity; +import com.android.settings.core.instrumentation.MetricsFeatureProvider; +import com.android.settings.fuelgauge.SmartBatterySettings; + +public class SmartBatteryAction extends BatteryTipAction { + private SettingsActivity mSettingsActivity; + private Fragment mFragment; + + public SmartBatteryAction(SettingsActivity settingsActivity, Fragment fragment) { + super(settingsActivity.getApplicationContext()); + mSettingsActivity = settingsActivity; + mFragment = fragment; + } + + /** + * Handle the action when user clicks positive button + */ + @Override + public void handlePositiveAction() { + mSettingsActivity.startPreferencePanelAsUser(mFragment, + SmartBatterySettings.class.getName(), null /* args */, + R.string.smart_battery_manager_title, null /* titleText */, + new UserHandle(UserHandle.myUserId())); + } +} diff --git a/src/com/android/settings/fuelgauge/batterytip/detectors/SmartBatteryDetector.java b/src/com/android/settings/fuelgauge/batterytip/detectors/SmartBatteryDetector.java new file mode 100644 index 00000000000..bff324d3633 --- /dev/null +++ b/src/com/android/settings/fuelgauge/batterytip/detectors/SmartBatteryDetector.java @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settings.fuelgauge.batterytip.detectors; + +import android.content.ContentResolver; +import android.provider.Settings; + +import com.android.settings.fuelgauge.batterytip.BatteryTipPolicy; +import com.android.settings.fuelgauge.batterytip.tips.BatteryTip; +import com.android.settings.fuelgauge.batterytip.tips.SmartBatteryTip; + +/** + * Detect whether to show smart battery tip. + */ +public class SmartBatteryDetector implements BatteryTipDetector { + private BatteryTipPolicy mPolicy; + private ContentResolver mContentResolver; + + public SmartBatteryDetector(BatteryTipPolicy policy, ContentResolver contentResolver) { + mPolicy = policy; + mContentResolver = contentResolver; + } + + @Override + public BatteryTip detect() { + // Show it if there is no other tips shown + final boolean smartBatteryOn = Settings.Global.getInt(mContentResolver, + Settings.Global.APP_STANDBY_ENABLED, 1) != 0; + final int state = + smartBatteryOn ? BatteryTip.StateType.INVISIBLE : BatteryTip.StateType.NEW; + return new SmartBatteryTip(state); + } +} diff --git a/src/com/android/settings/fuelgauge/batterytip/tips/BatteryTip.java b/src/com/android/settings/fuelgauge/batterytip/tips/BatteryTip.java index eadd0e1a811..292849d0210 100644 --- a/src/com/android/settings/fuelgauge/batterytip/tips/BatteryTip.java +++ b/src/com/android/settings/fuelgauge/batterytip/tips/BatteryTip.java @@ -105,11 +105,6 @@ public abstract class BatteryTip implements Comparable, Parcelable { */ public abstract void updateState(BatteryTip tip); - /** - * Execute the action for this {@link BatteryTip} - */ - public abstract void action(); - public Preference buildPreference(Context context) { Preference preference = new Preference(context); diff --git a/src/com/android/settings/fuelgauge/batterytip/tips/HighUsageTip.java b/src/com/android/settings/fuelgauge/batterytip/tips/HighUsageTip.java index 001a48eedc3..0316832f8d6 100644 --- a/src/com/android/settings/fuelgauge/batterytip/tips/HighUsageTip.java +++ b/src/com/android/settings/fuelgauge/batterytip/tips/HighUsageTip.java @@ -78,11 +78,6 @@ public class HighUsageTip extends BatteryTip { mState = tip.mState; } - @Override - public void action() { - // do nothing - } - public long getScreenTimeMs() { return mScreenTimeMs; } diff --git a/src/com/android/settings/fuelgauge/batterytip/tips/LowBatteryTip.java b/src/com/android/settings/fuelgauge/batterytip/tips/LowBatteryTip.java index 4a207e0b126..32cbe0242b1 100644 --- a/src/com/android/settings/fuelgauge/batterytip/tips/LowBatteryTip.java +++ b/src/com/android/settings/fuelgauge/batterytip/tips/LowBatteryTip.java @@ -55,11 +55,6 @@ public class LowBatteryTip extends BatteryTip { mState = tip.mState; } - @Override - public void action() { - // do nothing - } - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { public BatteryTip createFromParcel(Parcel in) { return new LowBatteryTip(in); diff --git a/src/com/android/settings/fuelgauge/batterytip/tips/SmartBatteryTip.java b/src/com/android/settings/fuelgauge/batterytip/tips/SmartBatteryTip.java new file mode 100644 index 00000000000..7b408bb5e96 --- /dev/null +++ b/src/com/android/settings/fuelgauge/batterytip/tips/SmartBatteryTip.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settings.fuelgauge.batterytip.tips; + +import android.content.Context; +import android.os.Parcel; +import android.provider.Settings; + +import com.android.settings.R; + +/** + * Tip to suggest turn on smart battery if it is not on + */ +public class SmartBatteryTip extends BatteryTip { + + public SmartBatteryTip(@StateType int state) { + super(TipType.SMART_BATTERY_MANAGER, state, false /* showDialog */); + } + + private SmartBatteryTip(Parcel in) { + super(in); + } + + @Override + public CharSequence getTitle(Context context) { + return context.getString(R.string.battery_tip_smart_battery_title); + } + + @Override + public CharSequence getSummary(Context context) { + return context.getString(R.string.battery_tip_smart_battery_summary); + } + + @Override + public int getIconId() { + return R.drawable.ic_perm_device_information_red_24dp; + } + + @Override + public void updateState(BatteryTip tip) { + mState = tip.mState; + } + + public static final Creator CREATOR = new Creator() { + public BatteryTip createFromParcel(Parcel in) { + return new SmartBatteryTip(in); + } + + public BatteryTip[] newArray(int size) { + return new SmartBatteryTip[size]; + } + }; + +} diff --git a/src/com/android/settings/fuelgauge/batterytip/tips/SummaryTip.java b/src/com/android/settings/fuelgauge/batterytip/tips/SummaryTip.java index 51019a8d35d..458bd2e89eb 100644 --- a/src/com/android/settings/fuelgauge/batterytip/tips/SummaryTip.java +++ b/src/com/android/settings/fuelgauge/batterytip/tips/SummaryTip.java @@ -55,11 +55,6 @@ public class SummaryTip extends BatteryTip { mState = tip.mState; } - @Override - public void action() { - // do nothing - } - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { public BatteryTip createFromParcel(Parcel in) { return new SummaryTip(in); diff --git a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/BatteryTipPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/BatteryTipPreferenceControllerTest.java index 9f0c61fc9c8..b4149c11e07 100644 --- a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/BatteryTipPreferenceControllerTest.java +++ b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/BatteryTipPreferenceControllerTest.java @@ -15,6 +15,9 @@ */ package com.android.settings.fuelgauge.batterytip; +import static com.android.settings.fuelgauge.batterytip.tips.BatteryTip.TipType + .SMART_BATTERY_MANAGER; + import static com.google.common.truth.Truth.assertThat; import static org.mockito.Matchers.any; @@ -29,6 +32,7 @@ import android.support.v7.preference.PreferenceGroup; import android.support.v7.preference.PreferenceManager; import android.support.v7.preference.PreferenceScreen; +import com.android.settings.SettingsActivity; import com.android.settings.TestConfig; import com.android.settings.fuelgauge.batterytip.tips.BatteryTip; import com.android.settings.fuelgauge.batterytip.tips.SummaryTip; @@ -57,6 +61,8 @@ public class BatteryTipPreferenceControllerTest { private PreferenceScreen mPreferenceScreen; @Mock private BatteryTip mBatteryTip; + @Mock + private SettingsActivity mSettingsActivity; @Mock(answer = Answers.RETURNS_DEEP_STUBS) private PreferenceManager mPreferenceManager; @@ -85,7 +91,7 @@ public class BatteryTipPreferenceControllerTest { mNewBatteryTips.add(new SummaryTip(BatteryTip.StateType.INVISIBLE)); mBatteryTipPreferenceController = new BatteryTipPreferenceController(mContext, KEY_PREF, - null, mBatteryTipListener); + mSettingsActivity, null, mBatteryTipListener); mBatteryTipPreferenceController.mPreferenceGroup = mPreferenceGroup; mBatteryTipPreferenceController.mPrefContext = mContext; } @@ -109,7 +115,8 @@ public class BatteryTipPreferenceControllerTest { } @Test - public void testHandlePreferenceTreeClick_noDialog_invokeAction() { + public void testHandlePreferenceTreeClick_noDialog_invokeCallback() { + doReturn(SMART_BATTERY_MANAGER).when(mBatteryTip).getType(); List batteryTips = new ArrayList<>(); batteryTips.add(mBatteryTip); doReturn(mPreference).when(mBatteryTip).buildPreference(any()); @@ -119,7 +126,7 @@ public class BatteryTipPreferenceControllerTest { mBatteryTipPreferenceController.handlePreferenceTreeClick(mPreference); - verify(mBatteryTip).action(); + verify(mBatteryTipListener).onBatteryTipHandled(mBatteryTip); } private void assertOnlyContainsSummaryTip(final PreferenceGroup preferenceGroup) { diff --git a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/detectors/SmartBatteryDetectorTest.java b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/detectors/SmartBatteryDetectorTest.java new file mode 100644 index 00000000000..8400d892696 --- /dev/null +++ b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/detectors/SmartBatteryDetectorTest.java @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.settings.fuelgauge.batterytip.detectors; + +import static com.google.common.truth.Truth.assertThat; + +import static org.mockito.Mockito.spy; + +import android.content.Context; +import android.provider.Settings; + +import com.android.settings.TestConfig; +import com.android.settings.fuelgauge.batterytip.BatteryTipPolicy; +import com.android.settings.testutils.SettingsRobolectricTestRunner; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.MockitoAnnotations; +import org.robolectric.RuntimeEnvironment; +import org.robolectric.annotation.Config; + +@RunWith(SettingsRobolectricTestRunner.class) +@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION) +public class SmartBatteryDetectorTest { + private Context mContext; + private BatteryTipPolicy mPolicy; + private SmartBatteryDetector mSmartBatteryDetector; + + @Before + public void setUp() { + MockitoAnnotations.initMocks(this); + + mContext = RuntimeEnvironment.application; + mPolicy = spy(new BatteryTipPolicy(mContext)); + mSmartBatteryDetector = new SmartBatteryDetector(mPolicy, mContext.getContentResolver()); + } + + @Test + public void testDetect_smartBatteryOff_tipVisible() { + Settings.Global.putInt(mContext.getContentResolver(), + Settings.Global.APP_STANDBY_ENABLED, 0); + + assertThat(mSmartBatteryDetector.detect().isVisible()).isTrue(); + } + + @Test + public void testDetect_smartBatteryOn_tipInvisible() { + Settings.Global.putInt(mContext.getContentResolver(), + Settings.Global.APP_STANDBY_ENABLED, 1); + + assertThat(mSmartBatteryDetector.detect().isVisible()).isFalse(); + } +} diff --git a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/tips/BatteryTipTest.java b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/tips/BatteryTipTest.java index 1c6c8683c04..6efd5d305bd 100644 --- a/tests/robotests/src/com/android/settings/fuelgauge/batterytip/tips/BatteryTipTest.java +++ b/tests/robotests/src/com/android/settings/fuelgauge/batterytip/tips/BatteryTipTest.java @@ -107,11 +107,6 @@ public class BatteryTipTest { // do nothing } - @Override - public void action() { - // do nothing - } - public final Parcelable.Creator CREATOR = new Parcelable.Creator() { public BatteryTip createFromParcel(Parcel in) { return new TestBatteryTip(in);