summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.txt6
-rwxr-xr-xapi/system-current.txt2
-rw-r--r--api/test-current.txt3
-rw-r--r--cmds/statsd/src/atoms.proto170
-rw-r--r--core/java/android/net/ConnectivityDiagnosticsManager.java8
-rw-r--r--core/java/android/net/ConnectivityManager.java87
-rw-r--r--core/java/android/net/NetworkCapabilities.java27
-rw-r--r--core/java/android/telephony/PhoneStateListener.java4
-rw-r--r--core/java/com/android/server/SystemConfig.java4
-rw-r--r--core/proto/android/stats/connectivity/Android.bp6
-rw-r--r--core/proto/android/stats/connectivity/network_stack.proto154
-rw-r--r--core/tests/coretests/src/com/android/internal/os/KernelCpuUidBpfMapReaderTest.java15
-rw-r--r--data/etc/car/com.android.car.bugreport.xml2
-rw-r--r--data/keyboards/Vendor_0a5c_Product_8502.kl37
-rw-r--r--non-updatable-api/current.txt6
-rw-r--r--non-updatable-api/system-current.txt2
-rw-r--r--services/backup/OWNERS1
-rw-r--r--services/core/java/com/android/server/ConnectivityService.java8
-rw-r--r--services/core/java/com/android/server/TelephonyRegistry.java20
-rw-r--r--services/core/java/com/android/server/connectivity/Vpn.java3
-rw-r--r--telecomm/java/android/telecom/TelecomManager.java1
-rw-r--r--telephony/java/android/telephony/CarrierConfigManager.java16
-rw-r--r--telephony/java/android/telephony/CellSignalStrengthLte.java18
-rw-r--r--telephony/java/android/telephony/MbmsDownloadSession.java39
-rw-r--r--telephony/java/android/telephony/mbms/MbmsErrors.java8
-rwxr-xr-xtelephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl2
-rw-r--r--telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java19
-rw-r--r--test-runner/api/current.txt12
-rw-r--r--test-runner/src/android/test/LaunchPerformanceBase.java5
-rw-r--r--test-runner/src/android/test/suitebuilder/UnitTestSuiteBuilder.java3
-rw-r--r--test-runner/tests/Android.bp2
-rw-r--r--tests/net/java/com/android/server/ConnectivityServiceTest.java27
32 files changed, 630 insertions, 87 deletions
diff --git a/api/current.txt b/api/current.txt
index 51f7f58bb8fa..fea1f2f4cac4 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -45344,14 +45344,14 @@ package android.telephony {
public class MbmsDownloadSession implements java.lang.AutoCloseable {
method public void addProgressListener(@NonNull android.telephony.mbms.DownloadRequest, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.DownloadProgressListener);
- method public void addServiceAnnouncementFile(@NonNull byte[]);
+ method public void addServiceAnnouncement(@NonNull byte[]);
method public void addStatusListener(@NonNull android.telephony.mbms.DownloadRequest, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.DownloadStatusListener);
method public void cancelDownload(@NonNull android.telephony.mbms.DownloadRequest);
method public void close();
method public static android.telephony.MbmsDownloadSession create(@NonNull android.content.Context, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.MbmsDownloadSessionCallback);
method @Nullable public static android.telephony.MbmsDownloadSession create(@NonNull android.content.Context, @NonNull java.util.concurrent.Executor, int, @NonNull android.telephony.mbms.MbmsDownloadSessionCallback);
method public void download(@NonNull android.telephony.mbms.DownloadRequest);
- method public static int getMaximumServiceAnnouncementFileSize();
+ method public static int getMaximumServiceAnnouncementSize();
method @Nullable public java.io.File getTempFileRootDirectory();
method @NonNull public java.util.List<android.telephony.mbms.DownloadRequest> listPendingDownloads();
method public void removeProgressListener(@NonNull android.telephony.mbms.DownloadRequest, @NonNull android.telephony.mbms.DownloadProgressListener);
@@ -46958,7 +46958,7 @@ package android.telephony.mbms {
public static class MbmsErrors.DownloadErrors {
field public static final int ERROR_CANNOT_CHANGE_TEMP_FILE_ROOT = 401; // 0x191
- field public static final int ERROR_MALFORMED_SERVICE_ANNOUNCEMENT_FILE = 404; // 0x194
+ field public static final int ERROR_MALFORMED_SERVICE_ANNOUNCEMENT = 404; // 0x194
field public static final int ERROR_UNKNOWN_DOWNLOAD_REQUEST = 402; // 0x192
field public static final int ERROR_UNKNOWN_FILE_INFO = 403; // 0x193
}
diff --git a/api/system-current.txt b/api/system-current.txt
index 26153caebfce..a10880bee172 100755
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -10321,7 +10321,7 @@ package android.telephony.mbms.vendor {
public class MbmsDownloadServiceBase extends android.os.Binder implements android.os.IInterface {
ctor public MbmsDownloadServiceBase();
method public int addProgressListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadProgressListener) throws android.os.RemoteException;
- method public int addServiceAnnouncementFile(int, @NonNull byte[]);
+ method public int addServiceAnnouncement(int, @NonNull byte[]);
method public int addStatusListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStatusListener) throws android.os.RemoteException;
method public android.os.IBinder asBinder();
method public int cancelDownload(android.telephony.mbms.DownloadRequest) throws android.os.RemoteException;
diff --git a/api/test-current.txt b/api/test-current.txt
index 68c91058cabf..6fe730ae08bf 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -3101,6 +3101,7 @@ package android.telecom {
method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public int getCurrentTtyMode();
method @Nullable @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getDefaultDialerPackage(@NonNull android.os.UserHandle);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean isInEmergencyCall();
+ method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PHONE_STATE}) public boolean isRinging();
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setUserSelectedOutgoingPhoneAccount(@Nullable android.telecom.PhoneAccountHandle);
field public static final int TTY_MODE_FULL = 1; // 0x1
field public static final int TTY_MODE_HCO = 2; // 0x2
@@ -4099,7 +4100,7 @@ package android.telephony.mbms.vendor {
public class MbmsDownloadServiceBase extends android.os.Binder implements android.os.IInterface {
ctor public MbmsDownloadServiceBase();
method public int addProgressListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadProgressListener) throws android.os.RemoteException;
- method public int addServiceAnnouncementFile(int, @NonNull byte[]);
+ method public int addServiceAnnouncement(int, @NonNull byte[]);
method public int addStatusListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStatusListener) throws android.os.RemoteException;
method public android.os.IBinder asBinder();
method public int cancelDownload(android.telephony.mbms.DownloadRequest) throws android.os.RemoteException;
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index a2d9c77d202b..331182935a0c 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -360,6 +360,10 @@ message Atom {
BootTimeEventErrorCode boot_time_event_error_code_reported = 242;
UserspaceRebootReported userspace_reboot_reported = 243 [(log_from_module) = "framework"];
SnapshotMergeReported snapshot_merge_reported = 255;
+ NetworkIpProvisioningReported network_ip_provisioning_reported = 290 [(log_from_module) = "network_stack"];
+ NetworkDhcpRenewReported network_dhcp_renew_reported = 291 [(log_from_module) = "network_stack"];
+ NetworkValidationReported network_validation_reported = 292 [(log_from_module) = "network_stack"];
+ NetworkStackQuirkReported network_stack_quirk_reported = 293 [(log_from_module) = "network_stack"];
}
// Pulled events will start at field 10000.
@@ -5886,6 +5890,172 @@ message NetworkDnsEventReported {
}
/**
+ * logs the CapportApiData info
+ * Logged from:
+ * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
+ */
+message CapportApiData {
+ // The TTL of the network connection provided by captive portal
+ optional int32 remaining_ttl_secs = 1;
+
+ // The limit traffic data of the network connection provided by captive portal
+ optional int32 remaining_bytes = 2;
+
+ // Is portal url option included in the DHCP packet (Yes, No)
+ optional bool has_portal_url = 3;
+
+ // Is venue info (e.g. store info, maps, flight status) included (Yes, No)
+ optional bool has_venue_info = 4;
+}
+
+/**
+ * logs a network Probe Event
+ * Logged from:
+ * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
+ */
+message ProbeEvent {
+ // The probe type (http or https, or captive portal API...)
+ optional android.stats.connectivity.ProbeType probe_type = 1;
+
+ // The latency in microseconds of the probe event
+ optional int32 latency_micros = 2;
+
+ // The result of the probe event
+ optional android.stats.connectivity.ProbeResult probe_result = 3;
+
+ // The CaptivePortal API info
+ optional CapportApiData capport_api_data = 4;
+}
+
+/**
+ * log each ProbeEvent in ProbeEvents
+ * Logged from:
+ * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
+ */
+message ProbeEvents {
+ // Record probe event during the validation
+ repeated ProbeEvent probe_event = 1;
+}
+
+/**
+ * The DHCP (Dynamic Host Configuration Protocol) session info
+ * Logged from:
+ * packages/modules/NetworkStack/src/android/net/dhcp/DhcpClient.java
+ */
+message DhcpSession {
+ // The DHCP Feature(s) enabled in this session
+ repeated android.stats.connectivity.DhcpFeature used_features = 1;
+
+ // The discover packet (re)transmit count
+ optional int32 discover_count = 2;
+
+ // The request packet (re)transmit count
+ optional int32 request_count = 3;
+
+ // The IPv4 address conflict count
+ // (only be meaningful when duplicate address detection is enabled)
+ optional int32 conflict_count = 4;
+
+ // The DHCP packet parsing error code in this session
+ // (defined in android.net.metrics.DhcpErrorEvent)
+ repeated android.stats.connectivity.DhcpErrorCode error_code = 5;
+
+ // The result of DHCP hostname transliteration
+ optional android.stats.connectivity.HostnameTransResult ht_result = 6;
+}
+
+/**
+ * Logs Network IP provisioning event
+ * Logged from:
+ * packages/modules/NetworkStack/src/com/android/networkstack/metrics/NetworkIpProvisioningMetrics.java
+ */
+message NetworkIpProvisioningReported {
+ // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
+ optional android.stats.connectivity.TransportType transport_type = 1;
+
+ // The latency in microseconds of IP Provisioning over IPV4
+ optional int32 ipv4_latency_micros = 2;
+
+ // The latency in microseconds of IP Provisioning over IPV6
+ optional int32 ipv6_latency_micros = 3;
+
+ // The time duration between provisioning start and end (success or failure)
+ optional int64 provisioning_duration_micros = 4;
+
+ // The specific disconnect reason for this IP provisioning
+ optional android.stats.connectivity.DisconnectCode disconnect_code = 5;
+
+ // Log DHCP session info (Only valid for IPv4)
+ optional DhcpSession dhcp_session = 6 [(log_mode) = MODE_BYTES];
+
+ // The random number between 0 ~ 999 for sampling
+ optional int32 random_number = 7;
+}
+
+/**
+ * Logs Network DHCP Renew event
+ * Logged from:
+ * packages/modules/NetworkStack/src/android/net/dhcp/DhcpClient.java
+ */
+message NetworkDhcpRenewReported {
+ // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
+ optional android.stats.connectivity.TransportType transport_type = 1;
+
+ // The request packet (re)transmit count
+ optional int32 request_count = 2;
+
+ // The latency in microseconds of DHCP Renew
+ optional int32 latency_micros = 3;
+
+ // The DHCP error code is defined in android.net.metrics.DhcpErrorEvent
+ optional android.stats.connectivity.DhcpErrorCode error_code = 4;
+
+ // The result of DHCP renew
+ optional android.stats.connectivity.DhcpRenewResult renew_result = 5;
+
+ // The random number between 0 ~ 999 for sampling
+ optional int32 random_number = 6;
+}
+
+/**
+ * Logs Network Validation event
+ * Logged from:
+ * packages/modules/NetworkStack/src/com/android/server/connectivity/NetworkMonitor.java
+ */
+message NetworkValidationReported {
+ // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
+ optional android.stats.connectivity.TransportType transport_type = 1;
+
+ // Record each probe event
+ optional ProbeEvents probe_events = 2 [(log_mode) = MODE_BYTES];
+
+ // The result of the network validation
+ optional android.stats.connectivity.ValidationResult validation_result = 3;
+
+ // The latency in microseconds of network validation
+ optional int32 latency_micros = 4;
+
+ // The validation index (the first validation attempt or second, third...)
+ optional int32 validation_index = 5;
+
+ // The random number between 0 ~ 999 for sampling
+ optional int32 random_number = 6;
+}
+
+/**
+ * Logs NetworkStack Quirk event
+ * Logged from:
+ * packages/modules/NetworkStack/src/com/android/networkstack/
+ */
+message NetworkStackQuirkReported {
+ // Transport type (WIFI, CELLULAR, BLUETOOTH, ..)
+ optional android.stats.connectivity.TransportType transport_type = 1;
+
+ // Record each Quirk event
+ optional android.stats.connectivity.NetworkQuirkEvent event = 2;
+}
+
+/**
* Logs when a data stall event occurs.
*
* Log from:
diff --git a/core/java/android/net/ConnectivityDiagnosticsManager.java b/core/java/android/net/ConnectivityDiagnosticsManager.java
index 275e38c74451..704f31d7f773 100644
--- a/core/java/android/net/ConnectivityDiagnosticsManager.java
+++ b/core/java/android/net/ConnectivityDiagnosticsManager.java
@@ -711,6 +711,13 @@ public class ConnectivityDiagnosticsManager {
* not currently registered. If a ConnectivityDiagnosticsCallback instance is registered with
* multiple NetworkRequests, an IllegalArgumentException will be thrown.
*
+ * <p>To avoid performance issues due to apps leaking callbacks, the system will limit the
+ * number of outstanding requests to 100 per app (identified by their UID), shared with
+ * callbacks in {@link ConnectivityManager}. Registering a callback with this method will count
+ * toward this limit. If this limit is exceeded, an exception will be thrown. To avoid hitting
+ * this issue and to conserve resources, make sure to unregister the callbacks with
+ * {@link #unregisterConnectivityDiagnosticsCallback}.
+ *
* @param request The NetworkRequest that will be used to match with Networks for which
* callbacks will be fired
* @param e The Executor to be used for running the callback method invocations
@@ -718,6 +725,7 @@ public class ConnectivityDiagnosticsManager {
* System
* @throws IllegalArgumentException if the same callback instance is registered with multiple
* NetworkRequests
+ * @throws RuntimeException if the app already has too many callbacks registered.
*/
public void registerConnectivityDiagnosticsCallback(
@NonNull NetworkRequest request,
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index 4b2ef118eaa3..9c994eb7383a 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -3834,13 +3834,22 @@ public class ConnectivityManager {
* or the ability to modify system settings as determined by
* {@link android.provider.Settings.System#canWrite}.</p>
*
+ * <p>To avoid performance issues due to apps leaking callbacks, the system will limit the
+ * number of outstanding requests to 100 per app (identified by their UID), shared with
+ * all variants of this method, of {@link #registerNetworkCallback} as well as
+ * {@link ConnectivityDiagnosticsManager#registerConnectivityDiagnosticsCallback}.
+ * Requesting a network with this method will count toward this limit. If this limit is
+ * exceeded, an exception will be thrown. To avoid hitting this issue and to conserve resources,
+ * make sure to unregister the callbacks with
+ * {@link #unregisterNetworkCallback(NetworkCallback)}.
+ *
* @param request {@link NetworkRequest} describing this request.
* @param networkCallback The {@link NetworkCallback} to be utilized for this request. Note
* the callback must not be shared - it uniquely specifies this request.
* The callback is invoked on the default internal Handler.
* @throws IllegalArgumentException if {@code request} contains invalid network capabilities.
* @throws SecurityException if missing the appropriate permissions.
- * @throws RuntimeException if request limit per UID is exceeded.
+ * @throws RuntimeException if the app already has too many callbacks registered.
*/
public void requestNetwork(@NonNull NetworkRequest request,
@NonNull NetworkCallback networkCallback) {
@@ -3854,8 +3863,8 @@ public class ConnectivityManager {
* but runs all the callbacks on the passed Handler.
*
* <p>This method has the same permission requirements as
- * {@link #requestNetwork(NetworkRequest, NetworkCallback)} and throws the same exceptions in
- * the same conditions.
+ * {@link #requestNetwork(NetworkRequest, NetworkCallback)}, is subject to the same limitations,
+ * and throws the same exceptions in the same conditions.
*
* @param request {@link NetworkRequest} describing this request.
* @param networkCallback The {@link NetworkCallback} to be utilized for this request. Note
@@ -3886,8 +3895,8 @@ public class ConnectivityManager {
* for that purpose. Calling this method will attempt to bring up the requested network.
*
* <p>This method has the same permission requirements as
- * {@link #requestNetwork(NetworkRequest, NetworkCallback)} and throws the same exceptions in
- * the same conditions.
+ * {@link #requestNetwork(NetworkRequest, NetworkCallback)}, is subject to the same limitations,
+ * and throws the same exceptions in the same conditions.
*
* @param request {@link NetworkRequest} describing this request.
* @param networkCallback The {@link NetworkCallback} to be utilized for this request. Note
@@ -3913,8 +3922,8 @@ public class ConnectivityManager {
* on the passed Handler.
*
* <p>This method has the same permission requirements as
- * {@link #requestNetwork(NetworkRequest, NetworkCallback, int)} and throws the same exceptions
- * in the same conditions.
+ * {@link #requestNetwork(NetworkRequest, NetworkCallback)}, is subject to the same limitations,
+ * and throws the same exceptions in the same conditions.
*
* @param request {@link NetworkRequest} describing this request.
* @param networkCallback The {@link NetworkCallback} to be utilized for this request. Note
@@ -3983,6 +3992,15 @@ public class ConnectivityManager {
* is unknown prior to bringing up the network so the framework does not
* know how to go about satisfying a request with these capabilities.
*
+ * <p>To avoid performance issues due to apps leaking callbacks, the system will limit the
+ * number of outstanding requests to 100 per app (identified by their UID), shared with
+ * all variants of this method, of {@link #registerNetworkCallback} as well as
+ * {@link ConnectivityDiagnosticsManager#registerConnectivityDiagnosticsCallback}.
+ * Requesting a network with this method will count toward this limit. If this limit is
+ * exceeded, an exception will be thrown. To avoid hitting this issue and to conserve resources,
+ * make sure to unregister the callbacks with {@link #unregisterNetworkCallback(PendingIntent)}
+ * or {@link #releaseNetworkRequest(PendingIntent)}.
+ *
* <p>This method requires the caller to hold either the
* {@link android.Manifest.permission#CHANGE_NETWORK_STATE} permission
* or the ability to modify system settings as determined by
@@ -3994,7 +4012,7 @@ public class ConnectivityManager {
* comes from {@link PendingIntent#getBroadcast}. Cannot be null.
* @throws IllegalArgumentException if {@code request} contains invalid network capabilities.
* @throws SecurityException if missing the appropriate permissions.
- * @throws RuntimeException if request limit per UID is exceeded.
+ * @throws RuntimeException if the app already has too many callbacks registered.
*/
public void requestNetwork(@NonNull NetworkRequest request,
@NonNull PendingIntent operation) {
@@ -4051,10 +4069,20 @@ public class ConnectivityManager {
* either the application exits or {@link #unregisterNetworkCallback(NetworkCallback)} is
* called.
*
+ * <p>To avoid performance issues due to apps leaking callbacks, the system will limit the
+ * number of outstanding requests to 100 per app (identified by their UID), shared with
+ * all variants of this method, of {@link #requestNetwork} as well as
+ * {@link ConnectivityDiagnosticsManager#registerConnectivityDiagnosticsCallback}.
+ * Requesting a network with this method will count toward this limit. If this limit is
+ * exceeded, an exception will be thrown. To avoid hitting this issue and to conserve resources,
+ * make sure to unregister the callbacks with
+ * {@link #unregisterNetworkCallback(NetworkCallback)}.
+ *
* @param request {@link NetworkRequest} describing this request.
* @param networkCallback The {@link NetworkCallback} that the system will call as suitable
* networks change state.
* The callback is invoked on the default internal Handler.
+ * @throws RuntimeException if the app already has too many callbacks registered.
*/
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
public void registerNetworkCallback(@NonNull NetworkRequest request,
@@ -4068,10 +4096,21 @@ public class ConnectivityManager {
* either the application exits or {@link #unregisterNetworkCallback(NetworkCallback)} is
* called.
*
+ * <p>To avoid performance issues due to apps leaking callbacks, the system will limit the
+ * number of outstanding requests to 100 per app (identified by their UID), shared with
+ * all variants of this method, of {@link #requestNetwork} as well as
+ * {@link ConnectivityDiagnosticsManager#registerConnectivityDiagnosticsCallback}.
+ * Requesting a network with this method will count toward this limit. If this limit is
+ * exceeded, an exception will be thrown. To avoid hitting this issue and to conserve resources,
+ * make sure to unregister the callbacks with
+ * {@link #unregisterNetworkCallback(NetworkCallback)}.
+ *
+ *
* @param request {@link NetworkRequest} describing this request.
* @param networkCallback The {@link NetworkCallback} that the system will call as suitable
* networks change state.
* @param handler {@link Handler} to specify the thread upon which the callback will be invoked.
+ * @throws RuntimeException if the app already has too many callbacks registered.
*/
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
public void registerNetworkCallback(@NonNull NetworkRequest request,
@@ -4105,10 +4144,21 @@ public class ConnectivityManager {
* <p>
* The request may be released normally by calling
* {@link #unregisterNetworkCallback(android.app.PendingIntent)}.
+ *
+ * <p>To avoid performance issues due to apps leaking callbacks, the system will limit the
+ * number of outstanding requests to 100 per app (identified by their UID), shared with
+ * all variants of this method, of {@link #requestNetwork} as well as
+ * {@link ConnectivityDiagnosticsManager#registerConnectivityDiagnosticsCallback}.
+ * Requesting a network with this method will count toward this limit. If this limit is
+ * exceeded, an exception will be thrown. To avoid hitting this issue and to conserve resources,
+ * make sure to unregister the callbacks with {@link #unregisterNetworkCallback(PendingIntent)}
+ * or {@link #releaseNetworkRequest(PendingIntent)}.
+ *
* @param request {@link NetworkRequest} describing this request.
* @param operation Action to perform when the network is available (corresponds
* to the {@link NetworkCallback#onAvailable} call. Typically
* comes from {@link PendingIntent#getBroadcast}. Cannot be null.
+ * @throws RuntimeException if the app already has too many callbacks registered.
*/
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
public void registerNetworkCallback(@NonNull NetworkRequest request,
@@ -4130,9 +4180,19 @@ public class ConnectivityManager {
* will continue to be called until either the application exits or
* {@link #unregisterNetworkCallback(NetworkCallback)} is called.
*
+ * <p>To avoid performance issues due to apps leaking callbacks, the system will limit the
+ * number of outstanding requests to 100 per app (identified by their UID), shared with
+ * all variants of this method, of {@link #requestNetwork} as well as
+ * {@link ConnectivityDiagnosticsManager#registerConnectivityDiagnosticsCallback}.
+ * Requesting a network with this method will count toward this limit. If this limit is
+ * exceeded, an exception will be thrown. To avoid hitting this issue and to conserve resources,
+ * make sure to unregister the callbacks with
+ * {@link #unregisterNetworkCallback(NetworkCallback)}.
+ *
* @param networkCallback The {@link NetworkCallback} that the system will call as the
* system default network changes.
* The callback is invoked on the default internal Handler.
+ * @throws RuntimeException if the app already has too many callbacks registered.
*/
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
public void registerDefaultNetworkCallback(@NonNull NetworkCallback networkCallback) {
@@ -4144,9 +4204,19 @@ public class ConnectivityManager {
* will continue to be called until either the application exits or
* {@link #unregisterNetworkCallback(NetworkCallback)} is called.
*
+ * <p>To avoid performance issues due to apps leaking callbacks, the system will limit the
+ * number of outstanding requests to 100 per app (identified by their UID), shared with
+ * all variants of this method, of {@link #requestNetwork} as well as
+ * {@link ConnectivityDiagnosticsManager#registerConnectivityDiagnosticsCallback}.
+ * Requesting a network with this method will count toward this limit. If this limit is
+ * exceeded, an exception will be thrown. To avoid hitting this issue and to conserve resources,
+ * make sure to unregister the callbacks with
+ * {@link #unregisterNetworkCallback(NetworkCallback)}.
+ *
* @param networkCallback The {@link NetworkCallback} that the system will call as the
* system default network changes.
* @param handler {@link Handler} to specify the thread upon which the callback will be invoked.
+ * @throws RuntimeException if the app already has too many callbacks registered.
*/
@RequiresPermission(android.Manifest.permission.ACCESS_NETWORK_STATE)
public void registerDefaultNetworkCallback(@NonNull NetworkCallback networkCallback,
@@ -4238,7 +4308,6 @@ public class ConnectivityManager {
* Cannot be null.
*/
public void unregisterNetworkCallback(@NonNull PendingIntent operation) {
- checkPendingIntentNotNull(operation);
releaseNetworkRequest(operation);
}
diff --git a/core/java/android/net/NetworkCapabilities.java b/core/java/android/net/NetworkCapabilities.java
index 0fbffbac5d04..ec87091504af 100644
--- a/core/java/android/net/NetworkCapabilities.java
+++ b/core/java/android/net/NetworkCapabilities.java
@@ -900,9 +900,17 @@ public final class NetworkCapabilities implements Parcelable {
* <p>For NetworkCapability instances being sent from ConnectivityService, this value MUST be
* reset to Process.INVALID_UID unless all the following conditions are met:
*
+ * <p>The caller is the network owner, AND one of the following sets of requirements is met:
+ *
+ * <ol>
+ * <li>The described Network is a VPN
+ * </ol>
+ *
+ * <p>OR:
+ *
* <ol>
- * <li>The destination app is the network owner
- * <li>The destination app has the ACCESS_FINE_LOCATION permission granted
+ * <li>The calling app is the network owner
+ * <li>The calling app has the ACCESS_FINE_LOCATION permission granted
* <li>The user's location toggle is on
* </ol>
*
@@ -928,7 +936,16 @@ public final class NetworkCapabilities implements Parcelable {
/**
* Retrieves the UID of the app that owns this network.
*
- * <p>For user privacy reasons, this field will only be populated if:
+ * <p>For user privacy reasons, this field will only be populated if the following conditions
+ * are met:
+ *
+ * <p>The caller is the network owner, AND one of the following sets of requirements is met:
+ *
+ * <ol>
+ * <li>The described Network is a VPN
+ * </ol>
+ *
+ * <p>OR:
*
* <ol>
* <li>The calling app is the network owner
@@ -936,8 +953,8 @@ public final class NetworkCapabilities implements Parcelable {
* <li>The user's location toggle is on
* </ol>
*
- * Instances of NetworkCapabilities sent to apps without the appropriate permissions will
- * have this field cleared out.
+ * Instances of NetworkCapabilities sent to apps without the appropriate permissions will have
+ * this field cleared out.
*/
public int getOwnerUid() {
return mOwnerUid;
diff --git a/core/java/android/telephony/PhoneStateListener.java b/core/java/android/telephony/PhoneStateListener.java
index d64077525905..46f4bdf3a305 100644
--- a/core/java/android/telephony/PhoneStateListener.java
+++ b/core/java/android/telephony/PhoneStateListener.java
@@ -157,8 +157,8 @@ public class PhoneStateListener {
* Listen for changes to the device's cell location. Note that
* this will result in frequent callbacks to the listener.
* {@more}
- * Requires Permission: {@link android.Manifest.permission#ACCESS_COARSE_LOCATION
- * ACCESS_COARSE_LOCATION}
+ * Requires Permission: {@link android.Manifest.permission#ACCESS_FINE_LOCATION
+ * ACCESS_FINE_LOCATION}
* <p>
* If you need regular location updates but want more control over
* the update interval or location precision, you can set up a listener
diff --git a/core/java/com/android/server/SystemConfig.java b/core/java/com/android/server/SystemConfig.java
index 475981811b77..be1524689c1c 100644
--- a/core/java/com/android/server/SystemConfig.java
+++ b/core/java/com/android/server/SystemConfig.java
@@ -1015,6 +1015,10 @@ public class SystemConfig {
addFeature(PackageManager.FEATURE_RAM_NORMAL, 0);
}
+ if (Build.VERSION.FIRST_SDK_INT >= Build.VERSION_CODES.Q) {
+ addFeature(PackageManager.FEATURE_IPSEC_TUNNELS, 0);
+ }
+
for (String featureName : mUnavailableFeatures) {
removeFeature(featureName);
}
diff --git a/core/proto/android/stats/connectivity/Android.bp b/core/proto/android/stats/connectivity/Android.bp
index 5d642d3845fe..9cd233e1ba85 100644
--- a/core/proto/android/stats/connectivity/Android.bp
+++ b/core/proto/android/stats/connectivity/Android.bp
@@ -13,12 +13,12 @@
// limitations under the License.
java_library_static {
- name: "networkstackprotosnano",
+ name: "networkstackprotos",
proto: {
- type: "nano",
+ type: "lite",
},
srcs: [
"network_stack.proto",
],
- sdk_version: "system_current",
+ sdk_version: "system_29",
}
diff --git a/core/proto/android/stats/connectivity/network_stack.proto b/core/proto/android/stats/connectivity/network_stack.proto
index 7d9aa1c6eb23..e9726d7ce195 100644
--- a/core/proto/android/stats/connectivity/network_stack.proto
+++ b/core/proto/android/stats/connectivity/network_stack.proto
@@ -20,6 +20,160 @@ package android.stats.connectivity;
option java_multiple_files = true;
option java_outer_classname = "NetworkStackProto";
+enum DhcpRenewResult {
+ RR_UNKNOWN = 0;
+ RR_SUCCESS = 1;
+ RR_ERROR_NAK = 2;
+ RR_ERROR_IP_MISMATCH = 3;
+ RR_ERROR_IP_EXPIRE = 4;
+}
+
+enum DisconnectCode {
+ DC_NONE = 0;
+ DC_NORMAL_TERMINATION = 1;
+ DC_PROVISIONING_FAIL = 2;
+ DC_ERROR_STARTING_IPV4 = 4;
+ DC_ERROR_STARTING_IPV6 = 5;
+ DC_ERROR_STARTING_IPREACHABILITYMONITOR = 6;
+ DC_INVALID_PROVISIONING = 7;
+ DC_INTERFACE_NOT_FOUND = 8;
+ DC_PROVISIONING_TIMEOUT = 9;
+}
+
+enum TransportType {
+ TT_UNKNOWN = 0;
+ // Indicates this network uses a Cellular transport
+ TT_CELLULAR = 1;
+ // Indicates this network uses a Wi-Fi transport
+ TT_WIFI = 2;
+ // Indicates this network uses a Bluetooth transport
+ TT_BLUETOOTH = 3;
+ // Indicates this network uses an Ethernet transport
+ TT_ETHERNET = 4;
+ // Indicates this network uses a Wi-Fi Aware transport
+ TT_WIFI_AWARE = 5;
+ // Indicates this network uses a LoWPAN transport
+ TT_LOWPAN = 6;
+ // Indicates this network uses a Cellular+VPN transport
+ TT_CELLULAR_VPN = 7;
+ // Indicates this network uses a Wi-Fi+VPN transport
+ TT_WIFI_VPN = 8;
+ // Indicates this network uses a Bluetooth+VPN transport
+ TT_BLUETOOTH_VPN = 9;
+ // Indicates this network uses an Ethernet+VPN transport
+ TT_ETHERNET_VPN = 10;
+ // Indicates this network uses a Wi-Fi+Cellular+VPN transport
+ TT_WIFI_CELLULAR_VPN = 11;
+ // Indicates this network uses for test only
+ TT_TEST = 12;
+}
+
+enum DhcpFeature {
+ DF_UNKNOWN = 0;
+ // DHCP INIT-REBOOT state
+ DF_INITREBOOT = 1;
+ // DHCP rapid commit option
+ DF_RAPIDCOMMIT = 2;
+ // Duplicate address detection
+ DF_DAD = 3;
+ // Fast initial Link setup
+ DF_FILS = 4;
+}
+
+enum HostnameTransResult {
+ HTR_UNKNOWN = 0;
+ HTR_SUCCESS = 1;
+ HTR_FAILURE = 2;
+ HTR_DISABLE = 3;
+}
+
+enum ProbeResult {
+ PR_UNKNOWN = 0;
+ PR_SUCCESS = 1;
+ PR_FAILURE = 2;
+ PR_PORTAL = 3;
+ // DNS query for the probe host returned a private IP address
+ PR_PRIVATE_IP_DNS = 4;
+}
+
+enum ValidationResult {
+ VR_UNKNOWN = 0;
+ VR_SUCCESS = 1;
+ VR_FAILURE = 2;
+ VR_PORTAL = 3;
+ VR_PARTIAL = 4;
+}
+
+enum ProbeType {
+ PT_UNKNOWN = 0;
+ PT_DNS = 1;
+ PT_HTTP = 2;
+ PT_HTTPS = 3;
+ PT_PAC = 4;
+ PT_FALLBACK = 5;
+ PT_PRIVDNS = 6;
+ PT_CAPPORT_API = 7;
+}
+
+// The Dhcp error code is defined in android.net.metrics.DhcpErrorEvent
+enum DhcpErrorCode {
+ ET_UNKNOWN = 0;
+ ET_L2_ERROR = 1;
+ ET_L3_ERROR = 2;
+ ET_L4_ERROR = 3;
+ ET_DHCP_ERROR = 4;
+ ET_MISC_ERROR = 5;
+ /* Reserve for error type
+ // ET_L2_ERROR_TYPE = ET_L2_ERROR << 8;
+ ET_L2_ERROR_TYPE = 256;
+ // ET_L3_ERROR_TYPE = ET_L3_ERROR << 8;
+ ET_L3_ERROR_TYPE = 512;
+ // ET_L4_ERROR_TYPE = ET_L4_ERROR << 8;
+ ET_L4_ERROR_TYPE = 768;
+ // ET_DHCP_ERROR_TYPE = ET_DHCP_ERROR << 8;
+ ET_DHCP_ERROR_TYPE = 1024;
+ // ET_MISC_ERROR_TYPE = ET_MISC_ERROR << 8;
+ ET_MISC_ERROR_TYPE = 1280;
+ */
+ // ET_L2_TOO_SHORT = (ET_L2_ERROR_TYPE | 0x1) << 16;
+ ET_L2_TOO_SHORT = 16842752;
+ // ET_L2_WRONG_ETH_TYPE = (ET_L2_ERROR_TYPE | 0x2) << 16;
+ ET_L2_WRONG_ETH_TYPE = 16908288;
+ // ET_L3_TOO_SHORT = (ET_L3_ERROR_TYPE | 0x1) << 16;
+ ET_L3_TOO_SHORT = 33619968;
+ // ET_L3_NOT_IPV4 = (ET_L3_ERROR_TYPE | 0x2) << 16;
+ ET_L3_NOT_IPV4 = 33685504;
+ // ET_L3_INVALID_IP = (ET_L3_ERROR_TYPE | 0x3) << 16;
+ ET_L3_INVALID_IP = 33751040;
+ // ET_L4_NOT_UDP = (ET_L4_ERROR_TYPE | 0x1) << 16;
+ ET_L4_NOT_UDP = 50397184;
+ // ET_L4_WRONG_PORT = (ET_L4_ERROR_TYPE | 0x2) << 16;
+ ET_L4_WRONG_PORT = 50462720;
+ // ET_BOOTP_TOO_SHORT = (ET_DHCP_ERROR_TYPE | 0x1) << 16;
+ ET_BOOTP_TOO_SHORT = 67174400;
+ // ET_DHCP_BAD_MAGIC_COOKIE = (ET_DHCP_ERROR_TYPE | 0x2) << 16;
+ ET_DHCP_BAD_MAGIC_COOKIE = 67239936;
+ // ET_DHCP_INVALID_OPTION_LENGTH = (ET_DHCP_ERROR_TYPE | 0x3) << 16;
+ ET_DHCP_INVALID_OPTION_LENGTH = 67305472;
+ // ET_DHCP_NO_MSG_TYPE = (ET_DHCP_ERROR_TYPE | 0x4) << 16;
+ ET_DHCP_NO_MSG_TYPE = 67371008;
+ // ET_DHCP_UNKNOWN_MSG_TYPE = (ET_DHCP_ERROR_TYPE | 0x5) << 16;
+ ET_DHCP_UNKNOWN_MSG_TYPE = 67436544;
+ // ET_DHCP_NO_COOKIE = (ET_DHCP_ERROR_TYPE | 0x6) << 16;
+ ET_DHCP_NO_COOKIE = 67502080;
+ // ET_BUFFER_UNDERFLOW = (ET_MISC_ERROR_TYPE | 0x1) << 16;
+ ET_BUFFER_UNDERFLOW = 83951616;
+ // ET_RECEIVE_ERROR = (ET_MISC_ERROR_TYPE | 0x2) << 16;
+ ET_RECEIVE_ERROR = 84017152;
+ // ET_PARSING_ERROR = (ET_MISC_ERROR_TYPE | 0x3) << 16;
+ ET_PARSING_ERROR = 84082688;
+}
+
+enum NetworkQuirkEvent {
+ QE_UNKNOWN = 0;
+ QE_IPV6_PROVISIONING_ROUTER_LOST = 1;
+}
+
message NetworkStackEventData {
}
diff --git a/core/tests/coretests/src/com/android/internal/os/KernelCpuUidBpfMapReaderTest.java b/core/tests/coretests/src/com/android/internal/os/KernelCpuUidBpfMapReaderTest.java
index 257b388917e4..bda21c61375e 100644
--- a/core/tests/coretests/src/com/android/internal/os/KernelCpuUidBpfMapReaderTest.java
+++ b/core/tests/coretests/src/com/android/internal/os/KernelCpuUidBpfMapReaderTest.java
@@ -179,6 +179,21 @@ public class KernelCpuUidBpfMapReaderTest {
testOpenAndReadData(changedData);
}
+ @Test
+ public void testRemoveUidsInRange_firstAndLastAbsent() {
+ final SparseArray<long[]> data = getTestSparseArray(200, 50);
+ data.delete(0);
+ data.delete(5);
+ mReader.setData(data);
+ testOpenAndReadData(data);
+ SparseArray<long[]> changedData = new SparseArray<>();
+ for (int i = 6; i < 200; i++) {
+ changedData.put(i, data.get(i));
+ }
+ mReader.removeUidsInRange(0, 5);
+ testOpenAndReadData(changedData);
+ }
+
private void testOpenAndReadData(SparseArray<long[]> expectedData) {
try (BpfMapIterator iter = mReader.open()) {
long[] actual;
diff --git a/data/etc/car/com.android.car.bugreport.xml b/data/etc/car/com.android.car.bugreport.xml
index 432a838a90e8..4bbf11659214 100644
--- a/data/etc/car/com.android.car.bugreport.xml
+++ b/data/etc/car/com.android.car.bugreport.xml
@@ -15,7 +15,7 @@
~ limitations under the License
-->
<permissions>
- <privapp-permissions package="com.android.car.bugreport">
+ <privapp-permissions package="com.google.android.car.bugreport">
<permission name="android.permission.DUMP"/>
<permission name="android.permission.INTERACT_ACROSS_USERS"/>
<permission name="android.permission.READ_LOGS"/>
diff --git a/data/keyboards/Vendor_0a5c_Product_8502.kl b/data/keyboards/Vendor_0a5c_Product_8502.kl
new file mode 100644
index 000000000000..6d4a163d9f0b
--- /dev/null
+++ b/data/keyboards/Vendor_0a5c_Product_8502.kl
@@ -0,0 +1,37 @@
+# Copyright (C) 2020 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# SnakeByte iDroid:con
+
+key 304 BUTTON_A
+key 305 BUTTON_B
+key 306 BUTTON_THUMBL
+key 307 BUTTON_X
+key 308 BUTTON_Y
+key 309 BUTTON_THUMBR
+key 310 BUTTON_L1
+key 311 BUTTON_R1
+key 312 BUTTON_L2
+key 313 BUTTON_R2
+key 314 BUTTON_SELECT
+key 315 BUTTON_START
+
+axis 0x00 X
+axis 0x01 Y
+axis 0x02 Z
+axis 0x03 RX
+axis 0x04 RY
+axis 0x05 RZ
+axis 0x10 HAT_X
+axis 0x11 HAT_Y
diff --git a/non-updatable-api/current.txt b/non-updatable-api/current.txt
index 4dffc4bd2e8d..3ad076f60c08 100644
--- a/non-updatable-api/current.txt
+++ b/non-updatable-api/current.txt
@@ -45200,14 +45200,14 @@ package android.telephony {
public class MbmsDownloadSession implements java.lang.AutoCloseable {
method public void addProgressListener(@NonNull android.telephony.mbms.DownloadRequest, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.DownloadProgressListener);
- method public void addServiceAnnouncementFile(@NonNull byte[]);
+ method public void addServiceAnnouncement(@NonNull byte[]);
method public void addStatusListener(@NonNull android.telephony.mbms.DownloadRequest, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.DownloadStatusListener);
method public void cancelDownload(@NonNull android.telephony.mbms.DownloadRequest);
method public void close();
method public static android.telephony.MbmsDownloadSession create(@NonNull android.content.Context, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.MbmsDownloadSessionCallback);
method @Nullable public static android.telephony.MbmsDownloadSession create(@NonNull android.content.Context, @NonNull java.util.concurrent.Executor, int, @NonNull android.telephony.mbms.MbmsDownloadSessionCallback);
method public void download(@NonNull android.telephony.mbms.DownloadRequest);
- method public static int getMaximumServiceAnnouncementFileSize();
+ method public static int getMaximumServiceAnnouncementSize();
method @Nullable public java.io.File getTempFileRootDirectory();
method @NonNull public java.util.List<android.telephony.mbms.DownloadRequest> listPendingDownloads();
method public void removeProgressListener(@NonNull android.telephony.mbms.DownloadRequest, @NonNull android.telephony.mbms.DownloadProgressListener);
@@ -46814,7 +46814,7 @@ package android.telephony.mbms {
public static class MbmsErrors.DownloadErrors {
field public static final int ERROR_CANNOT_CHANGE_TEMP_FILE_ROOT = 401; // 0x191
- field public static final int ERROR_MALFORMED_SERVICE_ANNOUNCEMENT_FILE = 404; // 0x194
+ field public static final int ERROR_MALFORMED_SERVICE_ANNOUNCEMENT = 404; // 0x194
field public static final int ERROR_UNKNOWN_DOWNLOAD_REQUEST = 402; // 0x192
field public static final int ERROR_UNKNOWN_FILE_INFO = 403; // 0x193
}
diff --git a/non-updatable-api/system-current.txt b/non-updatable-api/system-current.txt
index 6da5ad21a1dc..0b299092c433 100644
--- a/non-updatable-api/system-current.txt
+++ b/non-updatable-api/system-current.txt
@@ -10219,7 +10219,7 @@ package android.telephony.mbms.vendor {
public class MbmsDownloadServiceBase extends android.os.Binder implements android.os.IInterface {
ctor public MbmsDownloadServiceBase();
method public int addProgressListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadProgressListener) throws android.os.RemoteException;
- method public int addServiceAnnouncementFile(int, @NonNull byte[]);
+ method public int addServiceAnnouncement(int, @NonNull byte[]);
method public int addStatusListener(android.telephony.mbms.DownloadRequest, android.telephony.mbms.DownloadStatusListener) throws android.os.RemoteException;
method public android.os.IBinder asBinder();
method public int cancelDownload(android.telephony.mbms.DownloadRequest) throws android.os.RemoteException;
diff --git a/services/backup/OWNERS b/services/backup/OWNERS
index ec694dfae144..9c21e8fe5e45 100644
--- a/services/backup/OWNERS
+++ b/services/backup/OWNERS
@@ -6,3 +6,4 @@ ctate@google.com
jorlow@google.com
nathch@google.com
rthakohov@google.com
+
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 483d4b6711d7..320f3fbae020 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -1698,6 +1698,12 @@ public class ConnectivityService extends IConnectivityManager.Stub
return newNc;
}
+ // Allow VPNs to see ownership of their own VPN networks - not location sensitive.
+ if (nc.hasTransport(TRANSPORT_VPN)) {
+ // Owner UIDs already checked above. No need to re-check.
+ return newNc;
+ }
+
Binder.withCleanCallingIdentity(
() -> {
if (!mLocationPermissionChecker.checkLocationPermission(
@@ -6422,7 +6428,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
final boolean shouldFilter = requiresVpnIsolation(nai, newNc, nai.linkProperties);
final String iface = nai.linkProperties.getInterfaceName();
// For VPN uid interface filtering, old ranges need to be removed before new ranges can
- // be added, due to the range being expanded and stored as invidiual UIDs. For example
+ // be added, due to the range being expanded and stored as individual UIDs. For example
// the UIDs might be updated from [0, 99999] to ([0, 10012], [10014, 99999]) which means
// prevRanges = [0, 99999] while newRanges = [0, 10012], [10014, 99999]. If prevRanges
// were added first and then newRanges got removed later, there would be only one uid
diff --git a/services/core/java/com/android/server/TelephonyRegistry.java b/services/core/java/com/android/server/TelephonyRegistry.java
index d012bd7c91ad..82ce7b1002e3 100644
--- a/services/core/java/com/android/server/TelephonyRegistry.java
+++ b/services/core/java/com/android/server/TelephonyRegistry.java
@@ -1605,7 +1605,7 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
for (Record r : mRecords) {
if (r.matchPhoneStateListenerEvent(
PhoneStateListener.LISTEN_DISPLAY_INFO_CHANGED)
- && idMatch(r.subId, subId, phoneId)) {
+ && idMatchWithoutDefaultPhoneCheck(r.subId, subId)) {
try {
r.callback.onDisplayInfoChanged(telephonyDisplayInfo);
} catch (RemoteException ex) {
@@ -2703,6 +2703,24 @@ public class TelephonyRegistry extends ITelephonyRegistry.Stub {
Rlog.e(TAG, s);
}
+ /**
+ * If the registrant specified a subId, then we should only notify it if subIds match.
+ * If the registrant registered with DEFAULT subId, we should notify only when the related subId
+ * is default subId (which could be INVALID if there's no default subId).
+ *
+ * This should be the correct way to check record ID match. in idMatch the record's phoneId is
+ * speculated based on subId passed by the registrant so it's not a good reference.
+ * But to avoid triggering potential regression only replace idMatch with it when an issue with
+ * idMatch is reported. Eventually this should replace all instances of idMatch.
+ */
+ private boolean idMatchWithoutDefaultPhoneCheck(int subIdInRecord, int subIdToNotify) {
+ if (subIdInRecord == SubscriptionManager.DEFAULT_SUBSCRIPTION_ID) {
+ return (subIdToNotify == mDefaultSubId);
+ } else {
+ return (subIdInRecord == subIdToNotify);
+ }
+ }
+
boolean idMatch(int rSubId, int subId, int phoneId) {
if(subId < 0) {
diff --git a/services/core/java/com/android/server/connectivity/Vpn.java b/services/core/java/com/android/server/connectivity/Vpn.java
index 0cda7ca30414..0cde5b1c5b11 100644
--- a/services/core/java/com/android/server/connectivity/Vpn.java
+++ b/services/core/java/com/android/server/connectivity/Vpn.java
@@ -1106,7 +1106,8 @@ public class Vpn {
NetworkAgentConfig networkAgentConfig = new NetworkAgentConfig();
networkAgentConfig.allowBypass = mConfig.allowBypass && !mLockdown;
- mNetworkCapabilities.setOwnerUid(Binder.getCallingUid());
+ mNetworkCapabilities.setOwnerUid(mOwnerUID);
+ mNetworkCapabilities.setAdministratorUids(new int[] {mOwnerUID});
mNetworkCapabilities.setUids(createUserAndRestrictedProfilesRanges(mUserHandle,
mConfig.allowedApplications, mConfig.disallowedApplications));
long token = Binder.clearCallingIdentity();
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index ce71511c0361..b3bf507d701e 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -1630,6 +1630,7 @@ public class TelecomManager {
* @hide
*/
@SystemApi
+ @TestApi
@RequiresPermission(anyOf = {
READ_PRIVILEGED_PHONE_STATE,
android.Manifest.permission.READ_PHONE_STATE
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index 7f45ef4a2eca..c9ee2a1279bc 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -2798,14 +2798,12 @@ public class CarrierConfigManager {
/**
* A list of 4 customized LTE Reference Signal Signal to Noise Ratio (RSSNR) thresholds.
*
- * 4 threshold integers must be within the boundaries [-200, 300], and the levels are:
- * "NONE: [-200, threshold1)"
+ * 4 threshold integers must be within the boundaries [-20 dB, 30 dB], and the levels are:
+ * "NONE: [-20, threshold1)"
* "POOR: [threshold1, threshold2)"
* "MODERATE: [threshold2, threshold3)"
* "GOOD: [threshold3, threshold4)"
- * "EXCELLENT: [threshold4, 300]"
- * Note: the unit of the values is 10*db; it is derived by multiplying 10 on the original dB
- * value reported by modem.
+ * "EXCELLENT: [threshold4, 30]"
*
* This key is considered invalid if the format is violated. If the key is invalid or
* not configured, a default value set will apply.
@@ -4143,10 +4141,10 @@ public class CarrierConfigManager {
});
sDefaults.putIntArray(KEY_LTE_RSSNR_THRESHOLDS_INT_ARRAY,
new int[] {
- -30, /* SIGNAL_STRENGTH_POOR */
- 10, /* SIGNAL_STRENGTH_MODERATE */
- 45, /* SIGNAL_STRENGTH_GOOD */
- 130 /* SIGNAL_STRENGTH_GREAT */
+ -3, /* SIGNAL_STRENGTH_POOR */
+ 1, /* SIGNAL_STRENGTH_MODERATE */
+ 5, /* SIGNAL_STRENGTH_GOOD */
+ 13 /* SIGNAL_STRENGTH_GREAT */
});
sDefaults.putIntArray(KEY_WCDMA_RSCP_THRESHOLDS_INT_ARRAY,
new int[] {
diff --git a/telephony/java/android/telephony/CellSignalStrengthLte.java b/telephony/java/android/telephony/CellSignalStrengthLte.java
index 2529387b19b3..c26936e4bdd0 100644
--- a/telephony/java/android/telephony/CellSignalStrengthLte.java
+++ b/telephony/java/android/telephony/CellSignalStrengthLte.java
@@ -118,7 +118,7 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P
* @param rssi in dBm [-113,-51], UNKNOWN
* @param rsrp in dBm [-140,-43], UNKNOWN
* @param rsrq in dB [-34, 3], UNKNOWN
- * @param rssnr in 10*dB [-200, +300], UNKNOWN
+ * @param rssnr in dB [-20, +30], UNKNOWN
* @param cqi [0, 15], UNKNOWN
* @param timingAdvance [0, 1282], UNKNOWN
*
@@ -131,7 +131,7 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P
mSignalStrength = mRssi;
mRsrp = inRangeOrUnavailable(rsrp, -140, -43);
mRsrq = inRangeOrUnavailable(rsrq, -34, 3);
- mRssnr = inRangeOrUnavailable(rssnr, -200, 300);
+ mRssnr = inRangeOrUnavailable(rssnr, -20, 30);
mCqi = inRangeOrUnavailable(cqi, 0, 15);
mTimingAdvance = inRangeOrUnavailable(timingAdvance, 0, 1282);
updateLevel(null, null);
@@ -143,7 +143,7 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P
this(convertRssiAsuToDBm(lte.signalStrength),
lte.rsrp != CellInfo.UNAVAILABLE ? -lte.rsrp : lte.rsrp,
lte.rsrq != CellInfo.UNAVAILABLE ? -lte.rsrq : lte.rsrq,
- lte.rssnr, lte.cqi, lte.timingAdvance);
+ convertRssnrUnitFromTenDbToDB(lte.rssnr), lte.cqi, lte.timingAdvance);
}
/** @hide */
@@ -208,10 +208,10 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P
};
// Lifted from Default carrier configs and max range of RSSNR
private static final int[] sRssnrThresholds = new int[] {
- -30, /* SIGNAL_STRENGTH_POOR */
- 10, /* SIGNAL_STRENGTH_MODERATE */
- 45, /* SIGNAL_STRENGTH_GOOD */
- 130 /* SIGNAL_STRENGTH_GREAT */
+ -3, /* SIGNAL_STRENGTH_POOR */
+ 1, /* SIGNAL_STRENGTH_MODERATE */
+ 5, /* SIGNAL_STRENGTH_GOOD */
+ 13 /* SIGNAL_STRENGTH_GREAT */
};
private static final int sRsrpBoost = 0;
@@ -556,6 +556,10 @@ public final class CellSignalStrengthLte extends CellSignalStrength implements P
Rlog.w(LOG_TAG, s);
}
+ private static int convertRssnrUnitFromTenDbToDB(int rssnr) {
+ return rssnr / 10;
+ }
+
private static int convertRssiAsuToDBm(int rssiAsu) {
if (rssiAsu == SIGNAL_STRENGTH_LTE_RSSI_ASU_UNKNOWN) {
return CellInfo.UNAVAILABLE;
diff --git a/telephony/java/android/telephony/MbmsDownloadSession.java b/telephony/java/android/telephony/MbmsDownloadSession.java
index 3d96fc634d6a..3f671ca2d809 100644
--- a/telephony/java/android/telephony/MbmsDownloadSession.java
+++ b/telephony/java/android/telephony/MbmsDownloadSession.java
@@ -231,7 +231,7 @@ public class MbmsDownloadSession implements AutoCloseable {
private static final String DESTINATION_SANITY_CHECK_FILE_NAME = "destinationSanityCheckFile";
- private static final int MAX_SERVICE_ANNOUNCEMENT_FILE_SIZE = 10 * 1024; // 10KB
+ private static final int MAX_SERVICE_ANNOUNCEMENT_SIZE = 10 * 1024; // 10KB
private static AtomicBoolean sIsInitialized = new AtomicBoolean(false);
@@ -321,13 +321,13 @@ public class MbmsDownloadSession implements AutoCloseable {
}
/**
- * Returns the maximum size of the service announcement file that can be provided via
- * {@link #addServiceAnnouncementFile}
+ * Returns the maximum size of the service announcement descriptor that can be provided via
+ * {@link #addServiceAnnouncement}
* @return The maximum length of the byte array passed as an argument to
- * {@link #addServiceAnnouncementFile}.
+ * {@link #addServiceAnnouncement}.
*/
- public static int getMaximumServiceAnnouncementFileSize() {
- return MAX_SERVICE_ANNOUNCEMENT_FILE_SIZE;
+ public static int getMaximumServiceAnnouncementSize() {
+ return MAX_SERVICE_ANNOUNCEMENT_SIZE;
}
private int bindAndInitialize() {
@@ -436,15 +436,15 @@ public class MbmsDownloadSession implements AutoCloseable {
}
/**
- * Inform the middleware of a service announcement file received from a group communication
- * server.
+ * Inform the middleware of a service announcement descriptor received from a group
+ * communication server.
*
* When participating in a group call via the {@link MbmsGroupCallSession} API, applications may
- * receive a service announcement file from the group call server that informs them of
+ * receive a service announcement descriptor from the group call server that informs them of
* files that may be relevant to users communicating on the group call.
*
- * After supplying the service announcement file received from the server to the middleware via
- * this API, applications will receive information on the available files via
+ * After supplying the service announcement descriptor received from the server to the
+ * middleware via this API, applications will receive information on the available files via
* {@link MbmsDownloadSessionCallback#onFileServicesUpdated}, and the available files will be
* downloadable via {@link MbmsDownloadSession#download} like other files published via
* {@link MbmsDownloadSessionCallback#onFileServicesUpdated}.
@@ -453,26 +453,27 @@ public class MbmsDownloadSession implements AutoCloseable {
* callback may include any of the errors that are not specific to the streaming use-case.
*
* May throw an {@link IllegalStateException} when the middleware has not yet been bound,
- * or an {@link IllegalArgumentException} if the file is too large.
+ * or an {@link IllegalArgumentException} if the byte array is too large, or an
+ * {@link UnsupportedOperationException} if the middleware has not implemented this method.
*
- * @param fileContents The contents of the service announcement file received from the group
- * call server. If the size of this array is greater than the value of
- * {@link #getMaximumServiceAnnouncementFileSize()}, an
+ * @param contents The contents of the service announcement descriptor received from the
+ * group call server. If the size of this array is greater than the value of
+ * {@link #getMaximumServiceAnnouncementSize()}, an
* {@link IllegalArgumentException} will be thrown.
*/
- public void addServiceAnnouncementFile(@NonNull byte[] fileContents) {
+ public void addServiceAnnouncement(@NonNull byte[] contents) {
IMbmsDownloadService downloadService = mService.get();
if (downloadService == null) {
throw new IllegalStateException("Middleware not yet bound");
}
- if (fileContents.length > MAX_SERVICE_ANNOUNCEMENT_FILE_SIZE) {
+ if (contents.length > MAX_SERVICE_ANNOUNCEMENT_SIZE) {
throw new IllegalArgumentException("File too large");
}
try {
- int returnCode = downloadService.addServiceAnnouncementFile(
- mSubscriptionId, fileContents);
+ int returnCode = downloadService.addServiceAnnouncement(
+ mSubscriptionId, contents);
if (returnCode == MbmsErrors.UNKNOWN) {
// Unbind and throw an obvious error
close();
diff --git a/telephony/java/android/telephony/mbms/MbmsErrors.java b/telephony/java/android/telephony/mbms/MbmsErrors.java
index 8611d26bc85b..40f3ae82d778 100644
--- a/telephony/java/android/telephony/mbms/MbmsErrors.java
+++ b/telephony/java/android/telephony/mbms/MbmsErrors.java
@@ -144,11 +144,11 @@ public class MbmsErrors {
public static final int ERROR_UNKNOWN_FILE_INFO = 403;
/**
- * Indicates that the service announcement file passed via
- * {@link android.telephony.MbmsDownloadSession#addServiceAnnouncementFile(byte[])}
+ * Indicates that the service announcement descriptor passed via
+ * {@link android.telephony.MbmsDownloadSession#addServiceAnnouncement(byte[])}
* is malformed.
*/
- public static final int ERROR_MALFORMED_SERVICE_ANNOUNCEMENT_FILE = 404;
+ public static final int ERROR_MALFORMED_SERVICE_ANNOUNCEMENT = 404;
}
/**
@@ -189,7 +189,7 @@ public class MbmsErrors {
DownloadErrors.ERROR_CANNOT_CHANGE_TEMP_FILE_ROOT,
DownloadErrors.ERROR_UNKNOWN_DOWNLOAD_REQUEST,
DownloadErrors.ERROR_UNKNOWN_FILE_INFO,
- DownloadErrors.ERROR_MALFORMED_SERVICE_ANNOUNCEMENT_FILE,
+ DownloadErrors.ERROR_MALFORMED_SERVICE_ANNOUNCEMENT,
GroupCallErrors.ERROR_UNABLE_TO_START_SERVICE,
GroupCallErrors.ERROR_DUPLICATE_START_GROUP_CALL,
})
diff --git a/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl b/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl
index 36136ab280c4..04efd53eb743 100755
--- a/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl
+++ b/telephony/java/android/telephony/mbms/vendor/IMbmsDownloadService.aidl
@@ -35,7 +35,7 @@ interface IMbmsDownloadService
int setTempFileRootDirectory(int subId, String rootDirectoryPath);
- int addServiceAnnouncementFile(int subId, in byte[] fileContents);
+ int addServiceAnnouncement(int subId, in byte[] contents);
int download(in DownloadRequest downloadRequest);
diff --git a/telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java b/telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java
index 3279ce66cd17..3053ea03bebe 100644
--- a/telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java
+++ b/telephony/java/android/telephony/mbms/vendor/MbmsDownloadServiceBase.java
@@ -217,24 +217,25 @@ public class MbmsDownloadServiceBase extends IMbmsDownloadService.Stub {
/**
* Called when the client application wishes to receive file information according to a
- * service announcement file received from a group call server.
+ * service announcement descriptor received from a group call server.
*
- * The service announcement file is in the format of a multipart MIME file with XML parts,
- * though no validation is performed on the contents of the {@code fileContents} argument --
+ * The service announcement descriptor is in the format of a multipart MIME file with XML parts,
+ * though no validation is performed on the contents of the {@code contents} argument --
* implementing middleware applications should perform their own validation and return
- * {@link MbmsErrors.DownloadErrors#ERROR_MALFORMED_SERVICE_ANNOUNCEMENT_FILE} if the file is
+ * {@link MbmsErrors.DownloadErrors#ERROR_MALFORMED_SERVICE_ANNOUNCEMENT} if the descriptor is
* malformed.
*
* @param subscriptionId The subscription id the service announcement applies to.
- * @param fileContents The contents of the service announcement file.
+ * @param contents The contents of the service announcement descriptor.
* @return {@link MbmsErrors#SUCCESS}, or
- * {@link MbmsErrors.DownloadErrors#ERROR_MALFORMED_SERVICE_ANNOUNCEMENT_FILE}
+ * {@link MbmsErrors.DownloadErrors#ERROR_MALFORMED_SERVICE_ANNOUNCEMENT}
*/
// TODO: are there any public specifications of what the file format is that I can link to?
@Override
- public @MbmsErrors.MbmsError int addServiceAnnouncementFile(
- int subscriptionId, @NonNull byte[] fileContents) {
- return 0;
+ public @MbmsErrors.MbmsError int addServiceAnnouncement(
+ int subscriptionId, @NonNull byte[] contents) {
+ throw new UnsupportedOperationException("addServiceAnnouncement not supported by"
+ + " this middleware.");
}
/**
diff --git a/test-runner/api/current.txt b/test-runner/api/current.txt
index c093ac7c8d4d..2c19a2e85410 100644
--- a/test-runner/api/current.txt
+++ b/test-runner/api/current.txt
@@ -100,6 +100,13 @@ package android.test {
method @Deprecated public java.util.List<android.content.Intent> getAndClearBroadcastIntents();
}
+ @Deprecated public class LaunchPerformanceBase extends android.app.Instrumentation {
+ ctor @Deprecated public LaunchPerformanceBase();
+ method @Deprecated protected void LaunchApp();
+ field @Deprecated protected android.content.Intent mIntent;
+ field @Deprecated protected android.os.Bundle mResults;
+ }
+
public class LoaderTestCase extends android.test.AndroidTestCase {
ctor public LoaderTestCase();
method public <T> T getLoaderResultSynchronously(android.content.Loader<T>);
@@ -285,6 +292,11 @@ package android.test.suitebuilder {
method @Deprecated public void testSuiteConstructionFailed();
}
+ @Deprecated public class UnitTestSuiteBuilder extends android.test.suitebuilder.TestSuiteBuilder {
+ ctor @Deprecated public UnitTestSuiteBuilder(Class);
+ ctor @Deprecated public UnitTestSuiteBuilder(String, ClassLoader);
+ }
+
}
package junit.runner {
diff --git a/test-runner/src/android/test/LaunchPerformanceBase.java b/test-runner/src/android/test/LaunchPerformanceBase.java
index 62c90d6a4373..d87a8119ae16 100644
--- a/test-runner/src/android/test/LaunchPerformanceBase.java
+++ b/test-runner/src/android/test/LaunchPerformanceBase.java
@@ -23,12 +23,11 @@ import android.os.Bundle;
/**
* Base class for all launch performance Instrumentation classes.
- *
- * @hide
*/
@Deprecated
public class LaunchPerformanceBase extends Instrumentation {
+ /** @hide */
public static final String LOG_TAG = "Launch Performance";
protected Bundle mResults;
@@ -43,8 +42,6 @@ public class LaunchPerformanceBase extends Instrumentation {
/**
* Launches intent, and waits for idle before returning.
- *
- * @hide
*/
protected void LaunchApp() {
startActivitySync(mIntent);
diff --git a/test-runner/src/android/test/suitebuilder/UnitTestSuiteBuilder.java b/test-runner/src/android/test/suitebuilder/UnitTestSuiteBuilder.java
index a746b35e19b7..ea7405b332c0 100644
--- a/test-runner/src/android/test/suitebuilder/UnitTestSuiteBuilder.java
+++ b/test-runner/src/android/test/suitebuilder/UnitTestSuiteBuilder.java
@@ -19,8 +19,9 @@ package android.test.suitebuilder;
/**
* A suite builder that finds unit tests.
*
- * {@hide} Not needed for 1.0 SDK.
+ * @deprecated android.test.runner is obsolete
*/
+@Deprecated
public class UnitTestSuiteBuilder extends TestSuiteBuilder {
public UnitTestSuiteBuilder(Class clazz) {
diff --git a/test-runner/tests/Android.bp b/test-runner/tests/Android.bp
index 03c73986118d..d74cee4937c9 100644
--- a/test-runner/tests/Android.bp
+++ b/test-runner/tests/Android.bp
@@ -25,7 +25,7 @@ android_test {
//
libs: [
- "android.test.runner",
+ "android.test.runner.impl",
"android.test.base",
"android.test.mock",
],
diff --git a/tests/net/java/com/android/server/ConnectivityServiceTest.java b/tests/net/java/com/android/server/ConnectivityServiceTest.java
index ea4982ed7c7d..bc853749e294 100644
--- a/tests/net/java/com/android/server/ConnectivityServiceTest.java
+++ b/tests/net/java/com/android/server/ConnectivityServiceTest.java
@@ -100,6 +100,7 @@ import static org.mockito.ArgumentMatchers.anyLong;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isNull;
import static org.mockito.ArgumentMatchers.startsWith;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Mockito.any;
@@ -164,6 +165,8 @@ import android.net.LinkAddress;
import android.net.LinkProperties;
import android.net.MatchAllNetworkSpecifier;
import android.net.Network;
+import android.net.NetworkAgent;
+import android.net.NetworkAgentConfig;
import android.net.NetworkCapabilities;
import android.net.NetworkFactory;
import android.net.NetworkInfo;
@@ -6808,6 +6811,30 @@ public class ConnectivityServiceTest {
assertEquals(wifiLp, mService.getActiveLinkProperties());
}
+ @Test
+ public void testLegacyExtraInfoSentToNetworkMonitor() throws Exception {
+ class TestNetworkAgent extends NetworkAgent {
+ TestNetworkAgent(Context context, Looper looper, NetworkAgentConfig config) {
+ super(context, looper, "MockAgent", new NetworkCapabilities(),
+ new LinkProperties(), 40 , config, null /* provider */);
+ }
+ }
+ final NetworkAgent naNoExtraInfo = new TestNetworkAgent(
+ mServiceContext, mCsHandlerThread.getLooper(), new NetworkAgentConfig());
+ naNoExtraInfo.register();
+ verify(mNetworkStack).makeNetworkMonitor(any(), isNull(String.class), any());
+ naNoExtraInfo.unregister();
+
+ reset(mNetworkStack);
+ final NetworkAgentConfig config =
+ new NetworkAgentConfig.Builder().setLegacyExtraInfo("legacyinfo").build();
+ final NetworkAgent naExtraInfo = new TestNetworkAgent(
+ mServiceContext, mCsHandlerThread.getLooper(), config);
+ naExtraInfo.register();
+ verify(mNetworkStack).makeNetworkMonitor(any(), eq("legacyinfo"), any());
+ naExtraInfo.unregister();
+ }
+
private void setupLocationPermissions(
int targetSdk, boolean locationToggle, String op, String perm) throws Exception {
final ApplicationInfo applicationInfo = new ApplicationInfo();