Merge "Fix NullPointerException when full charge unplug a device with work profile" into main
This commit is contained in:
@@ -30,6 +30,7 @@ import android.os.BatteryManager;
|
||||
import android.os.SystemClock;
|
||||
import android.text.format.DateUtils;
|
||||
|
||||
import com.android.settings.testutils.BatteryTestUtils;
|
||||
import com.android.settings.testutils.FakeFeatureFactory;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -67,6 +68,16 @@ public final class BatteryUsageBroadcastReceiverTest {
|
||||
assertThat(mBatteryUsageBroadcastReceiver.mFetchBatteryUsageData).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onReceive_workProfile_doNothing() {
|
||||
BatteryTestUtils.setWorkProfile(mContext);
|
||||
|
||||
mBatteryUsageBroadcastReceiver.onReceive(mContext,
|
||||
new Intent(BatteryUsageBroadcastReceiver.ACTION_BATTERY_UNPLUGGING));
|
||||
|
||||
assertThat(mBatteryUsageBroadcastReceiver.mFetchBatteryUsageData).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onReceive_aospNotFullCharged_notFetchUsageData() {
|
||||
when(mFakeFeatureFactory.powerUsageFeatureProvider.getFullChargeIntentAction())
|
||||
|
Reference in New Issue
Block a user