[CS05]Remove the hidden API usage of MetricsLogger

Legacy metrics are unused and deprecated, so they are being removed.
Therefore, delete the usage of the hidden MetricsLogger API.

Bug: 157966864
Test: atest CtsNetTestCases
      atest CaptivePortalTest
      atest ConnectivityServiceTest
Change-Id: I51241f5d50ec580015882c84dd917b015c700c7c
This commit is contained in:
lifr
2021-03-02 17:12:27 +08:00
committed by Frank Li
parent 93c4f353b9
commit a9f5551cf5
5 changed files with 9 additions and 24 deletions

View File

@@ -24,7 +24,6 @@ import android.os.RemoteException;
import androidx.test.filters.SmallTest;
import androidx.test.runner.AndroidJUnit4;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.testutils.DevSdkIgnoreRule;
import com.android.testutils.DevSdkIgnoreRule.IgnoreUpTo;
@@ -54,12 +53,6 @@ public class CaptivePortalTest {
public void appRequest(final int request) throws RemoteException {
mCode = request;
}
@Override
public void logEvent(int eventId, String packageName) throws RemoteException {
mCode = eventId;
mPackageName = packageName;
}
}
private interface TestFunctor {
@@ -98,12 +91,14 @@ public class CaptivePortalTest {
assertEquals(result.mCode, CaptivePortal.APP_REQUEST_REEVALUATION_REQUIRED);
}
/**
* Test testLogEvent is expected to do nothing but shouldn't crash, because the API logEvent
* has been deprecated.
*/
@Test
public void testLogEvent() {
final MyCaptivePortalImpl result = runCaptivePortalTest(c -> c.logEvent(
MetricsEvent.ACTION_CAPTIVE_PORTAL_LOGIN_ACTIVITY,
0,
TEST_PACKAGE_NAME));
assertEquals(result.mCode, MetricsEvent.ACTION_CAPTIVE_PORTAL_LOGIN_ACTIVITY);
assertEquals(result.mPackageName, TEST_PACKAGE_NAME);
}
}