Loading packages/Connectivity/framework/api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ package android.net { public class CaptivePortal implements android.os.Parcelable { method public void logEvent(int, @NonNull String); method @Deprecated public void logEvent(int, @NonNull String); method @RequiresPermission(android.Manifest.permission.NETWORK_STACK) public void reevaluateNetwork(); method public void useNetwork(); field public static final int APP_REQUEST_REEVALUATION_REQUIRED = 100; // 0x64 Loading packages/Connectivity/framework/src/android/net/CaptivePortal.java +3 −4 Original line number Diff line number Diff line Loading @@ -160,12 +160,11 @@ public class CaptivePortal implements Parcelable { * @param eventId one of the CAPTIVE_PORTAL_LOGIN_* constants in metrics_constants.proto. * @param packageName captive portal application package name. * @hide * @deprecated The event will not be logged in Android S and above. The * caller is migrating to statsd. */ @Deprecated @SystemApi public void logEvent(int eventId, @NonNull String packageName) { try { ICaptivePortal.Stub.asInterface(mBinder).logEvent(eventId, packageName); } catch (RemoteException e) { } } } packages/Connectivity/framework/src/android/net/ICaptivePortal.aidl +0 −1 Original line number Diff line number Diff line Loading @@ -23,5 +23,4 @@ package android.net; oneway interface ICaptivePortal { void appRequest(int request); void appResponse(int response); void logEvent(int eventId, String packageName); } services/core/java/com/android/server/ConnectivityService.java +0 −8 Original line number Diff line number Diff line Loading @@ -190,7 +190,6 @@ import com.android.internal.R; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.app.IBatteryStats; import com.android.internal.logging.MetricsLogger; import com.android.internal.util.AsyncChannel; import com.android.internal.util.BitUtils; import com.android.internal.util.IndentingPrintWriter; Loading Loading @@ -4143,13 +4142,6 @@ public class ConnectivityService extends IConnectivityManager.Stub // nai.networkMonitor() is thread-safe return nai.networkMonitor(); } @Override public void logEvent(int eventId, String packageName) { enforceSettingsPermission(); new MetricsLogger().action(eventId, packageName); } } public boolean avoidBadWifi() { Loading tests/net/common/java/android/net/CaptivePortalTest.java +5 −10 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 { Loading Loading @@ -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); } } Loading
packages/Connectivity/framework/api/system-current.txt +1 −1 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ package android.net { public class CaptivePortal implements android.os.Parcelable { method public void logEvent(int, @NonNull String); method @Deprecated public void logEvent(int, @NonNull String); method @RequiresPermission(android.Manifest.permission.NETWORK_STACK) public void reevaluateNetwork(); method public void useNetwork(); field public static final int APP_REQUEST_REEVALUATION_REQUIRED = 100; // 0x64 Loading
packages/Connectivity/framework/src/android/net/CaptivePortal.java +3 −4 Original line number Diff line number Diff line Loading @@ -160,12 +160,11 @@ public class CaptivePortal implements Parcelable { * @param eventId one of the CAPTIVE_PORTAL_LOGIN_* constants in metrics_constants.proto. * @param packageName captive portal application package name. * @hide * @deprecated The event will not be logged in Android S and above. The * caller is migrating to statsd. */ @Deprecated @SystemApi public void logEvent(int eventId, @NonNull String packageName) { try { ICaptivePortal.Stub.asInterface(mBinder).logEvent(eventId, packageName); } catch (RemoteException e) { } } }
packages/Connectivity/framework/src/android/net/ICaptivePortal.aidl +0 −1 Original line number Diff line number Diff line Loading @@ -23,5 +23,4 @@ package android.net; oneway interface ICaptivePortal { void appRequest(int request); void appResponse(int response); void logEvent(int eventId, String packageName); }
services/core/java/com/android/server/ConnectivityService.java +0 −8 Original line number Diff line number Diff line Loading @@ -190,7 +190,6 @@ import com.android.internal.R; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; import com.android.internal.app.IBatteryStats; import com.android.internal.logging.MetricsLogger; import com.android.internal.util.AsyncChannel; import com.android.internal.util.BitUtils; import com.android.internal.util.IndentingPrintWriter; Loading Loading @@ -4143,13 +4142,6 @@ public class ConnectivityService extends IConnectivityManager.Stub // nai.networkMonitor() is thread-safe return nai.networkMonitor(); } @Override public void logEvent(int eventId, String packageName) { enforceSettingsPermission(); new MetricsLogger().action(eventId, packageName); } } public boolean avoidBadWifi() { Loading
tests/net/common/java/android/net/CaptivePortalTest.java +5 −10 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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 { Loading Loading @@ -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); } }