Merge "[MS49] Remove NetworkStats hidden Api usages"

This commit is contained in:
Junyu Lai
2022-01-28 00:42:44 +00:00
committed by Android (Google) Code Review
12 changed files with 40 additions and 32 deletions

View File

@@ -18,7 +18,7 @@ package com.android.settings.datausage;
import static com.google.common.truth.Truth.assertThat;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
@@ -438,7 +438,7 @@ public class AppDataUsageTest {
assertThat(mFragment.mTemplate.getMatchRule())
.isEqualTo(NetworkTemplate.MATCH_WIFI);
assertNull(mFragment.mTemplate.getSubscriberId());
assertTrue(mFragment.mTemplate.getSubscriberIds().isEmpty());
assertThat(mFragment.mTemplate.getNetworkId())
.isEqualTo(NetworkTemplate.WIFI_NETWORKID_ALL);
}

View File

@@ -26,10 +26,10 @@ import static org.mockito.Mockito.spy;
import android.app.usage.NetworkStatsManager;
import android.content.Context;
import android.content.Intent;
import android.net.TrafficStats;
import android.provider.Settings;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.util.DataUnit;
import androidx.preference.SwitchPreference;
@@ -128,7 +128,7 @@ public class DataUsagePreferenceControllerTest {
public void updateState_shouldUseIECUnit() {
final DataUsageController.DataUsageInfo usageInfo =
new DataUsageController.DataUsageInfo();
usageInfo.usageLevel = TrafficStats.MB_IN_BYTES;
usageInfo.usageLevel = DataUnit.MEBIBYTES.toBytes(1);
doReturn(usageInfo).when(mController).getDataUsageInfo(any());
mController.updateState(mPreference);