Loading Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -313,6 +313,7 @@ java_defaults { libs: [ "app-compat-annotations", "ext", "framework-connectivity-annotations", "framework-updatable-stubs-module_libs_api", "unsupportedappusage", ], Loading core/java/android/net/NetworkPolicyManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,8 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.Signature; import android.net.ConnectivityAnnotations.MultipathPreference; import android.net.ConnectivityAnnotations.RestrictBackgroundStatus; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiInfo; import android.os.Build; Loading Loading @@ -463,6 +465,7 @@ public class NetworkPolicyManager { */ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) @RequiresPermission(NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK) @RestrictBackgroundStatus public int getRestrictBackgroundStatus(int uid) { try { return mService.getRestrictBackgroundStatus(uid); Loading Loading @@ -588,6 +591,7 @@ public class NetworkPolicyManager { */ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) @RequiresPermission(NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK) @MultipathPreference public int getMultipathPreference(@NonNull Network network) { try { return mService.getMultipathPreference(network); Loading packages/Connectivity/framework/Android.bp +16 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,22 @@ filegroup { ], } java_library { name: "framework-connectivity-annotations", sdk_version: "module_current", srcs: [ "src/android/net/ConnectivityAnnotations.java", ], libs: [ "framework-annotations-lib", "framework-connectivity", ], visibility: [ "//frameworks/base:__subpackages__", "//packages/modules/Connectivity:__subpackages__", ], } java_sdk_library { name: "framework-connectivity", sdk_version: "module_current", Loading packages/Connectivity/framework/src/android/net/ConnectivityAnnotations.java 0 → 100644 +51 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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. */ package android.net; import android.annotation.IntDef; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Type annotations for constants used in the connectivity API surface. * * The annotations are maintained in a separate class so that it can be built as * a separate library that other modules can build against, as Typedef should not * be exposed as SystemApi. * * @hide */ public final class ConnectivityAnnotations { private ConnectivityAnnotations() {} @Retention(RetentionPolicy.SOURCE) @IntDef(flag = true, value = { ConnectivityManager.MULTIPATH_PREFERENCE_HANDOVER, ConnectivityManager.MULTIPATH_PREFERENCE_RELIABILITY, ConnectivityManager.MULTIPATH_PREFERENCE_PERFORMANCE, }) public @interface MultipathPreference {} @Retention(RetentionPolicy.SOURCE) @IntDef(flag = false, value = { ConnectivityManager.RESTRICT_BACKGROUND_STATUS_DISABLED, ConnectivityManager.RESTRICT_BACKGROUND_STATUS_WHITELISTED, ConnectivityManager.RESTRICT_BACKGROUND_STATUS_ENABLED, }) public @interface RestrictBackgroundStatus {} } packages/Connectivity/framework/src/android/net/ConnectivityManager.java +2 −20 Original line number Diff line number Diff line Loading @@ -40,6 +40,8 @@ import android.compat.annotation.UnsupportedAppUsage; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.net.ConnectivityAnnotations.MultipathPreference; import android.net.ConnectivityAnnotations.RestrictBackgroundStatus; import android.net.ConnectivityDiagnosticsManager.DataStallReport.DetectionMethod; import android.net.IpSecManager.UdpEncapsulationSocket; import android.net.SocketKeepalive.Callback; Loading Loading @@ -4799,16 +4801,6 @@ public class ConnectivityManager { MULTIPATH_PREFERENCE_RELIABILITY | MULTIPATH_PREFERENCE_PERFORMANCE; /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(flag = true, value = { MULTIPATH_PREFERENCE_HANDOVER, MULTIPATH_PREFERENCE_RELIABILITY, MULTIPATH_PREFERENCE_PERFORMANCE, }) public @interface MultipathPreference { } /** * Provides a hint to the calling application on whether it is desirable to use the * multinetwork APIs (e.g., {@link Network#openConnection}, {@link Network#bindSocket}, etc.) Loading Loading @@ -5030,16 +5022,6 @@ public class ConnectivityManager { public static final String ACTION_RESTRICT_BACKGROUND_CHANGED = "android.net.conn.RESTRICT_BACKGROUND_CHANGED"; /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(flag = false, value = { RESTRICT_BACKGROUND_STATUS_DISABLED, RESTRICT_BACKGROUND_STATUS_WHITELISTED, RESTRICT_BACKGROUND_STATUS_ENABLED, }) public @interface RestrictBackgroundStatus { } /** * Determines if the calling application is subject to metered network restrictions while * running on background. Loading Loading
Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -313,6 +313,7 @@ java_defaults { libs: [ "app-compat-annotations", "ext", "framework-connectivity-annotations", "framework-updatable-stubs-module_libs_api", "unsupportedappusage", ], Loading
core/java/android/net/NetworkPolicyManager.java +4 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,8 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.content.pm.Signature; import android.net.ConnectivityAnnotations.MultipathPreference; import android.net.ConnectivityAnnotations.RestrictBackgroundStatus; import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiInfo; import android.os.Build; Loading Loading @@ -463,6 +465,7 @@ public class NetworkPolicyManager { */ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) @RequiresPermission(NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK) @RestrictBackgroundStatus public int getRestrictBackgroundStatus(int uid) { try { return mService.getRestrictBackgroundStatus(uid); Loading Loading @@ -588,6 +591,7 @@ public class NetworkPolicyManager { */ @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES) @RequiresPermission(NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK) @MultipathPreference public int getMultipathPreference(@NonNull Network network) { try { return mService.getMultipathPreference(network); Loading
packages/Connectivity/framework/Android.bp +16 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,22 @@ filegroup { ], } java_library { name: "framework-connectivity-annotations", sdk_version: "module_current", srcs: [ "src/android/net/ConnectivityAnnotations.java", ], libs: [ "framework-annotations-lib", "framework-connectivity", ], visibility: [ "//frameworks/base:__subpackages__", "//packages/modules/Connectivity:__subpackages__", ], } java_sdk_library { name: "framework-connectivity", sdk_version: "module_current", Loading
packages/Connectivity/framework/src/android/net/ConnectivityAnnotations.java 0 → 100644 +51 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 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. */ package android.net; import android.annotation.IntDef; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Type annotations for constants used in the connectivity API surface. * * The annotations are maintained in a separate class so that it can be built as * a separate library that other modules can build against, as Typedef should not * be exposed as SystemApi. * * @hide */ public final class ConnectivityAnnotations { private ConnectivityAnnotations() {} @Retention(RetentionPolicy.SOURCE) @IntDef(flag = true, value = { ConnectivityManager.MULTIPATH_PREFERENCE_HANDOVER, ConnectivityManager.MULTIPATH_PREFERENCE_RELIABILITY, ConnectivityManager.MULTIPATH_PREFERENCE_PERFORMANCE, }) public @interface MultipathPreference {} @Retention(RetentionPolicy.SOURCE) @IntDef(flag = false, value = { ConnectivityManager.RESTRICT_BACKGROUND_STATUS_DISABLED, ConnectivityManager.RESTRICT_BACKGROUND_STATUS_WHITELISTED, ConnectivityManager.RESTRICT_BACKGROUND_STATUS_ENABLED, }) public @interface RestrictBackgroundStatus {} }
packages/Connectivity/framework/src/android/net/ConnectivityManager.java +2 −20 Original line number Diff line number Diff line Loading @@ -40,6 +40,8 @@ import android.compat.annotation.UnsupportedAppUsage; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.net.ConnectivityAnnotations.MultipathPreference; import android.net.ConnectivityAnnotations.RestrictBackgroundStatus; import android.net.ConnectivityDiagnosticsManager.DataStallReport.DetectionMethod; import android.net.IpSecManager.UdpEncapsulationSocket; import android.net.SocketKeepalive.Callback; Loading Loading @@ -4799,16 +4801,6 @@ public class ConnectivityManager { MULTIPATH_PREFERENCE_RELIABILITY | MULTIPATH_PREFERENCE_PERFORMANCE; /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(flag = true, value = { MULTIPATH_PREFERENCE_HANDOVER, MULTIPATH_PREFERENCE_RELIABILITY, MULTIPATH_PREFERENCE_PERFORMANCE, }) public @interface MultipathPreference { } /** * Provides a hint to the calling application on whether it is desirable to use the * multinetwork APIs (e.g., {@link Network#openConnection}, {@link Network#bindSocket}, etc.) Loading Loading @@ -5030,16 +5022,6 @@ public class ConnectivityManager { public static final String ACTION_RESTRICT_BACKGROUND_CHANGED = "android.net.conn.RESTRICT_BACKGROUND_CHANGED"; /** @hide */ @Retention(RetentionPolicy.SOURCE) @IntDef(flag = false, value = { RESTRICT_BACKGROUND_STATUS_DISABLED, RESTRICT_BACKGROUND_STATUS_WHITELISTED, RESTRICT_BACKGROUND_STATUS_ENABLED, }) public @interface RestrictBackgroundStatus { } /** * Determines if the calling application is subject to metered network restrictions while * running on background. Loading