Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 812baf3e authored by Remi NGUYEN VAN's avatar Remi NGUYEN VAN
Browse files

Address comments on NetworkStack AIDL v6

Address issues found during AIDL review:
- Rename clientAddr to singleClientAddr
- Do not use a ParcelableBundle for notifyNetworkTested or
  notifyDataStallSuspected; instead use AIDL parcelables for stronger
  backwards compatibility guarantees.

As part of moving notifyNetworkTested to using a parcelable the test
result int is split into two: the actual evaluation result, and the
probesSucceeded int. It used to contain both as a bit mask, which does
not make sense if probesAttempted is in a separate int itself.

Test: atest NetworkMonitorTest ConnectivityServiceTest
ConnectivityServiceIntegrationTest, manual
Bug: 153500847

Merged-In: I4aac6ff7432472f8a9345fb5785c6314ec8946e4
Change-Id: I4aac6ff7432472f8a9345fb5785c6314ec8946e4
parent 90b9ebe5
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -34,11 +34,4 @@ public class ConstantsShim {
    // Constants defined in android.net.ConnectivityDiagnosticsManager.
    public static final int DETECTION_METHOD_DNS_EVENTS = 1;
    public static final int DETECTION_METHOD_TCP_METRICS = 2;
    public static final String KEY_DNS_CONSECUTIVE_TIMEOUTS = "dnsConsecutiveTimeouts";
    public static final String KEY_NETWORK_PROBES_ATTEMPTED_BITMASK = "networkProbesAttempted";
    public static final String KEY_NETWORK_PROBES_SUCCEEDED_BITMASK = "networkProbesSucceeded";
    public static final String KEY_NETWORK_VALIDATION_RESULT = "networkValidationResult";
    public static final String KEY_TCP_METRICS_COLLECTION_PERIOD_MILLIS =
            "tcpMetricsCollectionPeriodMillis";
    public static final String KEY_TCP_PACKET_FAIL_RATE = "tcpPacketFailRate";
}
+0 −12
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

package com.android.networkstack.apishim;

import static android.net.ConnectivityDiagnosticsManager.ConnectivityReport;
import static android.net.ConnectivityDiagnosticsManager.DataStallReport;

import androidx.annotation.VisibleForTesting;
@@ -38,15 +37,4 @@ public class ConstantsShim extends com.android.networkstack.apishim.api29.Consta
            DataStallReport.DETECTION_METHOD_DNS_EVENTS;
    public static final int DETECTION_METHOD_TCP_METRICS =
            DataStallReport.DETECTION_METHOD_TCP_METRICS;
    public static final String KEY_DNS_CONSECUTIVE_TIMEOUTS =
            DataStallReport.KEY_DNS_CONSECUTIVE_TIMEOUTS;
    public static final String KEY_NETWORK_PROBES_ATTEMPTED_BITMASK =
            ConnectivityReport.KEY_NETWORK_PROBES_ATTEMPTED_BITMASK;
    public static final String KEY_NETWORK_PROBES_SUCCEEDED_BITMASK =
            ConnectivityReport.KEY_NETWORK_PROBES_SUCCEEDED_BITMASK;
    public static final String KEY_NETWORK_VALIDATION_RESULT =
            ConnectivityReport.KEY_NETWORK_VALIDATION_RESULT;
    public static final String KEY_TCP_METRICS_COLLECTION_PERIOD_MILLIS =
            DataStallReport.KEY_TCP_METRICS_COLLECTION_PERIOD_MILLIS;
    public static final String KEY_TCP_PACKET_FAIL_RATE = DataStallReport.KEY_TCP_PACKET_FAIL_RATE;
}
+2 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ aidl_interface {
        "frameworks/base/wifi/aidl-export", // For wifi parcelables.
    ],
    srcs: [
        "src/android/net/DataStallReportParcelable.aidl",
        "src/android/net/DhcpResultsParcelable.aidl",
        "src/android/net/INetworkMonitor.aidl",
        "src/android/net/INetworkMonitorCallbacks.aidl",
@@ -68,6 +69,7 @@ aidl_interface {
        "src/android/net/Layer2InformationParcelable.aidl",
        "src/android/net/Layer2PacketParcelable.aidl",
        "src/android/net/NattKeepalivePacketDataParcelable.aidl",
        "src/android/net/NetworkTestResultParcelable.aidl",
        "src/android/net/PrivateDnsConfigParcel.aidl",
        "src/android/net/ProvisioningConfigurationParcelable.aidl",
        "src/android/net/ScanResultInfoParcelable.aidl",
+25 −0
Original line number Diff line number Diff line
///////////////////////////////////////////////////////////////////////////////
// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
///////////////////////////////////////////////////////////////////////////////

// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
// edit this file. It looks like you are doing that because you have modified
// an AIDL interface in a backward-incompatible way, e.g., deleting a function
// from an interface or a field from a parcelable and it broke the build. That
// breakage is intended.
//
// You must not make a backward incompatible changes to the AIDL files built
// with the aidl_interface module type with versions property set. The module
// type is used to build AIDL files in a way that they can be used across
// independently updatable components of the system. If a device is shipped
// with such a backward incompatible change, it has a high risk of breaking
// later when a module using the interface is updated, e.g., Mainline modules.

package android.net;
parcelable DataStallReportParcelable {
  long timestampMillis = 0;
  int detectionMethod = 1;
  int tcpPacketFailRate = 2;
  int tcpMetricsCollectionPeriodMillis = 3;
  int dnsConsecutiveTimeouts = 4;
}
+9 −9
Original line number Diff line number Diff line
@@ -18,13 +18,13 @@
package android.net;
/* @hide */
interface INetworkMonitorCallbacks {
  oneway void onNetworkMonitorCreated(in android.net.INetworkMonitor networkMonitor);
  oneway void notifyNetworkTested(int testResult, @nullable String redirectUrl);
  oneway void notifyPrivateDnsConfigResolved(in android.net.PrivateDnsConfigParcel config);
  oneway void showProvisioningNotification(String action, String packageName);
  oneway void hideProvisioningNotification();
  oneway void notifyProbeStatusChanged(int probesCompleted, int probesSucceeded);
  oneway void notifyNetworkTestedWithExtras(int testResult, @nullable String redirectUrl, long timestampMillis, in android.os.PersistableBundle extras);
  oneway void notifyDataStallSuspected(long timestampMillis, int detectionMethod, in android.os.PersistableBundle extras);
  oneway void notifyCaptivePortalDataChanged(in android.net.CaptivePortalData data);
  oneway void onNetworkMonitorCreated(in android.net.INetworkMonitor networkMonitor) = 0;
  oneway void notifyNetworkTested(int testResult, @nullable String redirectUrl) = 1;
  oneway void notifyPrivateDnsConfigResolved(in android.net.PrivateDnsConfigParcel config) = 2;
  oneway void showProvisioningNotification(String action, String packageName) = 3;
  oneway void hideProvisioningNotification() = 4;
  oneway void notifyProbeStatusChanged(int probesCompleted, int probesSucceeded) = 5;
  oneway void notifyNetworkTestedWithExtras(in android.net.NetworkTestResultParcelable result) = 6;
  oneway void notifyDataStallSuspected(in android.net.DataStallReportParcelable report) = 7;
  oneway void notifyCaptivePortalDataChanged(in android.net.CaptivePortalData data) = 8;
}
Loading