Merge "Let docs tool to list the newly-visible IntDef values"
diff --git a/StubLibraries.bp b/StubLibraries.bp
index fef95e8..32101c7 100644
--- a/StubLibraries.bp
+++ b/StubLibraries.bp
@@ -208,6 +208,16 @@
/////////////////////////////////////////////////////////////////////
java_defaults {
+ name: "android.jar_defaults",
+ sdk_version: "none",
+ system_modules: "none",
+ java_version: "1.8",
+ compile_dex: true,
+ defaults_visibility: ["//visibility:private"],
+ visibility: ["//visibility:public"],
+}
+
+java_defaults {
name: "android-non-updatable_defaults_stubs_current",
libs: ["stub-annotations"],
static_libs: ["framework-res-package-jar"], // Export package of framework-res
diff --git a/cmds/app_process/Android.bp b/cmds/app_process/Android.bp
index 6a685a79..a157517 100644
--- a/cmds/app_process/Android.bp
+++ b/cmds/app_process/Android.bp
@@ -64,8 +64,6 @@
"libwilhelm",
],
- header_libs: ["bionic_libc_platform_headers"],
-
compile_multilib: "both",
cflags: [
diff --git a/cmds/app_process/app_main.cpp b/cmds/app_process/app_main.cpp
index 815f945..12083b6 100644
--- a/cmds/app_process/app_main.cpp
+++ b/cmds/app_process/app_main.cpp
@@ -15,7 +15,6 @@
#include <android-base/macros.h>
#include <binder/IPCThreadState.h>
-#include <bionic/pac.h>
#include <hwbinder/IPCThreadState.h>
#include <utils/Log.h>
#include <cutils/memory.h>
@@ -183,10 +182,6 @@
ALOGV("app_process main with argv: %s", argv_String.string());
}
- // Because of applications that are using PAC instructions incorrectly, PAC
- // is disabled in application processes for now.
- ScopedDisablePAC x;
-
AppRuntime runtime(argv[0], computeArgBlockSize(argc, argv));
// Process command line arguments
// ignore argv[0]
diff --git a/cmds/idmap2/Android.bp b/cmds/idmap2/Android.bp
index c202f6f..6ef6845 100644
--- a/cmds/idmap2/Android.bp
+++ b/cmds/idmap2/Android.bp
@@ -52,6 +52,7 @@
"-readability-braces-around-statements",
"-readability-const-return-type",
"-readability-convert-member-functions-to-static",
+ "-readability-duplicate-include",
"-readability-else-after-return",
"-readability-identifier-length",
"-readability-named-parameter",
diff --git a/cmds/svc/src/com/android/commands/svc/BluetoothCommand.java b/cmds/svc/src/com/android/commands/svc/BluetoothCommand.java
deleted file mode 100644
index b572ce2..0000000
--- a/cmds/svc/src/com/android/commands/svc/BluetoothCommand.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2017 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 com.android.commands.svc;
-
-import android.bluetooth.BluetoothAdapter;
-import android.os.RemoteException;
-
-public class BluetoothCommand extends Svc.Command {
-
- public BluetoothCommand() {
- super("bluetooth");
- }
-
- @Override
- public String shortHelp() {
- return "Control Bluetooth service";
- }
-
- @Override
- public String longHelp() {
- return shortHelp() + "\n"
- + "\n"
- + "usage: svc bluetooth [enable|disable]\n"
- + " Turn Bluetooth on or off.\n\n";
- }
-
- @Override
- public void run(String[] args) {
- BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
-
- if (adapter == null) {
- System.err.println("Got a null BluetoothAdapter, is the system running?");
- return;
- }
-
- if (args.length == 2 && "enable".equals(args[1])) {
- adapter.enable();
- } else if (args.length == 2 && "disable".equals(args[1])) {
- adapter.disable();
- } else {
- System.err.println(longHelp());
- }
- }
-}
diff --git a/cmds/svc/src/com/android/commands/svc/Svc.java b/cmds/svc/src/com/android/commands/svc/Svc.java
index 2ed2678..bbad984 100644
--- a/cmds/svc/src/com/android/commands/svc/Svc.java
+++ b/cmds/svc/src/com/android/commands/svc/Svc.java
@@ -96,7 +96,7 @@
// `svc wifi` has been migrated to WifiShellCommand
new UsbCommand(),
new NfcCommand(),
- new BluetoothCommand(),
+ // `svc bluetooth` has been migrated to BluetoothShellCommand
new SystemServerCommand(),
};
}
diff --git a/cmds/svc/svc b/cmds/svc/svc
index 95265e8..a2c9de3 100755
--- a/cmds/svc/svc
+++ b/cmds/svc/svc
@@ -33,6 +33,25 @@
exit 1
fi
+# `svc bluetooth` has been migrated to BluetoothShellCommand,
+# simply perform translation to `cmd bluetooth set-bluetooth-enabled` here.
+if [ "x$1" == "xbluetooth" ]; then
+ # `cmd wifi` by convention uses enabled/disabled
+ # instead of enable/disable
+ if [ "x$2" == "xenable" ]; then
+ exec cmd bluetooth_manager enable
+ elif [ "x$2" == "xdisable" ]; then
+ exec cmd bluetooth_manager disable
+ else
+ echo "Control the Bluetooth manager"
+ echo ""
+ echo "usage: svc bluetooth [enable|disable]"
+ echo " Turn Bluetooth on or off."
+ echo ""
+ fi
+ exit 1
+fi
+
export CLASSPATH=/system/framework/svc.jar
exec app_process /system/bin com.android.commands.svc.Svc "$@"
diff --git a/core/api/current.txt b/core/api/current.txt
index dbc2a51..8337cb6 100644
--- a/core/api/current.txt
+++ b/core/api/current.txt
@@ -7192,7 +7192,7 @@
method @Nullable public java.util.List<java.lang.String> getPermittedCrossProfileNotificationListeners(@NonNull android.content.ComponentName);
method @Nullable public java.util.List<java.lang.String> getPermittedInputMethods(@NonNull android.content.ComponentName);
method public int getPersonalAppsSuspendedReasons(@NonNull android.content.ComponentName);
- method @NonNull public android.app.admin.PreferentialNetworkServiceConfig getPreferentialNetworkServiceConfig();
+ method @NonNull public java.util.List<android.app.admin.PreferentialNetworkServiceConfig> getPreferentialNetworkServiceConfigs();
method public int getRequiredPasswordComplexity();
method public long getRequiredStrongAuthTimeout(@Nullable android.content.ComponentName);
method public boolean getScreenCaptureDisabled(@Nullable android.content.ComponentName);
@@ -7335,7 +7335,7 @@
method public boolean setPermittedCrossProfileNotificationListeners(@NonNull android.content.ComponentName, @Nullable java.util.List<java.lang.String>);
method public boolean setPermittedInputMethods(@NonNull android.content.ComponentName, java.util.List<java.lang.String>);
method public void setPersonalAppsSuspended(@NonNull android.content.ComponentName, boolean);
- method public void setPreferentialNetworkServiceConfig(@NonNull android.app.admin.PreferentialNetworkServiceConfig);
+ method public void setPreferentialNetworkServiceConfigs(@NonNull java.util.List<android.app.admin.PreferentialNetworkServiceConfig>);
method public void setPreferentialNetworkServiceEnabled(boolean);
method public void setProfileEnabled(@NonNull android.content.ComponentName);
method public void setProfileName(@NonNull android.content.ComponentName, String);
@@ -30532,6 +30532,7 @@
method public static final boolean is64Bit();
method public static boolean isApplicationUid(int);
method public static final boolean isIsolated();
+ method public static final boolean isSdkSandbox();
method public static final void killProcess(int);
method public static final int myPid();
method public static final int myTid();
@@ -41759,9 +41760,12 @@
field public static final int DATA_DISCONNECTED = 0; // 0x0
field public static final int DATA_DISCONNECTING = 4; // 0x4
field public static final int DATA_ENABLED_REASON_CARRIER = 2; // 0x2
+ field public static final int DATA_ENABLED_REASON_OVERRIDE = 4; // 0x4
field public static final int DATA_ENABLED_REASON_POLICY = 1; // 0x1
field public static final int DATA_ENABLED_REASON_THERMAL = 3; // 0x3
+ field public static final int DATA_ENABLED_REASON_UNKNOWN = -1; // 0xffffffff
field public static final int DATA_ENABLED_REASON_USER = 0; // 0x0
+ field public static final int DATA_HANDOVER_IN_PROGRESS = 5; // 0x5
field public static final int DATA_SUSPENDED = 3; // 0x3
field public static final int DATA_UNKNOWN = -1; // 0xffffffff
field public static final int ERI_FLASH = 2; // 0x2
@@ -42030,6 +42034,8 @@
method public String getMmsProxyAddressAsString();
method public int getMmsProxyPort();
method public android.net.Uri getMmsc();
+ method public int getMtuV4();
+ method public int getMtuV6();
method public int getMvnoType();
method public int getNetworkTypeBitmask();
method public String getOperatorNumeric();
@@ -42062,6 +42068,7 @@
field public static final int TYPE_DEFAULT = 17; // 0x11
field public static final int TYPE_DUN = 8; // 0x8
field public static final int TYPE_EMERGENCY = 512; // 0x200
+ field public static final int TYPE_ENTERPRISE = 16384; // 0x4000
field public static final int TYPE_FOTA = 32; // 0x20
field public static final int TYPE_HIPRI = 16; // 0x10
field public static final int TYPE_IA = 256; // 0x100
@@ -42086,10 +42093,14 @@
method @NonNull public android.telephony.data.ApnSetting.Builder setMmsProxyAddress(@Nullable String);
method @NonNull public android.telephony.data.ApnSetting.Builder setMmsProxyPort(int);
method @NonNull public android.telephony.data.ApnSetting.Builder setMmsc(@Nullable android.net.Uri);
+ method @NonNull public android.telephony.data.ApnSetting.Builder setMtuV4(int);
+ method @NonNull public android.telephony.data.ApnSetting.Builder setMtuV6(int);
method @NonNull public android.telephony.data.ApnSetting.Builder setMvnoType(int);
method @NonNull public android.telephony.data.ApnSetting.Builder setNetworkTypeBitmask(int);
method @NonNull public android.telephony.data.ApnSetting.Builder setOperatorNumeric(@Nullable String);
method @NonNull public android.telephony.data.ApnSetting.Builder setPassword(@Nullable String);
+ method @NonNull public android.telephony.data.ApnSetting.Builder setPersistent(boolean);
+ method @NonNull public android.telephony.data.ApnSetting.Builder setProfileId(int);
method @NonNull public android.telephony.data.ApnSetting.Builder setProtocol(int);
method @Deprecated public android.telephony.data.ApnSetting.Builder setProxyAddress(java.net.InetAddress);
method @NonNull public android.telephony.data.ApnSetting.Builder setProxyAddress(@Nullable String);
diff --git a/core/api/module-lib-current.txt b/core/api/module-lib-current.txt
index a9f0d2e..a6278f8 100644
--- a/core/api/module-lib-current.txt
+++ b/core/api/module-lib-current.txt
@@ -290,6 +290,9 @@
}
public class Process {
+ method public static final int getAppUidForSdkSandboxUid(int);
+ method public static final boolean isSdkSandboxUid(int);
+ method public static final int toSdkSandboxUid(int);
field public static final int NFC_UID = 1027; // 0x403
field public static final int VPN_UID = 1016; // 0x3f8
}
diff --git a/core/api/system-current.txt b/core/api/system-current.txt
index 80ee1a5..bb9af14 100644
--- a/core/api/system-current.txt
+++ b/core/api/system-current.txt
@@ -7089,7 +7089,7 @@
public final class EthernetNetworkUpdateRequest implements android.os.Parcelable {
method public int describeContents();
method @NonNull public android.net.IpConfiguration getIpConfiguration();
- method @NonNull public android.net.NetworkCapabilities getNetworkCapabilities();
+ method @Nullable public android.net.NetworkCapabilities getNetworkCapabilities();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.net.EthernetNetworkUpdateRequest> CREATOR;
}
@@ -7099,7 +7099,7 @@
ctor public EthernetNetworkUpdateRequest.Builder(@NonNull android.net.EthernetNetworkUpdateRequest);
method @NonNull public android.net.EthernetNetworkUpdateRequest build();
method @NonNull public android.net.EthernetNetworkUpdateRequest.Builder setIpConfiguration(@NonNull android.net.IpConfiguration);
- method @NonNull public android.net.EthernetNetworkUpdateRequest.Builder setNetworkCapabilities(@NonNull android.net.NetworkCapabilities);
+ method @NonNull public android.net.EthernetNetworkUpdateRequest.Builder setNetworkCapabilities(@Nullable android.net.NetworkCapabilities);
}
public final class MatchAllNetworkSpecifier extends android.net.NetworkSpecifier implements android.os.Parcelable {
@@ -11999,6 +11999,7 @@
field public static final String TYPE_DEFAULT_STRING = "default";
field public static final String TYPE_DUN_STRING = "dun";
field public static final String TYPE_EMERGENCY_STRING = "emergency";
+ field public static final String TYPE_ENTERPRISE_STRING = "enterprise";
field public static final String TYPE_FOTA_STRING = "fota";
field public static final String TYPE_HIPRI_STRING = "hipri";
field public static final String TYPE_IA_STRING = "ia";
@@ -12070,21 +12071,23 @@
public final class DataProfile implements android.os.Parcelable {
method public int describeContents();
- method @NonNull public String getApn();
- method public int getAuthType();
- method public int getBearerBitmask();
+ method @Deprecated @NonNull public String getApn();
+ method @Nullable public android.telephony.data.ApnSetting getApnSetting();
+ method @Deprecated public int getAuthType();
+ method @Deprecated public int getBearerBitmask();
method @Deprecated public int getMtu();
- method public int getMtuV4();
- method public int getMtuV6();
- method @Nullable public String getPassword();
- method public int getProfileId();
- method public int getProtocolType();
- method public int getRoamingProtocolType();
- method public int getSupportedApnTypesBitmask();
+ method @Deprecated public int getMtuV4();
+ method @Deprecated public int getMtuV6();
+ method @Deprecated @Nullable public String getPassword();
+ method @Deprecated public int getProfileId();
+ method @Deprecated public int getProtocolType();
+ method @Deprecated public int getRoamingProtocolType();
+ method @Deprecated public int getSupportedApnTypesBitmask();
+ method @Nullable public android.telephony.data.TrafficDescriptor getTrafficDescriptor();
method public int getType();
- method @Nullable public String getUserName();
+ method @Deprecated @Nullable public String getUserName();
method public boolean isEnabled();
- method public boolean isPersistent();
+ method @Deprecated public boolean isPersistent();
method public boolean isPreferred();
method public void writeToParcel(android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.DataProfile> CREATOR;
@@ -12097,21 +12100,23 @@
ctor public DataProfile.Builder();
method @NonNull public android.telephony.data.DataProfile build();
method @NonNull public android.telephony.data.DataProfile.Builder enable(boolean);
- method @NonNull public android.telephony.data.DataProfile.Builder setApn(@NonNull String);
- method @NonNull public android.telephony.data.DataProfile.Builder setAuthType(int);
- method @NonNull public android.telephony.data.DataProfile.Builder setBearerBitmask(int);
+ method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setApn(@NonNull String);
+ method @NonNull public android.telephony.data.DataProfile.Builder setApnSetting(@NonNull android.telephony.data.ApnSetting);
+ method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setAuthType(int);
+ method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setBearerBitmask(int);
method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setMtu(int);
- method @NonNull public android.telephony.data.DataProfile.Builder setMtuV4(int);
- method @NonNull public android.telephony.data.DataProfile.Builder setMtuV6(int);
- method @NonNull public android.telephony.data.DataProfile.Builder setPassword(@NonNull String);
- method @NonNull public android.telephony.data.DataProfile.Builder setPersistent(boolean);
+ method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setMtuV4(int);
+ method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setMtuV6(int);
+ method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setPassword(@NonNull String);
+ method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setPersistent(boolean);
method @NonNull public android.telephony.data.DataProfile.Builder setPreferred(boolean);
- method @NonNull public android.telephony.data.DataProfile.Builder setProfileId(int);
- method @NonNull public android.telephony.data.DataProfile.Builder setProtocolType(int);
- method @NonNull public android.telephony.data.DataProfile.Builder setRoamingProtocolType(int);
- method @NonNull public android.telephony.data.DataProfile.Builder setSupportedApnTypesBitmask(int);
+ method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setProfileId(int);
+ method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setProtocolType(int);
+ method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setRoamingProtocolType(int);
+ method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setSupportedApnTypesBitmask(int);
+ method @NonNull public android.telephony.data.DataProfile.Builder setTrafficDescriptor(@NonNull android.telephony.data.TrafficDescriptor);
method @NonNull public android.telephony.data.DataProfile.Builder setType(int);
- method @NonNull public android.telephony.data.DataProfile.Builder setUserName(@NonNull String);
+ method @Deprecated @NonNull public android.telephony.data.DataProfile.Builder setUserName(@NonNull String);
}
public abstract class DataService extends android.app.Service {
diff --git a/core/api/test-current.txt b/core/api/test-current.txt
index 00dcb6f..6b588f9 100644
--- a/core/api/test-current.txt
+++ b/core/api/test-current.txt
@@ -1716,7 +1716,10 @@
}
public class Process {
+ method public static final int getAppUidForSdkSandboxUid(int);
method public static final int getThreadScheduler(int) throws java.lang.IllegalArgumentException;
+ method public static final boolean isSdkSandboxUid(int);
+ method public static final int toSdkSandboxUid(int);
field public static final int FIRST_APP_ZYGOTE_ISOLATED_UID = 90000; // 0x15f90
field public static final int FIRST_ISOLATED_UID = 99000; // 0x182b8
field public static final int LAST_APP_ZYGOTE_ISOLATED_UID = 98999; // 0x182b7
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 550d1d8..067c135 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -16,6 +16,8 @@
package android.app.admin;
+import static android.net.NetworkCapabilities.NET_ENTERPRISE_ID_1;
+
import static com.android.internal.util.function.pooled.PooledLambda.obtainMessage;
import android.Manifest.permission;
@@ -10266,7 +10268,7 @@
}
/**
- * Sets whether preferential network service is enabled on the work profile.
+ * Sets whether preferential network service is enabled.
* For example, an organization can have a deal/agreement with a carrier that all of
* the work data from its employees’ devices will be sent via a network service dedicated
* for enterprise use.
@@ -10274,75 +10276,72 @@
* An example of a supported preferential network service is the Enterprise
* slice on 5G networks.
*
- * By default, preferential network service is disabled on the work profile on supported
- * carriers and devices. Admins can explicitly enable it with this API.
- * On fully-managed devices this method is unsupported because all traffic is considered
- * work traffic.
+ * By default, preferential network service is disabled on the work profile and
+ * fully managed devices, on supported carriers and devices.
+ * Admins can explicitly enable it with this API.
*
* <p> This method enables preferential network service with a default configuration.
- * To fine-tune the configuration, use {@link #setPreferentialNetworkServiceConfig) instead.
+ * To fine-tune the configuration, use {@link #setPreferentialNetworkServiceConfigs) instead.
+ * <p> Before Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}:
+ * this method can be called by the profile owner of a managed profile.
+ * <p> Starting from Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}:
+ * This method can be called by the profile owner of a managed profile
+ * or device owner.
*
- * <p>This method can only be called by the profile owner of a managed profile.
* @param enabled whether preferential network service should be enabled.
- * @throws SecurityException if the caller is not the profile owner.
+ * @throws SecurityException if the caller is not the profile owner or device owner.
**/
public void setPreferentialNetworkServiceEnabled(boolean enabled) {
throwIfParentInstance("setPreferentialNetworkServiceEnabled");
- if (mService == null) {
- return;
+ PreferentialNetworkServiceConfig.Builder configBuilder =
+ new PreferentialNetworkServiceConfig.Builder();
+ configBuilder.setEnabled(enabled);
+ if (enabled) {
+ configBuilder.setNetworkId(NET_ENTERPRISE_ID_1);
}
-
- try {
- mService.setPreferentialNetworkServiceEnabled(enabled);
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
+ setPreferentialNetworkServiceConfigs(List.of(configBuilder.build()));
}
/**
* Indicates whether preferential network service is enabled.
*
- * <p>This method can be called by the profile owner of a managed profile.
+ * <p> Before Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}:
+ * This method can be called by the profile owner of a managed profile.
+ * <p> Starting from Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}:
+ * This method can be called by the profile owner of a managed profile
+ * or device owner.
*
* @return whether preferential network service is enabled.
- * @throws SecurityException if the caller is not the profile owner.
+ * @throws SecurityException if the caller is not the profile owner or device owner.
*/
public boolean isPreferentialNetworkServiceEnabled() {
throwIfParentInstance("isPreferentialNetworkServiceEnabled");
- if (mService == null) {
- return false;
- }
- try {
- return mService.isPreferentialNetworkServiceEnabled(myUserId());
- } catch (RemoteException e) {
- throw e.rethrowFromSystemServer();
- }
+ return getPreferentialNetworkServiceConfigs().stream().anyMatch(c -> c.isEnabled());
}
/**
- * Sets preferential network configuration on the work profile.
+ * Sets preferential network configurations.
* {@see PreferentialNetworkServiceConfig}
*
* An example of a supported preferential network service is the Enterprise
* slice on 5G networks.
*
- * By default, preferential network service is disabled on the work profile on supported
- * carriers and devices. Admins can explicitly enable it with this API.
- * On fully-managed devices this method is unsupported because all traffic is considered
- * work traffic.
+ * By default, preferential network service is disabled on the work profile and fully managed
+ * devices, on supported carriers and devices. Admins can explicitly enable it with this API.
+ * If admin wants to have multiple enterprise slices,
+ * it can be configured by passing list of {@link PreferentialNetworkServiceConfig} objects.
*
- * <p>This method can only be called by the profile owner of a managed profile.
- * @param preferentialNetworkServiceConfig preferential network configuration.
- * @throws SecurityException if the caller is not the profile owner.
+ * @param preferentialNetworkServiceConfigs list of preferential network configurations.
+ * @throws SecurityException if the caller is not the profile owner or device owner.
**/
- public void setPreferentialNetworkServiceConfig(
- @NonNull PreferentialNetworkServiceConfig preferentialNetworkServiceConfig) {
- throwIfParentInstance("setPreferentialNetworkServiceConfig");
+ public void setPreferentialNetworkServiceConfigs(
+ @NonNull List<PreferentialNetworkServiceConfig> preferentialNetworkServiceConfigs) {
+ throwIfParentInstance("setPreferentialNetworkServiceConfigs");
if (mService == null) {
return;
}
try {
- mService.setPreferentialNetworkServiceConfig(preferentialNetworkServiceConfig);
+ mService.setPreferentialNetworkServiceConfigs(preferentialNetworkServiceConfigs);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -10352,18 +10351,16 @@
* Get preferential network configuration
* {@see PreferentialNetworkServiceConfig}
*
- * <p>This method can be called by the profile owner of a managed profile.
- *
* @return preferential network configuration.
- * @throws SecurityException if the caller is not the profile owner.
+ * @throws SecurityException if the caller is not the profile owner or device owner.
*/
- public @NonNull PreferentialNetworkServiceConfig getPreferentialNetworkServiceConfig() {
- throwIfParentInstance("getPreferentialNetworkServiceConfig");
+ public @NonNull List<PreferentialNetworkServiceConfig> getPreferentialNetworkServiceConfigs() {
+ throwIfParentInstance("getPreferentialNetworkServiceConfigs");
if (mService == null) {
- return PreferentialNetworkServiceConfig.DEFAULT;
+ return List.of(PreferentialNetworkServiceConfig.DEFAULT);
}
try {
- return mService.getPreferentialNetworkServiceConfig();
+ return mService.getPreferentialNetworkServiceConfigs();
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -12807,13 +12804,18 @@
}
/**
- * Called by device owner to add an override APN.
+ * Called by device owner or profile owner to add an override APN.
*
* <p>This method may returns {@code -1} if {@code apnSetting} conflicts with an existing
* override APN. Update the existing conflicted APN with
* {@link #updateOverrideApn(ComponentName, int, ApnSetting)} instead of adding a new entry.
* <p>Two override APNs are considered to conflict when all the following APIs return
* the same values on both override APNs:
+ * <p> Before Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}:
+ * Only device owners can add APNs.
+ * <p> Starting from Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}:
+ * Device and profile owners can add enterprise APNs
+ * ({@link ApnSetting#TYPE_ENTERPRISE}), while only device owners can add other type of APNs.
* <ul>
* <li>{@link ApnSetting#getOperatorNumeric()}</li>
* <li>{@link ApnSetting#getApnName()}</li>
@@ -12832,7 +12834,8 @@
* @param apnSetting the override APN to insert
* @return The {@code id} of inserted override APN. Or {@code -1} when failed to insert into
* the database.
- * @throws SecurityException if {@code admin} is not a device owner.
+ * @throws SecurityException If request is for enterprise APN {@code admin} is either device
+ * owner or profile owner and in all other types of APN if {@code admin} is not a device owner.
*
* @see #setOverrideApnsEnabled(ComponentName, boolean)
*/
@@ -12849,20 +12852,26 @@
}
/**
- * Called by device owner to update an override APN.
+ * Called by device owner or profile owner to update an override APN.
*
* <p>This method may returns {@code false} if there is no override APN with the given
* {@code apnId}.
* <p>This method may also returns {@code false} if {@code apnSetting} conflicts with an
* existing override APN. Update the existing conflicted APN instead.
* <p>See {@link #addOverrideApn} for the definition of conflict.
+ * <p> Before Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}:
+ * Only device owners can update APNs.
+ * <p> Starting from Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}:
+ * Device and profile owners can update enterprise APNs
+ * ({@link ApnSetting#TYPE_ENTERPRISE}), while only device owners can update other type of APNs.
*
* @param admin which {@link DeviceAdminReceiver} this request is associated with
* @param apnId the {@code id} of the override APN to update
* @param apnSetting the override APN to update
* @return {@code true} if the required override APN is successfully updated,
* {@code false} otherwise.
- * @throws SecurityException if {@code admin} is not a device owner.
+ * @throws SecurityException If request is for enterprise APN {@code admin} is either device
+ * owner or profile owner and in all other types of APN if {@code admin} is not a device owner.
*
* @see #setOverrideApnsEnabled(ComponentName, boolean)
*/
@@ -12880,16 +12889,22 @@
}
/**
- * Called by device owner to remove an override APN.
+ * Called by device owner or profile owner to remove an override APN.
*
* <p>This method may returns {@code false} if there is no override APN with the given
* {@code apnId}.
+ * <p> Before Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}:
+ * Only device owners can remove APNs.
+ * <p> Starting from Android version {@link android.os.Build.VERSION_CODES#TIRAMISU}:
+ * Device and profile owners can remove enterprise APNs
+ * ({@link ApnSetting#TYPE_ENTERPRISE}), while only device owners can remove other type of APNs.
*
* @param admin which {@link DeviceAdminReceiver} this request is associated with
* @param apnId the {@code id} of the override APN to remove
* @return {@code true} if the required override APN is successfully removed, {@code false}
* otherwise.
- * @throws SecurityException if {@code admin} is not a device owner.
+ * @throws SecurityException If request is for enterprise APN {@code admin} is either device
+ * owner or profile owner and in all other types of APN if {@code admin} is not a device owner.
*
* @see #setOverrideApnsEnabled(ComponentName, boolean)
*/
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index 7ad8379..765c8cb 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -278,12 +278,9 @@
void setSecondaryLockscreenEnabled(in ComponentName who, boolean enabled);
boolean isSecondaryLockscreenEnabled(in UserHandle userHandle);
- void setPreferentialNetworkServiceEnabled(in boolean enabled);
- boolean isPreferentialNetworkServiceEnabled(int userHandle);
-
- void setPreferentialNetworkServiceConfig(
- in PreferentialNetworkServiceConfig preferentialNetworkServiceConfig);
- PreferentialNetworkServiceConfig getPreferentialNetworkServiceConfig();
+ void setPreferentialNetworkServiceConfigs(
+ in List<PreferentialNetworkServiceConfig> preferentialNetworkServiceConfigs);
+ List<PreferentialNetworkServiceConfig> getPreferentialNetworkServiceConfigs();
void setLockTaskPackages(in ComponentName who, in String[] packages);
String[] getLockTaskPackages(in ComponentName who);
diff --git a/core/java/android/app/admin/PreferentialNetworkServiceConfig.java b/core/java/android/app/admin/PreferentialNetworkServiceConfig.java
index 2849139..54170a2 100644
--- a/core/java/android/app/admin/PreferentialNetworkServiceConfig.java
+++ b/core/java/android/app/admin/PreferentialNetworkServiceConfig.java
@@ -28,7 +28,7 @@
/**
* Network configuration to be set for the user profile
- * {@see DevicePolicyManager#setPreferentialNetworkServiceConfig}.
+ * {@see DevicePolicyManager#setPreferentialNetworkServiceConfigs}.
*/
public final class PreferentialNetworkServiceConfig implements Parcelable {
final boolean mIsEnabled;
@@ -147,8 +147,6 @@
/**
* @return preference enterprise identifier.
- * valid values starts from
- * {@link #PREFERENTIAL_NETWORK_ID_1} to {@link #PREFERENTIAL_NETWORK_ID_5}.
* preference identifier is applicable only if preference network service is enabled
*
*/
@@ -286,8 +284,6 @@
/**
* Set the preferential network identifier.
- * Valid values starts from {@link #PREFERENTIAL_NETWORK_ID_1} to
- * {@link #PREFERENTIAL_NETWORK_ID_5}.
* preference identifier is applicable only if preferential network service is enabled.
* @param preferenceId preference Id
* @return The builder to facilitate chaining.
diff --git a/core/java/android/os/Bundle.java b/core/java/android/os/Bundle.java
index a19b51b..cf28c16 100644
--- a/core/java/android/os/Bundle.java
+++ b/core/java/android/os/Bundle.java
@@ -989,7 +989,7 @@
* Otherwise, this method might throw an exception or return {@code null}.
*
* @param key a String, or {@code null}
- * @param clazz The type of the items inside the array
+ * @param clazz The type of the items inside the array. This is only verified when unparceling.
* @return a Parcelable[] value, or {@code null}
*/
@SuppressLint({"ArrayReturn", "NullableCollection"})
@@ -1053,7 +1053,8 @@
* Otherwise, this method might throw an exception or return {@code null}.
*
* @param key a String, or {@code null}
- * @param clazz The type of the items inside the array list
+ * @param clazz The type of the items inside the array list. This is only verified when
+ * unparceling.
* @return an ArrayList<T> value, or {@code null}
*/
@SuppressLint("NullableCollection")
@@ -1103,6 +1104,8 @@
* </ul>
*
* @param key a String, or null
+ * @param clazz The type of the items inside the sparse array. This is only verified when
+ * unparceling.
* @return a SparseArray of T values, or null
*/
@SuppressWarnings("unchecked")
diff --git a/core/java/android/os/IBinder.java b/core/java/android/os/IBinder.java
index 010459d..9e47a70 100644
--- a/core/java/android/os/IBinder.java
+++ b/core/java/android/os/IBinder.java
@@ -293,7 +293,10 @@
*
* @return Returns the result from {@link Binder#onTransact}. A successful call
* generally returns true; false generally means the transaction code was not
- * understood.
+ * understood. For a oneway call to a different process false should never be
+ * returned. If a oneway call is made to code in the same process (usually to
+ * a C++ or Rust implementation), then there are no oneway semantics, and
+ * false can still be returned.
*/
public boolean transact(int code, @NonNull Parcel data, @Nullable Parcel reply, int flags)
throws RemoteException;
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index 2030571..a5395bdf 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -277,6 +277,26 @@
public static final int LAST_APPLICATION_UID = 19999;
/**
+ * Defines the start of a range of UIDs going from this number to
+ * {@link #LAST_SDK_SANDBOX_UID} that are reserved for assigning to
+ * sdk sandbox processes. There is a 1-1 mapping between a sdk sandbox
+ * process UID and the app that it belongs to, which can be computed by
+ * subtracting (FIRST_SDK_SANDBOX_UID - FIRST_APPLICATION_UID) from the
+ * uid of a sdk sandbox process.
+ *
+ * Note that there are no GIDs associated with these processes; storage
+ * attribution for them will be done using project IDs.
+ * @hide
+ */
+ public static final int FIRST_SDK_SANDBOX_UID = 20000;
+
+ /**
+ * Last UID that is used for sdk sandbox processes.
+ * @hide
+ */
+ public static final int LAST_SDK_SANDBOX_UID = 29999;
+
+ /**
* First uid used for fully isolated sandboxed processes spawned from an app zygote
* @hide
*/
@@ -351,7 +371,7 @@
* ** Keep in sync with utils/threads.h **
* ***************************************
*/
-
+
/**
* Lowest available thread priority. Only for those who really, really
* don't want to run if anything else is happening.
@@ -360,7 +380,7 @@
* {@link java.lang.Thread} class.
*/
public static final int THREAD_PRIORITY_LOWEST = 19;
-
+
/**
* Standard priority background threads. This gives your thread a slightly
* lower than normal priority, so that it will have less chance of impacting
@@ -370,7 +390,7 @@
* {@link java.lang.Thread} class.
*/
public static final int THREAD_PRIORITY_BACKGROUND = 10;
-
+
/**
* Standard priority of threads that are currently running a user interface
* that the user is interacting with. Applications can not normally
@@ -381,7 +401,7 @@
* {@link java.lang.Thread} class.
*/
public static final int THREAD_PRIORITY_FOREGROUND = -2;
-
+
/**
* Standard priority of system display threads, involved in updating
* the user interface. Applications can not
@@ -391,7 +411,7 @@
* {@link java.lang.Thread} class.
*/
public static final int THREAD_PRIORITY_DISPLAY = -4;
-
+
/**
* Standard priority of the most important display threads, for compositing
* the screen and retrieving input events. Applications can not normally
@@ -608,19 +628,19 @@
/**
* Start a new process.
- *
+ *
* <p>If processes are enabled, a new process is created and the
* static main() function of a <var>processClass</var> is executed there.
* The process will continue running after this function returns.
- *
+ *
* <p>If processes are not enabled, a new thread in the caller's
* process is created and main() of <var>processClass</var> called there.
- *
+ *
* <p>The niceName parameter, if not an empty string, is a custom name to
* give to the process instead of using processClass. This allows you to
* make easily identifyable processes even if you are using the same base
* <var>processClass</var> to start them.
- *
+ *
* When invokeWith is not null, the process will be started as a fresh app
* and not a zygote fork. Note that this is only allowed for uid 0 or when
* runtimeFlags contains DEBUG_ENABLE_DEBUGGER.
@@ -822,12 +842,55 @@
}
/**
+ * Returns whether the provided UID belongs to a SDK sandbox process.
+ *
+ * @hide
+ */
+ @SystemApi(client = MODULE_LIBRARIES)
+ @TestApi
+ public static final boolean isSdkSandboxUid(int uid) {
+ uid = UserHandle.getAppId(uid);
+ return (uid >= FIRST_SDK_SANDBOX_UID && uid <= LAST_SDK_SANDBOX_UID);
+ }
+
+ /**
+ *
+ * Returns the app process corresponding to an sdk sandbox process.
+ *
+ * @hide
+ */
+ @SystemApi(client = MODULE_LIBRARIES)
+ @TestApi
+ public static final int getAppUidForSdkSandboxUid(int uid) {
+ return uid - (FIRST_SDK_SANDBOX_UID - FIRST_APPLICATION_UID);
+ }
+
+ /**
+ *
+ * Returns the sdk sandbox process corresponding to an app process.
+ *
+ * @hide
+ */
+ @SystemApi(client = MODULE_LIBRARIES)
+ @TestApi
+ public static final int toSdkSandboxUid(int uid) {
+ return uid + (FIRST_SDK_SANDBOX_UID - FIRST_APPLICATION_UID);
+ }
+
+ /**
+ * Returns whether the current process is a sdk sandbox process.
+ */
+ public static final boolean isSdkSandbox() {
+ return isSdkSandboxUid(myUid());
+ }
+
+ /**
* Returns the UID assigned to a particular user name, or -1 if there is
* none. If the given string consists of only numbers, it is converted
* directly to a uid.
*/
public static final native int getUidForName(String name);
-
+
/**
* Returns the GID assigned to a particular user name, or -1 if there is
* none. If the given string consists of only numbers, it is converted
@@ -882,11 +945,11 @@
/**
* Set the priority of a thread, based on Linux priorities.
- *
+ *
* @param tid The identifier of the thread/process to change.
* @param priority A Linux priority level, from -20 for highest scheduling
* priority to 19 for lowest scheduling priority.
- *
+ *
* @throws IllegalArgumentException Throws IllegalArgumentException if
* <var>tid</var> does not exist.
* @throws SecurityException Throws SecurityException if your process does
@@ -945,7 +1008,7 @@
* @hide
* @param pid The identifier of the process to change.
* @param group The target group for this process from THREAD_GROUP_*.
- *
+ *
* @throws IllegalArgumentException Throws IllegalArgumentException if
* <var>tid</var> does not exist.
* @throws SecurityException Throws SecurityException if your process does
@@ -1034,37 +1097,37 @@
/**
* Set the priority of the calling thread, based on Linux priorities. See
* {@link #setThreadPriority(int, int)} for more information.
- *
+ *
* @param priority A Linux priority level, from -20 for highest scheduling
* priority to 19 for lowest scheduling priority.
- *
+ *
* @throws IllegalArgumentException Throws IllegalArgumentException if
* <var>tid</var> does not exist.
* @throws SecurityException Throws SecurityException if your process does
* not have permission to modify the given thread, or to use the given
* priority.
- *
+ *
* @see #setThreadPriority(int, int)
*/
public static final native void setThreadPriority(int priority)
throws IllegalArgumentException, SecurityException;
-
+
/**
* Return the current priority of a thread, based on Linux priorities.
- *
+ *
* @param tid The identifier of the thread/process. If tid equals zero, the priority of the
* calling process/thread will be returned.
- *
+ *
* @return Returns the current priority, as a Linux priority level,
* from -20 for highest scheduling priority to 19 for lowest scheduling
* priority.
- *
+ *
* @throws IllegalArgumentException Throws IllegalArgumentException if
* <var>tid</var> does not exist.
*/
public static final native int getThreadPriority(int tid)
throws IllegalArgumentException;
-
+
/**
* Return the current scheduling policy of a thread, based on Linux.
*
@@ -1078,7 +1141,7 @@
*
* {@hide}
*/
-
+
@TestApi
public static final native int getThreadScheduler(int tid)
throws IllegalArgumentException;
@@ -1104,7 +1167,7 @@
/**
* Determine whether the current environment supports multiple processes.
- *
+ *
* @return Returns true if the system can run in multiple processes, else
* false if everything is running in a single process.
*
@@ -1131,9 +1194,9 @@
/**
* Change this process's argv[0] parameter. This can be useful to show
* more descriptive information in things like the 'ps' command.
- *
+ *
* @param text The new name of this process.
- *
+ *
* {@hide}
*/
@UnsupportedAppUsage
@@ -1162,12 +1225,12 @@
/**
* Send a signal to the given process.
- *
+ *
* @param pid The pid of the target process.
* @param signal The signal to send.
*/
public static final native void sendSignal(int pid, int signal);
-
+
/**
* @hide
* Private impl for avoiding a log message... DO NOT USE without doing
@@ -1186,24 +1249,24 @@
*/
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P)
public static final native void sendSignalQuiet(int pid, int signal);
-
+
/** @hide */
@UnsupportedAppUsage
public static final native long getFreeMemory();
-
+
/** @hide */
@UnsupportedAppUsage
public static final native long getTotalMemory();
-
+
/** @hide */
@UnsupportedAppUsage
public static final native void readProcLines(String path,
String[] reqFields, long[] outSizes);
-
+
/** @hide */
@UnsupportedAppUsage
public static final native int[] getPids(String path, int[] lastArray);
-
+
/** @hide */
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public static final int PROC_TERM_MASK = 0xff;
@@ -1274,7 +1337,7 @@
/** @hide */
@UnsupportedAppUsage
- public static final native boolean parseProcLine(byte[] buffer, int startIndex,
+ public static final native boolean parseProcLine(byte[] buffer, int startIndex,
int endIndex, int[] format, String[] outStrings, long[] outLongs, float[] outFloats);
/** @hide */
@@ -1283,10 +1346,10 @@
/**
* Gets the total Pss value for a given process, in bytes.
- *
+ *
* @param pid the process to the Pss for
* @return the total Pss value for the given process in bytes,
- * or -1 if the value cannot be determined
+ * or -1 if the value cannot be determined
* @hide
*/
@UnsupportedAppUsage
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java
index 39f87d5..db724d2 100644
--- a/core/java/android/os/storage/StorageManager.java
+++ b/core/java/android/os/storage/StorageManager.java
@@ -82,7 +82,6 @@
import android.os.UserHandle;
import android.provider.MediaStore;
import android.provider.Settings;
-import android.sysprop.VoldProperties;
import android.system.ErrnoException;
import android.system.Os;
import android.system.OsConstants;
@@ -1636,10 +1635,7 @@
* false not encrypted or file encrypted
*/
public static boolean isBlockEncrypted() {
- if (!isEncrypted()) {
- return false;
- }
- return RoSystemProperties.CRYPTO_BLOCK_ENCRYPTED;
+ return false;
}
/** {@hide}
@@ -1649,18 +1645,7 @@
* false not encrypted, file encrypted or default block encrypted
*/
public static boolean isNonDefaultBlockEncrypted() {
- if (!isBlockEncrypted()) {
- return false;
- }
-
- try {
- IStorageManager storageManager = IStorageManager.Stub.asInterface(
- ServiceManager.getService("mount"));
- return storageManager.getPasswordType() != CRYPT_TYPE_DEFAULT;
- } catch (RemoteException e) {
- Log.e(TAG, "Error getting encryption type");
- return false;
- }
+ return false;
}
/** {@hide}
@@ -1674,8 +1659,7 @@
* framework, so no service needs to check for changes during their lifespan
*/
public static boolean isBlockEncrypting() {
- final String state = VoldProperties.encrypt_progress().orElse("");
- return !"".equalsIgnoreCase(state);
+ return false;
}
/** {@hide}
@@ -1690,8 +1674,7 @@
* framework, so no service needs to check for changes during their lifespan
*/
public static boolean inCryptKeeperBounce() {
- final String status = VoldProperties.decrypt().orElse("");
- return "trigger_restart_min_framework".equals(status);
+ return false;
}
/** {@hide} */
diff --git a/core/java/android/provider/Telephony.java b/core/java/android/provider/Telephony.java
index b79b3d8..0d5ef34 100644
--- a/core/java/android/provider/Telephony.java
+++ b/core/java/android/provider/Telephony.java
@@ -3589,7 +3589,7 @@
* @hide
*/
public static final Uri PREFERRED_APN_URI = Uri.parse(
- "content://telephony/carriers/preferapn/subId/");
+ "content://telephony/carriers/preferapn/subId");
/**
* The {@code content://} style URL for the perferred APN set id.
@@ -3597,8 +3597,15 @@
* @hide
*/
public static final Uri PREFERRED_APN_SET_URI = Uri.parse(
- "content://telephony/carriers/preferapnset/subId/");
+ "content://telephony/carriers/preferapnset/subId");
+ /**
+ * The id of preferred APN.
+ *
+ * @see #PREFERRED_APN_URI
+ * @hide
+ */
+ public static final String APN_ID = "apn_id";
/**
* The column name for ENFORCE_MANAGED_URI, indicates whether DPC-owned APNs are enforced.
diff --git a/core/java/android/telephony/PhoneStateListener.java b/core/java/android/telephony/PhoneStateListener.java
index 5b9d69c..e5c9adb 100644
--- a/core/java/android/telephony/PhoneStateListener.java
+++ b/core/java/android/telephony/PhoneStateListener.java
@@ -743,6 +743,7 @@
* @see TelephonyManager#DATA_CONNECTING
* @see TelephonyManager#DATA_CONNECTED
* @see TelephonyManager#DATA_SUSPENDED
+ * @see TelephonyManager#DATA_HANDOVER_IN_PROGRESS
* @deprecated Use {@link TelephonyCallback.DataConnectionStateListener} instead.
*/
@Deprecated
diff --git a/core/java/android/telephony/TelephonyCallback.java b/core/java/android/telephony/TelephonyCallback.java
index 3028a6d..e8960b8 100644
--- a/core/java/android/telephony/TelephonyCallback.java
+++ b/core/java/android/telephony/TelephonyCallback.java
@@ -792,6 +792,7 @@
* @see TelephonyManager#DATA_CONNECTING
* @see TelephonyManager#DATA_CONNECTED
* @see TelephonyManager#DATA_SUSPENDED
+ * @see TelephonyManager#DATA_HANDOVER_IN_PROGRESS
*/
void onDataConnectionStateChanged(@TelephonyManager.DataState int state,
@Annotation.NetworkType int networkType);
@@ -1408,10 +1409,11 @@
*
* @param enabled {@code true} if data is enabled, otherwise disabled.
* @param reason Reason for data enabled/disabled.
- * See {@link TelephonyManager.DataEnabledReason}.
+ * See {@link TelephonyManager.DataEnabledChangedReason}.
*/
@RequiresPermission(Manifest.permission.READ_PRECISE_PHONE_STATE)
- void onDataEnabledChanged(boolean enabled, @TelephonyManager.DataEnabledReason int reason);
+ void onDataEnabledChanged(boolean enabled,
+ @TelephonyManager.DataEnabledChangedReason int reason);
}
/**
diff --git a/core/java/com/android/internal/widget/ILockSettings.aidl b/core/java/com/android/internal/widget/ILockSettings.aidl
index d16d9c6..654b461 100644
--- a/core/java/com/android/internal/widget/ILockSettings.aidl
+++ b/core/java/com/android/internal/widget/ILockSettings.aidl
@@ -95,5 +95,4 @@
boolean hasSecureLockScreen();
boolean tryUnlockWithCachedUnifiedChallenge(int userId);
void removeCachedUnifiedChallenge(int userId);
- void updateEncryptionPassword(int type, in byte[] password);
}
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index cd1bbb6..408decc 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -701,38 +701,14 @@
return true;
}
- private void updateCryptoUserInfo(int userId) {
- if (userId != UserHandle.USER_SYSTEM) {
- return;
- }
-
- final String ownerInfo = isOwnerInfoEnabled(userId) ? getOwnerInfo(userId) : "";
-
- IBinder service = ServiceManager.getService("mount");
- if (service == null) {
- Log.e(TAG, "Could not find the mount service to update the user info");
- return;
- }
-
- IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
- try {
- Log.d(TAG, "Setting owner info");
- storageManager.setField(StorageManager.OWNER_INFO_KEY, ownerInfo);
- } catch (RemoteException e) {
- Log.e(TAG, "Error changing user info", e);
- }
- }
-
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public void setOwnerInfo(String info, int userId) {
setString(LOCK_SCREEN_OWNER_INFO, info, userId);
- updateCryptoUserInfo(userId);
}
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public void setOwnerInfoEnabled(boolean enabled, int userId) {
setBoolean(LOCK_SCREEN_OWNER_INFO_ENABLED, enabled, userId);
- updateCryptoUserInfo(userId);
}
@UnsupportedAppUsage
@@ -787,17 +763,6 @@
}
/**
- * Clears the encryption password.
- */
- public void clearEncryptionPassword() {
- try {
- getLockSettings().updateEncryptionPassword(StorageManager.CRYPT_TYPE_DEFAULT, null);
- } catch (RemoteException e) {
- Log.e(TAG, "Couldn't clear encryption password");
- }
- }
-
- /**
* Retrieves the quality mode for {@code userHandle}.
* @see DevicePolicyManager#getPasswordQuality(android.content.ComponentName)
*
@@ -988,24 +953,6 @@
*/
public void setVisiblePatternEnabled(boolean enabled, int userId) {
setBoolean(Settings.Secure.LOCK_PATTERN_VISIBLE, enabled, userId);
-
- // Update for crypto if owner
- if (userId != UserHandle.USER_SYSTEM) {
- return;
- }
-
- IBinder service = ServiceManager.getService("mount");
- if (service == null) {
- Log.e(TAG, "Could not find the mount service to update the user info");
- return;
- }
-
- IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
- try {
- storageManager.setField(StorageManager.PATTERN_VISIBLE_KEY, enabled ? "1" : "0");
- } catch (RemoteException e) {
- Log.e(TAG, "Error changing pattern visible state", e);
- }
}
public boolean isVisiblePatternEverChosen(int userId) {
@@ -1016,23 +963,7 @@
* Set whether the visible password is enabled for cryptkeeper screen.
*/
public void setVisiblePasswordEnabled(boolean enabled, int userId) {
- // Update for crypto if owner
- if (userId != UserHandle.USER_SYSTEM) {
- return;
- }
-
- IBinder service = ServiceManager.getService("mount");
- if (service == null) {
- Log.e(TAG, "Could not find the mount service to update the user info");
- return;
- }
-
- IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
- try {
- storageManager.setField(StorageManager.PASSWORD_VISIBLE_KEY, enabled ? "1" : "0");
- } catch (RemoteException e) {
- Log.e(TAG, "Error changing password visible state", e);
- }
+ // No longer does anything.
}
/**
diff --git a/core/jni/Android.bp b/core/jni/Android.bp
index 96e4d18..51939b2 100644
--- a/core/jni/Android.bp
+++ b/core/jni/Android.bp
@@ -342,7 +342,7 @@
"libhostgraphics",
],
},
- linux_glibc: {
+ host_linux: {
srcs: [
"android_content_res_ApkAssets.cpp",
"android_database_CursorWindow.cpp",
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 194002e..1601b47 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -1565,6 +1565,7 @@
REG_JNI(register_android_graphics_classes),
REG_JNI(register_android_graphics_BLASTBufferQueue),
REG_JNI(register_android_graphics_GraphicBuffer),
+ REG_JNI(register_android_graphics_GraphicsStatsService),
REG_JNI(register_android_graphics_SurfaceTexture),
REG_JNI(register_android_database_CursorWindow),
REG_JNI(register_android_database_SQLiteConnection),
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 5971670..5023927 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -895,7 +895,7 @@
// pthread_setname_np fails rather than truncating long strings.
char buf[16]; // MAX_TASK_COMM_LEN=16 is hard-coded into bionic
- strlcpy(buf, name_start_ptr, sizeof(buf) - 1);
+ strlcpy(buf, name_start_ptr, sizeof(buf));
errno = pthread_setname_np(pthread_self(), buf);
if (errno != 0) {
ALOGW("Unable to set the name of current thread to '%s': %s", buf, strerror(errno));
diff --git a/core/jni/com_android_internal_os_ZygoteCommandBuffer.cpp b/core/jni/com_android_internal_os_ZygoteCommandBuffer.cpp
index 0c05da5..679a4f0 100644
--- a/core/jni/com_android_internal_os_ZygoteCommandBuffer.cpp
+++ b/core/jni/com_android_internal_os_ZygoteCommandBuffer.cpp
@@ -34,6 +34,7 @@
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/socket.h>
+#include <sys/system_properties.h>
#include <vector>
namespace android {
@@ -43,10 +44,10 @@
using android::zygote::ZygoteFailure;
// WARNING: Knows a little about the wire protocol used to communicate with Zygote.
-// TODO: Fix error handling.
+// Commands and nice names have large arbitrary size limits to avoid dynamic memory allocation.
constexpr size_t MAX_COMMAND_BYTES = 32768;
-constexpr size_t NICE_NAME_BYTES = 50;
+constexpr size_t NICE_NAME_BYTES = 128;
// A buffer optionally bundled with a file descriptor from which we can fill it.
// Does not own the file descriptor; destroying a NativeCommandBuffer does not
@@ -190,6 +191,9 @@
size_t copy_len = std::min(name_len, NICE_NAME_BYTES - 1);
memcpy(mNiceName, arg_start + NN_LENGTH, copy_len);
mNiceName[copy_len] = '\0';
+ if (haveWrapProperty()) {
+ return false;
+ }
continue;
}
if (arg_end - arg_start == IW_LENGTH
@@ -222,6 +226,8 @@
}
saw_setgid = true;
}
+ // ro.debuggable can be handled entirely in the child unless --invoke-with is also specified.
+ // Thus we do not need to check it here.
}
return saw_runtime_args && saw_setuid && saw_setgid;
}
@@ -249,6 +255,14 @@
}
private:
+ bool haveWrapProperty() {
+ static const char* WRAP = "wrap.";
+ static const size_t WRAP_LENGTH = strlen(WRAP);
+ char propNameBuf[WRAP_LENGTH + NICE_NAME_BYTES];
+ strcpy(propNameBuf, WRAP);
+ strlcpy(propNameBuf + WRAP_LENGTH, mNiceName, NICE_NAME_BYTES);
+ return __system_property_find(propNameBuf) != nullptr;
+ }
// Picky version of atoi(). No sign or unexpected characters allowed. Return -1 on failure.
static int digitsVal(char* start, char* end) {
int result = 0;
@@ -269,7 +283,7 @@
uint32_t mNext; // Index of first character past last line returned by readLine.
int32_t mLinesLeft; // Lines in current command that haven't yet been read.
int mFd; // Open file descriptor from which we can read more. -1 if none.
- char mNiceName[NICE_NAME_BYTES];
+ char mNiceName[NICE_NAME_BYTES]; // Always null terminated.
char mBuffer[MAX_COMMAND_BYTES];
};
@@ -372,6 +386,7 @@
jint minUid,
jstring managed_nice_name) {
+ ALOGI("Entering forkRepeatedly native zygote loop");
NativeCommandBuffer* n_buffer = reinterpret_cast<NativeCommandBuffer*>(j_buffer);
int session_socket = n_buffer->getFd();
std::vector<int> session_socket_fds {session_socket};
@@ -400,7 +415,8 @@
socklen_t cred_size = sizeof credentials;
if (getsockopt(n_buffer->getFd(), SOL_SOCKET, SO_PEERCRED, &credentials, &cred_size) == -1
|| cred_size != sizeof credentials) {
- fail_fn_1(CREATE_ERROR("ForkMany failed to get initial credentials, %s", strerror(errno)));
+ fail_fn_1(CREATE_ERROR("ForkRepeatedly failed to get initial credentials, %s",
+ strerror(errno)));
}
bool first_time = true;
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 8c7913e..e243f19 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -2221,7 +2221,7 @@
<!-- Remote server that can provide NTP responses. -->
<string translatable="false" name="config_ntpServer">time.android.com</string>
<!-- Normal polling frequency in milliseconds -->
- <integer name="config_ntpPollingInterval">86400000</integer>
+ <integer name="config_ntpPollingInterval">64800000</integer>
<!-- Try-again polling interval in milliseconds, in case the network request failed -->
<integer name="config_ntpPollingIntervalShorter">60000</integer>
<!-- Number of times to try again with the shorter interval, before backing
diff --git a/data/etc/privapp-permissions-platform.xml b/data/etc/privapp-permissions-platform.xml
index 82aff60..c9abee2 100644
--- a/data/etc/privapp-permissions-platform.xml
+++ b/data/etc/privapp-permissions-platform.xml
@@ -457,10 +457,11 @@
<permission name="android.permission.WIFI_ACCESS_COEX_UNSAFE_CHANNELS" />
<permission name="android.permission.WIFI_UPDATE_COEX_UNSAFE_CHANNELS" />
<permission name="android.permission.NEARBY_WIFI_DEVICES" />
+ <permission name="android.permission.MANAGE_WIFI_INTERFACES" />
<permission name="android.permission.OVERRIDE_WIFI_CONFIG" />
<!-- Permission needed for CTS test - ConcurrencyTest#testP2pExternalApprover
- P2P external approver API sets require MANAGE_WIFI_AUTO_JOIN permission. -->
- <permission name="android.permission.MANAGE_WIFI_AUTO_JOIN" />
+ P2P external approver API sets require MANAGE_WIFI_NETWORK_SELECTION permission. -->
+ <permission name="android.permission.MANAGE_WIFI_NETWORK_SELECTION" />
<!-- Permission required for CTS test CarrierMessagingServiceWrapperTest -->
<permission name="android.permission.BIND_CARRIER_SERVICES"/>
<!-- Permission required for CTS test - MusicRecognitionManagerTest -->
diff --git a/keystore/java/android/security/keystore2/AndroidKeyStoreKeyPairGeneratorSpi.java b/keystore/java/android/security/keystore2/AndroidKeyStoreKeyPairGeneratorSpi.java
index 31dd10a..e7961c9 100644
--- a/keystore/java/android/security/keystore2/AndroidKeyStoreKeyPairGeneratorSpi.java
+++ b/keystore/java/android/security/keystore2/AndroidKeyStoreKeyPairGeneratorSpi.java
@@ -108,6 +108,16 @@
}
}
+ /**
+ * XDH represents Curve 25519 providers.
+ */
+ public static class XDH extends AndroidKeyStoreKeyPairGeneratorSpi {
+ // XDH is treated as EC.
+ public XDH() {
+ super(KeymasterDefs.KM_ALGORITHM_EC);
+ }
+ }
+
/*
* These must be kept in sync with system/security/keystore/defaults.h
*/
@@ -242,6 +252,23 @@
} catch (NullPointerException | IllegalArgumentException e) {
throw new InvalidAlgorithmParameterException(e);
}
+ } else if (params instanceof NamedParameterSpec) {
+ NamedParameterSpec namedSpec = (NamedParameterSpec) params;
+ // Android Keystore cannot support initialization from a NamedParameterSpec
+ // because an alias for the key is needed (a KeyGenParameterSpec cannot be
+ // constructed).
+ if (namedSpec.getName().equalsIgnoreCase(NamedParameterSpec.X25519.getName())
+ || namedSpec.getName().equalsIgnoreCase(
+ NamedParameterSpec.ED25519.getName())) {
+ throw new IllegalArgumentException(
+ "This KeyPairGenerator cannot be initialized using NamedParameterSpec."
+ + " use " + KeyGenParameterSpec.class.getName() + " or "
+ + KeyPairGeneratorSpec.class.getName());
+ } else {
+ throw new InvalidAlgorithmParameterException(
+ "Unsupported algorithm specified via NamedParameterSpec: "
+ + namedSpec.getName());
+ }
} else {
throw new InvalidAlgorithmParameterException(
"Unsupported params class: " + params.getClass().getName()
diff --git a/keystore/java/android/security/keystore2/AndroidKeyStoreProvider.java b/keystore/java/android/security/keystore2/AndroidKeyStoreProvider.java
index 358104f..d31499e 100644
--- a/keystore/java/android/security/keystore2/AndroidKeyStoreProvider.java
+++ b/keystore/java/android/security/keystore2/AndroidKeyStoreProvider.java
@@ -83,16 +83,12 @@
// java.security.KeyPairGenerator
put("KeyPairGenerator.EC", PACKAGE_NAME + ".AndroidKeyStoreKeyPairGeneratorSpi$EC");
put("KeyPairGenerator.RSA", PACKAGE_NAME + ".AndroidKeyStoreKeyPairGeneratorSpi$RSA");
- put("KeyPairGenerator." + X25519_ALIAS,
- PACKAGE_NAME + ".AndroidKeyStoreKeyPairGeneratorSpi$RSA");
- put("KeyPairGenerator." + ED25519_OID,
- PACKAGE_NAME + ".AndroidKeyStoreKeyPairGeneratorSpi$RSA");
+ put("KeyPairGenerator.XDH", PACKAGE_NAME + ".AndroidKeyStoreKeyPairGeneratorSpi$XDH");
// java.security.KeyFactory
putKeyFactoryImpl("EC");
putKeyFactoryImpl("RSA");
- putKeyFactoryImpl(X25519_ALIAS);
- putKeyFactoryImpl(ED25519_OID);
+ putKeyFactoryImpl("XDH");
// javax.crypto.KeyGenerator
put("KeyGenerator.AES", PACKAGE_NAME + ".AndroidKeyStoreKeyGeneratorSpi$AES");
diff --git a/libs/androidfw/Android.bp b/libs/androidfw/Android.bp
index 63b831d..c80fb18 100644
--- a/libs/androidfw/Android.bp
+++ b/libs/androidfw/Android.bp
@@ -118,7 +118,7 @@
"libz",
],
},
- linux_glibc: {
+ host_linux: {
srcs: [
"CursorWindow.cpp",
],
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index d9783e6..e69cf77 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -6831,7 +6831,8 @@
for (Integer format : formatsList) {
int btSourceCodec = AudioSystem.audioFormatToBluetoothSourceCodec(format);
if (btSourceCodec != BluetoothCodecConfig.SOURCE_CODEC_TYPE_INVALID) {
- codecConfigList.add(new BluetoothCodecConfig(btSourceCodec));
+ codecConfigList.add(
+ new BluetoothCodecConfig.Builder().setCodecType(btSourceCodec).build());
}
}
return codecConfigList;
diff --git a/packages/ConnectivityT/framework-t/src/android/net/EthernetManager.java b/packages/ConnectivityT/framework-t/src/android/net/EthernetManager.java
index 72243f9..eba51c1 100644
--- a/packages/ConnectivityT/framework-t/src/android/net/EthernetManager.java
+++ b/packages/ConnectivityT/framework-t/src/android/net/EthernetManager.java
@@ -511,7 +511,6 @@
NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK,
android.Manifest.permission.NETWORK_STACK,
android.Manifest.permission.MANAGE_ETHERNET_NETWORKS})
- @RequiresFeature(PackageManager.FEATURE_AUTOMOTIVE)
public void updateConfiguration(
@NonNull String iface,
@NonNull EthernetNetworkUpdateRequest request,
diff --git a/packages/ConnectivityT/framework-t/src/android/net/EthernetNetworkUpdateRequest.java b/packages/ConnectivityT/framework-t/src/android/net/EthernetNetworkUpdateRequest.java
index a626971..43f4c40f 100644
--- a/packages/ConnectivityT/framework-t/src/android/net/EthernetNetworkUpdateRequest.java
+++ b/packages/ConnectivityT/framework-t/src/android/net/EthernetNetworkUpdateRequest.java
@@ -24,36 +24,52 @@
import java.util.Objects;
-/** @hide */
+/**
+ * Represents a request to update an existing Ethernet interface.
+ *
+ * @see EthernetManager#updateConfiguration
+ *
+ * @hide
+ */
@SystemApi
public final class EthernetNetworkUpdateRequest implements Parcelable {
@NonNull
private final IpConfiguration mIpConfig;
- @NonNull
+ @Nullable
private final NetworkCapabilities mNetworkCapabilities;
+ /**
+ * @return the new {@link IpConfiguration}.
+ */
@NonNull
public IpConfiguration getIpConfiguration() {
return new IpConfiguration(mIpConfig);
}
- @NonNull
+ /**
+ * Setting the {@link NetworkCapabilities} is optional in {@link EthernetNetworkUpdateRequest}.
+ * When set to null, the existing NetworkCapabilities are not updated.
+ *
+ * @return the new {@link NetworkCapabilities} or null.
+ */
+ @Nullable
public NetworkCapabilities getNetworkCapabilities() {
- return new NetworkCapabilities(mNetworkCapabilities);
+ return mNetworkCapabilities == null ? null : new NetworkCapabilities(mNetworkCapabilities);
}
private EthernetNetworkUpdateRequest(@NonNull final IpConfiguration ipConfig,
- @NonNull final NetworkCapabilities networkCapabilities) {
+ @Nullable final NetworkCapabilities networkCapabilities) {
Objects.requireNonNull(ipConfig);
- Objects.requireNonNull(networkCapabilities);
- mIpConfig = new IpConfiguration(ipConfig);
- mNetworkCapabilities = new NetworkCapabilities(networkCapabilities);
+ mIpConfig = ipConfig;
+ mNetworkCapabilities = networkCapabilities;
}
private EthernetNetworkUpdateRequest(@NonNull final Parcel source) {
Objects.requireNonNull(source);
- mIpConfig = IpConfiguration.CREATOR.createFromParcel(source);
- mNetworkCapabilities = NetworkCapabilities.CREATOR.createFromParcel(source);
+ mIpConfig = source.readParcelable(IpConfiguration.class.getClassLoader(),
+ IpConfiguration.class);
+ mNetworkCapabilities = source.readParcelable(NetworkCapabilities.class.getClassLoader(),
+ NetworkCapabilities.class);
}
/**
@@ -75,7 +91,8 @@
public Builder(@NonNull final EthernetNetworkUpdateRequest request) {
Objects.requireNonNull(request);
mBuilderIpConfig = new IpConfiguration(request.mIpConfig);
- mBuilderNetworkCapabilities = new NetworkCapabilities(request.mNetworkCapabilities);
+ mBuilderNetworkCapabilities = null == request.mNetworkCapabilities
+ ? null : new NetworkCapabilities(request.mNetworkCapabilities);
}
/**
@@ -85,7 +102,6 @@
*/
@NonNull
public Builder setIpConfiguration(@NonNull final IpConfiguration ipConfig) {
- Objects.requireNonNull(ipConfig);
mBuilderIpConfig = new IpConfiguration(ipConfig);
return this;
}
@@ -96,9 +112,8 @@
* @return The builder to facilitate chaining.
*/
@NonNull
- public Builder setNetworkCapabilities(@NonNull final NetworkCapabilities nc) {
- Objects.requireNonNull(nc);
- mBuilderNetworkCapabilities = new NetworkCapabilities(nc);
+ public Builder setNetworkCapabilities(@Nullable final NetworkCapabilities nc) {
+ mBuilderNetworkCapabilities = nc == null ? null : new NetworkCapabilities(nc);
return this;
}
@@ -135,8 +150,8 @@
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
- mIpConfig.writeToParcel(dest, flags);
- mNetworkCapabilities.writeToParcel(dest, flags);
+ dest.writeParcelable(mIpConfig, flags);
+ dest.writeParcelable(mNetworkCapabilities, flags);
}
@Override
diff --git a/packages/ConnectivityT/framework-t/src/android/net/NetworkStatsCollection.java b/packages/ConnectivityT/framework-t/src/android/net/NetworkStatsCollection.java
index 67d48f0..1ddc78b 100644
--- a/packages/ConnectivityT/framework-t/src/android/net/NetworkStatsCollection.java
+++ b/packages/ConnectivityT/framework-t/src/android/net/NetworkStatsCollection.java
@@ -36,6 +36,7 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SystemApi;
+import android.net.NetworkStats.State;
import android.net.NetworkStatsHistory.Entry;
import android.os.Binder;
import android.service.NetworkStatsCollectionKeyProto;
@@ -102,7 +103,7 @@
private ArrayMap<Key, NetworkStatsHistory> mStats = new ArrayMap<>();
- private final long mBucketDuration;
+ private final long mBucketDurationMillis;
private long mStartMillis;
private long mEndMillis;
@@ -115,8 +116,8 @@
* @param bucketDuration duration of the buckets in this object, in milliseconds.
* @hide
*/
- public NetworkStatsCollection(long bucketDuration) {
- mBucketDuration = bucketDuration;
+ public NetworkStatsCollection(long bucketDurationMillis) {
+ mBucketDurationMillis = bucketDurationMillis;
reset();
}
@@ -148,7 +149,7 @@
if (mStartMillis == Long.MAX_VALUE) {
return Long.MAX_VALUE;
} else {
- return mStartMillis + mBucketDuration;
+ return mStartMillis + mBucketDurationMillis;
}
}
@@ -184,10 +185,10 @@
|| time == SubscriptionPlan.TIME_UNKNOWN) {
return time;
} else {
- final long mod = time % mBucketDuration;
+ final long mod = time % mBucketDurationMillis;
if (mod > 0) {
time -= mod;
- time += mBucketDuration;
+ time += mBucketDurationMillis;
}
return time;
}
@@ -200,7 +201,7 @@
|| time == SubscriptionPlan.TIME_UNKNOWN) {
return time;
} else {
- final long mod = time % mBucketDuration;
+ final long mod = time % mBucketDurationMillis;
if (mod > 0) {
time -= mod;
}
@@ -247,10 +248,10 @@
// 180 days of history should be enough for anyone; if we end up needing
// more, we'll dynamically grow the history object.
final int bucketEstimate = (int) NetworkStatsUtils.constrain(
- ((end - start) / mBucketDuration), 0,
- (180 * DateUtils.DAY_IN_MILLIS) / mBucketDuration);
+ ((end - start) / mBucketDurationMillis), 0,
+ (180 * DateUtils.DAY_IN_MILLIS) / mBucketDurationMillis);
final NetworkStatsHistory combined = new NetworkStatsHistory(
- mBucketDuration, bucketEstimate, fields);
+ mBucketDurationMillis, bucketEstimate, fields);
// shortcut when we know stats will be empty
if (start == end) return combined;
@@ -343,7 +344,7 @@
// Finally we can slice data as originally requested
final NetworkStatsHistory sliced = new NetworkStatsHistory(
- mBucketDuration, bucketEstimate, fields);
+ mBucketDurationMillis, bucketEstimate, fields);
sliced.recordHistory(combined, start, end);
return sliced;
} else {
@@ -458,9 +459,9 @@
// update when no existing, or when bucket duration changed
NetworkStatsHistory updated = null;
if (existing == null) {
- updated = new NetworkStatsHistory(mBucketDuration, 10);
- } else if (existing.getBucketDuration() != mBucketDuration) {
- updated = new NetworkStatsHistory(existing, mBucketDuration);
+ updated = new NetworkStatsHistory(mBucketDurationMillis, 10);
+ } else if (existing.getBucketDuration() != mBucketDurationMillis) {
+ updated = new NetworkStatsHistory(existing, mBucketDurationMillis);
}
if (updated != null) {
@@ -702,7 +703,7 @@
private int estimateBuckets() {
return (int) (Math.min(mEndMillis - mStartMillis, WEEK_IN_MILLIS * 5)
- / mBucketDuration);
+ / mBucketDurationMillis);
}
private ArrayList<Key> getSortedKeys() {
@@ -828,7 +829,7 @@
* Builder class for {@link NetworkStatsCollection}.
*/
public static final class Builder {
- private final long mBucketDuration;
+ private final long mBucketDurationMillis;
private final ArrayMap<Key, NetworkStatsHistory> mEntries = new ArrayMap<>();
/**
@@ -836,8 +837,8 @@
*
* @param bucketDuration Duration of the buckets of the object, in milliseconds.
*/
- public Builder(long bucketDuration) {
- mBucketDuration = bucketDuration;
+ public Builder(long bucketDurationMillis) {
+ mBucketDurationMillis = bucketDurationMillis;
}
/**
@@ -855,7 +856,7 @@
final List<Entry> historyEntries = history.getEntries();
final NetworkStatsHistory.Builder historyBuilder =
- new NetworkStatsHistory.Builder(mBucketDuration, historyEntries.size());
+ new NetworkStatsHistory.Builder(mBucketDurationMillis, historyEntries.size());
for (Entry entry : historyEntries) {
historyBuilder.addEntry(entry);
}
@@ -871,7 +872,8 @@
*/
@NonNull
public NetworkStatsCollection build() {
- final NetworkStatsCollection collection = new NetworkStatsCollection(mBucketDuration);
+ final NetworkStatsCollection collection =
+ new NetworkStatsCollection(mBucketDurationMillis);
for (int i = 0; i < mEntries.size(); i++) {
collection.recordHistory(mEntries.keyAt(i), mEntries.valueAt(i));
}
@@ -883,7 +885,7 @@
* the identifier that associate with the {@link NetworkStatsHistory} object to identify
* a certain record in the {@link NetworkStatsCollection} object.
*/
- public static class Key {
+ public static final class Key {
/** @hide */
public final NetworkIdentitySet ident;
/** @hide */
@@ -903,7 +905,7 @@
* @param set Set of the record, see {@code NetworkStats#SET_*}.
* @param tag Tag of the record, see {@link TrafficStats#setThreadStatsTag(int)}.
*/
- public Key(@NonNull Set<NetworkIdentity> ident, int uid, int set, int tag) {
+ public Key(@NonNull Set<NetworkIdentity> ident, int uid, @State int set, int tag) {
this(new NetworkIdentitySet(Objects.requireNonNull(ident)), uid, set, tag);
}
diff --git a/packages/ConnectivityT/service/src/com/android/server/net/NetworkStatsService.java b/packages/ConnectivityT/service/src/com/android/server/net/NetworkStatsService.java
index ef6f39a..f835581 100644
--- a/packages/ConnectivityT/service/src/com/android/server/net/NetworkStatsService.java
+++ b/packages/ConnectivityT/service/src/com/android/server/net/NetworkStatsService.java
@@ -565,7 +565,7 @@
return new BpfMap<U32, U8>(UID_COUNTERSET_MAP_PATH, BpfMap.BPF_F_RDWR,
U32.class, U8.class);
} catch (ErrnoException e) {
- Log.wtf(TAG, "Cannot create uid counter set map: " + e);
+ Log.wtf(TAG, "Cannot open uid counter set map: " + e);
return null;
}
}
@@ -576,7 +576,7 @@
return new BpfMap<CookieTagMapKey, CookieTagMapValue>(COOKIE_TAG_MAP_PATH,
BpfMap.BPF_F_RDWR, CookieTagMapKey.class, CookieTagMapValue.class);
} catch (ErrnoException e) {
- Log.wtf(TAG, "Cannot create cookie tag map: " + e);
+ Log.wtf(TAG, "Cannot open cookie tag map: " + e);
return null;
}
}
@@ -587,7 +587,7 @@
return new BpfMap<StatsMapKey, StatsMapValue>(STATS_MAP_A_PATH,
BpfMap.BPF_F_RDWR, StatsMapKey.class, StatsMapValue.class);
} catch (ErrnoException e) {
- Log.wtf(TAG, "Cannot create stats map A: " + e);
+ Log.wtf(TAG, "Cannot open stats map A: " + e);
return null;
}
}
@@ -598,7 +598,7 @@
return new BpfMap<StatsMapKey, StatsMapValue>(STATS_MAP_B_PATH,
BpfMap.BPF_F_RDWR, StatsMapKey.class, StatsMapValue.class);
} catch (ErrnoException e) {
- Log.wtf(TAG, "Cannot create stats map B: " + e);
+ Log.wtf(TAG, "Cannot open stats map B: " + e);
return null;
}
}
@@ -609,7 +609,7 @@
return new BpfMap<UidStatsMapKey, StatsMapValue>(APP_UID_STATS_MAP_PATH,
BpfMap.BPF_F_RDWR, UidStatsMapKey.class, StatsMapValue.class);
} catch (ErrnoException e) {
- Log.wtf(TAG, "Cannot create app uid stats map: " + e);
+ Log.wtf(TAG, "Cannot open app uid stats map: " + e);
return null;
}
}
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
index d6f08c6..981d8e4 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CachedBluetoothDevice.java
@@ -283,6 +283,12 @@
public void disconnect() {
synchronized (mProfileLock) {
+ if (getGroupId() != BluetoothCsipSetCoordinator.GROUP_ID_INVALID) {
+ for (CachedBluetoothDevice member : getMemberDevice()) {
+ Log.d(TAG, "Disconnect the member(" + member.getAddress() + ")");
+ member.disconnect();
+ }
+ }
mDevice.disconnect();
}
// Disconnect PBAP server in case its connected
@@ -397,6 +403,12 @@
}
mDevice.connect();
+ if (getGroupId() != BluetoothCsipSetCoordinator.GROUP_ID_INVALID) {
+ for (CachedBluetoothDevice member : getMemberDevice()) {
+ Log.d(TAG, "connect the member(" + member.getAddress() + ")");
+ member.connect();
+ }
+ }
}
}
diff --git a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CsipSetCoordinatorProfile.java b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CsipSetCoordinatorProfile.java
index 6da249c..c3f845c 100644
--- a/packages/SettingsLib/src/com/android/settingslib/bluetooth/CsipSetCoordinatorProfile.java
+++ b/packages/SettingsLib/src/com/android/settingslib/bluetooth/CsipSetCoordinatorProfile.java
@@ -59,7 +59,7 @@
// These callbacks run on the main thread.
private final class CoordinatedSetServiceListener implements BluetoothProfile.ServiceListener {
- @RequiresApi(32)
+ @RequiresApi(33)
public void onServiceConnected(int profile, BluetoothProfile proxy) {
if (VDBG) {
Log.d(TAG, "Bluetooth service connected");
@@ -233,7 +233,7 @@
return NAME;
}
- @RequiresApi(32)
+ @RequiresApi(33)
protected void finalize() {
if (VDBG) {
Log.d(TAG, "finalize()");
diff --git a/packages/Shell/AndroidManifest.xml b/packages/Shell/AndroidManifest.xml
index ca4dcbb..8f2ac9f 100644
--- a/packages/Shell/AndroidManifest.xml
+++ b/packages/Shell/AndroidManifest.xml
@@ -508,10 +508,11 @@
<uses-permission android:name="android.permission.WIFI_ACCESS_COEX_UNSAFE_CHANNELS" />
<uses-permission android:name="android.permission.WIFI_UPDATE_COEX_UNSAFE_CHANNELS" />
<uses-permission android:name="android.permission.NEARBY_WIFI_DEVICES" />
+ <uses-permission android:name="android.permission.MANAGE_WIFI_INTERFACES" />
<uses-permission android:name="android.permission.OVERRIDE_WIFI_CONFIG" />
<!-- Permission needed for CTS test - ConcurrencyTest#testP2pExternalApprover
- P2P external approver API sets require MANAGE_WIFI_AUTO_JOIN permission. -->
- <uses-permission android:name="android.permission.MANAGE_WIFI_AUTO_JOIN" />
+ P2P external approver API sets require MANAGE_WIFI_NETWORK_SELECTION permission. -->
+ <uses-permission android:name="android.permission.MANAGE_WIFI_NETWORK_SELECTION" />
<!-- Permission required for CTS tests to enable/disable rate limiting toasts. -->
<uses-permission android:name="android.permission.MANAGE_TOAST_RATE_LIMITING" />
diff --git a/services/core/java/com/android/server/NetworkManagementService.java b/services/core/java/com/android/server/NetworkManagementService.java
index b59cd4c..1a39ffa 100644
--- a/services/core/java/com/android/server/NetworkManagementService.java
+++ b/services/core/java/com/android/server/NetworkManagementService.java
@@ -1166,9 +1166,17 @@
final ConnectivityManager cm = mContext.getSystemService(ConnectivityManager.class);
try {
if (allowlist) {
- cm.updateMeteredNetworkAllowList(uid, enable);
+ if (enable) {
+ cm.addUidToMeteredNetworkAllowList(uid);
+ } else {
+ cm.removeUidFromMeteredNetworkAllowList(uid);
+ }
} else {
- cm.updateMeteredNetworkDenyList(uid, enable);
+ if (enable) {
+ cm.addUidToMeteredNetworkDenyList(uid);
+ } else {
+ cm.removeUidFromMeteredNetworkDenyList(uid);
+ }
}
synchronized (mRulesLock) {
if (enable) {
diff --git a/services/core/java/com/android/server/StorageManagerService.java b/services/core/java/com/android/server/StorageManagerService.java
index 9266bb4..8a83130 100644
--- a/services/core/java/com/android/server/StorageManagerService.java
+++ b/services/core/java/com/android/server/StorageManagerService.java
@@ -75,7 +75,6 @@
import android.content.pm.PackageManagerInternal;
import android.content.pm.ProviderInfo;
import android.content.pm.UserInfo;
-import android.content.res.Configuration;
import android.content.res.ObbInfo;
import android.database.ContentObserver;
import android.net.Uri;
@@ -122,7 +121,6 @@
import android.provider.Downloads;
import android.provider.MediaStore;
import android.provider.Settings;
-import android.sysprop.VoldProperties;
import android.text.TextUtils;
import android.text.format.DateUtils;
import android.util.ArrayMap;
@@ -1380,39 +1378,6 @@
private void handleDaemonConnected() {
initIfBootedAndConnected();
resetIfBootedAndConnected();
-
- // On an encrypted device we can't see system properties yet, so pull
- // the system locale out of the mount service.
- if ("".equals(VoldProperties.encrypt_progress().orElse(""))) {
- copyLocaleFromMountService();
- }
- }
-
- private void copyLocaleFromMountService() {
- String systemLocale;
- try {
- systemLocale = getField(StorageManager.SYSTEM_LOCALE_KEY);
- } catch (RemoteException e) {
- return;
- }
- if (TextUtils.isEmpty(systemLocale)) {
- return;
- }
-
- Slog.d(TAG, "Got locale " + systemLocale + " from mount service");
- Locale locale = Locale.forLanguageTag(systemLocale);
- Configuration config = new Configuration();
- config.setLocale(locale);
- try {
- ActivityManager.getService().updatePersistentConfigurationWithAttribution(config,
- mContext.getOpPackageName(), mContext.getAttributionTag());
- } catch (RemoteException e) {
- Slog.e(TAG, "Error setting system locale from mount service", e);
- }
-
- // Temporary workaround for http://b/17945169.
- Slog.d(TAG, "Setting system properties to " + systemLocale + " from mount service");
- SystemProperties.set("persist.sys.locale", locale.toLanguageTag());
}
private final IVoldListener mListener = new IVoldListener.Stub() {
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsService.java b/services/core/java/com/android/server/locksettings/LockSettingsService.java
index 7d5b7e5..45f85ed 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsService.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsService.java
@@ -1761,7 +1761,10 @@
}
private void onPostPasswordChanged(LockscreenCredential newCredential, int userHandle) {
- updateEncryptionPasswordIfNeeded(newCredential, userHandle);
+ if (userHandle == UserHandle.USER_SYSTEM && isDeviceEncryptionEnabled() &&
+ shouldEncryptWithCredentials() && newCredential.isNone()) {
+ setCredentialRequiredToDecrypt(false);
+ }
if (newCredential.isPattern()) {
setBoolean(LockPatternUtils.PATTERN_EVER_CHOSEN_KEY, true, userHandle);
}
@@ -1770,26 +1773,6 @@
}
/**
- * Update device encryption password if calling user is USER_SYSTEM and device supports
- * encryption.
- */
- private void updateEncryptionPasswordIfNeeded(LockscreenCredential credential, int userHandle) {
- // Update the device encryption password.
- if (userHandle != UserHandle.USER_SYSTEM || !isDeviceEncryptionEnabled()) {
- return;
- }
- if (!shouldEncryptWithCredentials()) {
- updateEncryptionPassword(StorageManager.CRYPT_TYPE_DEFAULT, null);
- return;
- }
- if (credential.isNone()) {
- // Set the encryption password to default.
- setCredentialRequiredToDecrypt(false);
- }
- updateEncryptionPassword(credential.getStorageCryptType(), credential.getCredential());
- }
-
- /**
* Store the hash of the *current* password in the password history list, if device policy
* enforces password history requirement.
*/
@@ -1883,34 +1866,6 @@
}
}
- /** Update the encryption password if it is enabled **/
- @Override
- public void updateEncryptionPassword(final int type, final byte[] password) {
- if (!hasSecureLockScreen() && password != null && password.length != 0) {
- throw new UnsupportedOperationException(
- "This operation requires the lock screen feature.");
- }
- if (!isDeviceEncryptionEnabled()) {
- return;
- }
- final IBinder service = ServiceManager.getService("mount");
- if (service == null) {
- Slog.e(TAG, "Could not find the mount service to update the encryption password");
- return;
- }
-
- // TODO(b/120484642): This is a location where we still use a String for vold
- String passwordString = password != null ? new String(password) : null;
- mHandler.post(() -> {
- IStorageManager storageManager = mInjector.getStorageManager();
- try {
- storageManager.changeEncryptionPassword(type, passwordString);
- } catch (RemoteException e) {
- Slog.e(TAG, "Error changing encryption password", e);
- }
- });
- }
-
@VisibleForTesting /** Note: this method is overridden in unit tests */
protected void tieProfileLockToParent(int userId, LockscreenCredential password) {
if (DEBUG) Slog.v(TAG, "tieProfileLockToParent for user: " + userId);
diff --git a/services/core/java/com/android/server/pm/OWNERS b/services/core/java/com/android/server/pm/OWNERS
index c219f80..cba81c1 100644
--- a/services/core/java/com/android/server/pm/OWNERS
+++ b/services/core/java/com/android/server/pm/OWNERS
@@ -16,6 +16,7 @@
per-file BackgroundDexOptService.java = file:dex/OWNERS
per-file CompilerStats.java = file:dex/OWNERS
per-file DynamicCodeLoggingService.java = file:dex/OWNERS
+per-file Installer.java = file:dex/OWNERS
per-file InstructionSets.java = file:dex/OWNERS
per-file OtaDexoptService.java = file:dex/OWNERS
per-file OtaDexoptShellCommand.java = file:dex/OWNERS
diff --git a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
index 5b4084e..265e606 100644
--- a/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
+++ b/services/core/java/com/android/server/pm/PackageManagerShellCommand.java
@@ -129,6 +129,7 @@
import java.util.List;
import java.util.Map;
import java.util.Objects;
+import java.util.Set;
import java.util.WeakHashMap;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch;
@@ -142,6 +143,10 @@
private final static String ART_PROFILE_SNAPSHOT_DEBUG_LOCATION = "/data/misc/profman/";
private static final int DEFAULT_STAGED_READY_TIMEOUT_MS = 60 * 1000;
private static final String TAG = "PackageManagerShellCommand";
+ private static final Set<String> UNSUPPORTED_INSTALL_CMD_OPTS = Set.of(
+ "--multi-package"
+ );
+ private static final Set<String> UNSUPPORTED_SESSION_CREATE_OPTS = Collections.emptySet();
final IPackageManager mInterface;
final LegacyPermissionManagerInternal mLegacyPermissionManager;
@@ -1282,7 +1287,7 @@
}
private int runStreamingInstall() throws RemoteException {
- final InstallParams params = makeInstallParams();
+ final InstallParams params = makeInstallParams(UNSUPPORTED_INSTALL_CMD_OPTS);
if (params.sessionParams.dataLoaderParams == null) {
params.sessionParams.setDataLoaderParams(
PackageManagerShellCommandDataLoader.getStreamingDataLoaderParams(this));
@@ -1291,7 +1296,7 @@
}
private int runIncrementalInstall() throws RemoteException {
- final InstallParams params = makeInstallParams();
+ final InstallParams params = makeInstallParams(UNSUPPORTED_INSTALL_CMD_OPTS);
if (params.sessionParams.dataLoaderParams == null) {
params.sessionParams.setDataLoaderParams(
PackageManagerShellCommandDataLoader.getIncrementalDataLoaderParams(this));
@@ -1300,7 +1305,7 @@
}
private int runInstall() throws RemoteException {
- return doRunInstall(makeInstallParams());
+ return doRunInstall(makeInstallParams(UNSUPPORTED_INSTALL_CMD_OPTS));
}
private int doRunInstall(final InstallParams params) throws RemoteException {
@@ -1452,7 +1457,7 @@
private int runInstallCreate() throws RemoteException {
final PrintWriter pw = getOutPrintWriter();
- final InstallParams installParams = makeInstallParams();
+ final InstallParams installParams = makeInstallParams(UNSUPPORTED_SESSION_CREATE_OPTS);
final int sessionId = doCreateSession(installParams.sessionParams,
installParams.installerPackageName, installParams.userId);
@@ -2764,7 +2769,7 @@
long stagedReadyTimeoutMs = DEFAULT_STAGED_READY_TIMEOUT_MS;
}
- private InstallParams makeInstallParams() {
+ private InstallParams makeInstallParams(Set<String> unsupportedOptions) {
final SessionParams sessionParams = new SessionParams(SessionParams.MODE_FULL_INSTALL);
final InstallParams params = new InstallParams();
@@ -2776,6 +2781,9 @@
boolean replaceExisting = true;
boolean forceNonStaged = false;
while ((opt = getNextOption()) != null) {
+ if (unsupportedOptions.contains(opt)) {
+ throw new IllegalArgumentException("Unsupported option " + opt);
+ }
switch (opt) {
case "-r": // ignore
break;
@@ -3674,7 +3682,7 @@
pw.println(" [--user USER_ID] INTENT");
pw.println(" Prints all broadcast receivers that can handle the given INTENT.");
pw.println("");
- pw.println(" install [-rtfdgw] [-i PACKAGE] [--user USER_ID|all|current]");
+ pw.println(" install [-rtfdg] [-i PACKAGE] [--user USER_ID|all|current]");
pw.println(" [-p INHERIT_PACKAGE] [--install-location 0/1/2]");
pw.println(" [--install-reason 0/1/2/3/4] [--originating-uri URI]");
pw.println(" [--referrer URI] [--abi ABI_NAME] [--force-sdk]");
diff --git a/services/core/java/com/android/server/pm/dex/OWNERS b/services/core/java/com/android/server/pm/dex/OWNERS
index 052a4ca..5ca8ddd 100644
--- a/services/core/java/com/android/server/pm/dex/OWNERS
+++ b/services/core/java/com/android/server/pm/dex/OWNERS
@@ -1,3 +1,4 @@
alanstokes@google.com
jiakaiz@google.com
ngeoffray@google.com
+mast@google.com
diff --git a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
index 41c716c..290f4ae 100644
--- a/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
+++ b/services/core/java/com/android/server/pm/permission/PermissionManagerService.java
@@ -2679,31 +2679,36 @@
}
}
+ Collection<String> uidRequestedPermissions;
+ Collection<String> uidImplicitPermissions;
+ int uidTargetSdkVersion;
+ if (!ps.isSharedUser()) {
+ uidRequestedPermissions = pkg.getRequestedPermissions();
+ uidImplicitPermissions = pkg.getImplicitPermissions();
+ uidTargetSdkVersion = pkg.getTargetSdkVersion();
+ } else {
+ uidRequestedPermissions = new ArraySet<>();
+ uidImplicitPermissions = new ArraySet<>();
+ uidTargetSdkVersion = Build.VERSION_CODES.CUR_DEVELOPMENT;
+ List<AndroidPackage> packages = ps.getSharedUser().getPackages();
+ int packagesSize = packages.size();
+ for (int i = 0; i < packagesSize; i++) {
+ AndroidPackage sharedUserPackage = packages.get(i);
+ uidRequestedPermissions.addAll(
+ sharedUserPackage.getRequestedPermissions());
+ uidImplicitPermissions.addAll(
+ sharedUserPackage.getImplicitPermissions());
+ uidTargetSdkVersion = Math.min(uidTargetSdkVersion,
+ sharedUserPackage.getTargetSdkVersion());
+ }
+ }
+
synchronized (mLock) {
for (final int userId : userIds) {
final UserPermissionState userState = mState.getOrCreateUserState(userId);
final UidPermissionState uidState = userState.getOrCreateUidState(ps.getAppId());
if (uidState.isMissing()) {
- Collection<String> uidRequestedPermissions;
- int targetSdkVersion;
- if (!ps.isSharedUser()) {
- uidRequestedPermissions = pkg.getRequestedPermissions();
- targetSdkVersion = pkg.getTargetSdkVersion();
- } else {
- uidRequestedPermissions = new ArraySet<>();
- targetSdkVersion = Build.VERSION_CODES.CUR_DEVELOPMENT;
- List<AndroidPackage> packages = ps.getSharedUser().getPackages();
- int packagesSize = packages.size();
- for (int i = 0; i < packagesSize; i++) {
- AndroidPackage sharedUserPackage = packages.get(i);
- uidRequestedPermissions.addAll(
- sharedUserPackage.getRequestedPermissions());
- targetSdkVersion = Math.min(targetSdkVersion,
- sharedUserPackage.getTargetSdkVersion());
- }
- }
-
for (String permissionName : uidRequestedPermissions) {
Permission permission = mRegistry.getPermission(permissionName);
if (permission == null) {
@@ -2717,7 +2722,7 @@
FLAG_PERMISSION_RESTRICTION_UPGRADE_EXEMPT,
FLAG_PERMISSION_RESTRICTION_UPGRADE_EXEMPT);
}
- if (targetSdkVersion < Build.VERSION_CODES.M) {
+ if (uidTargetSdkVersion < Build.VERSION_CODES.M) {
uidState.updatePermissionFlags(permission,
PackageManager.FLAG_PERMISSION_REVIEW_REQUIRED
| PackageManager.FLAG_PERMISSION_REVOKED_COMPAT,
@@ -3043,8 +3048,9 @@
userState.setInstallPermissionsFixed(ps.name, true);
}
- updatedUserIds = revokePermissionsNoLongerImplicitLocked(uidState, pkg,
- userId, updatedUserIds);
+ updatedUserIds = revokePermissionsNoLongerImplicitLocked(uidState,
+ pkg.getPackageName(), uidImplicitPermissions, uidTargetSdkVersion, userId,
+ updatedUserIds);
updatedUserIds = setInitialGrantForNewImplicitPermissionsLocked(origState,
uidState, pkg, newImplicitPermissions, userId, updatedUserIds);
}
@@ -3081,7 +3087,9 @@
* {@link PackageManager#FLAG_PERMISSION_REVOKE_WHEN_REQUESTED} set.
*
* @param ps The state of the permissions of the package
- * @param pkg The package that is currently looked at
+ * @param packageName The name of the package
+ * @param uidImplicitPermissions The implicit permissions of all packages in the UID
+ * @param uidTargetSdkVersion The lowest target SDK version of all packages in the UID
* @param userIds All user IDs in the system, must be passed in because this method is locked
* @param updatedUserIds a list of user ids that needs to be amended if the permission state
* for a user is changed.
@@ -3090,14 +3098,12 @@
*/
@GuardedBy("mLock")
private @NonNull int[] revokePermissionsNoLongerImplicitLocked(@NonNull UidPermissionState ps,
- @NonNull AndroidPackage pkg, int userId, @NonNull int[] updatedUserIds) {
- String pkgName = pkg.getPackageName();
- boolean supportsRuntimePermissions = pkg.getTargetSdkVersion()
- >= Build.VERSION_CODES.M;
+ @NonNull String packageName, @NonNull Collection<String> uidImplicitPermissions,
+ int uidTargetSdkVersion, int userId, @NonNull int[] updatedUserIds) {
+ boolean supportsRuntimePermissions = uidTargetSdkVersion >= Build.VERSION_CODES.M;
for (String permission : ps.getGrantedPermissions()) {
- if (pkg.getRequestedPermissions().contains(permission)
- && !pkg.getImplicitPermissions().contains(permission)) {
+ if (!uidImplicitPermissions.contains(permission)) {
Permission bp = mRegistry.getPermission(permission);
if (bp != null && bp.isRuntime()) {
int flags = ps.getPermissionFlags(permission);
@@ -3124,7 +3130,7 @@
if (ps.revokePermission(bp)) {
if (DEBUG_PERMISSIONS) {
Slog.i(TAG, "Revoking runtime permission "
- + permission + " for " + pkgName
+ + permission + " for " + packageName
+ " as it is now requested");
}
}
diff --git a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
index c8227d9..dde52c5 100644
--- a/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
+++ b/services/core/java/com/android/server/wm/ActivityTaskManagerService.java
@@ -203,8 +203,6 @@
import android.os.UserHandle;
import android.os.UserManager;
import android.os.WorkSource;
-import android.os.storage.IStorageManager;
-import android.os.storage.StorageManager;
import android.provider.Settings;
import android.service.dreams.DreamActivity;
import android.service.voice.IVoiceInteractionSession;
@@ -4209,11 +4207,6 @@
SystemProperties.set("persist.sys.locale",
locales.get(bestLocaleIndex).toLanguageTag());
LocaleList.setDefault(locales, bestLocaleIndex);
-
- final Message m = PooledLambda.obtainMessage(
- ActivityTaskManagerService::sendLocaleToMountDaemonMsg, this,
- locales.get(bestLocaleIndex));
- mH.sendMessage(m);
}
mTempConfig.seq = increaseConfigurationSeqLocked();
@@ -4367,17 +4360,6 @@
Settings.System.putConfigurationForUser(resolver, config, userId);
}
- private void sendLocaleToMountDaemonMsg(Locale l) {
- try {
- IBinder service = ServiceManager.getService("mount");
- IStorageManager storageManager = IStorageManager.Stub.asInterface(service);
- Log.d(TAG, "Storing locale " + l.toLanguageTag() + " for decryption UI");
- storageManager.setField(StorageManager.SYSTEM_LOCALE_KEY, l.toLanguageTag());
- } catch (RemoteException e) {
- Log.e(TAG, "Error storing locale for decryption UI", e);
- }
- }
-
private void expireStartAsCallerTokenMsg(IBinder permissionToken) {
mStartActivitySources.remove(permissionToken);
mExpiredStartAsCallerTokens.add(permissionToken);
diff --git a/services/core/java/com/android/server/wm/RunningTasks.java b/services/core/java/com/android/server/wm/RunningTasks.java
index 9864297..d31b007 100644
--- a/services/core/java/com/android/server/wm/RunningTasks.java
+++ b/services/core/java/com/android/server/wm/RunningTasks.java
@@ -43,7 +43,11 @@
// Comparator to sort by last active time (descending)
private static final Comparator<Task> LAST_ACTIVE_TIME_COMPARATOR =
- (o1, o2) -> Long.signum(o2.lastActiveTime - o1.lastActiveTime);
+ (o1, o2) -> {
+ return o1.lastActiveTime == o2.lastActiveTime
+ ? Integer.signum(o2.mTaskId - o1.mTaskId) :
+ Long.signum(o2.lastActiveTime - o1.lastActiveTime);
+ };
private final TreeSet<Task> mTmpSortedSet = new TreeSet<>(LAST_ACTIVE_TIME_COMPARATOR);
diff --git a/services/core/jni/onload.cpp b/services/core/jni/onload.cpp
index 9d3edd6..07f0b87 100644
--- a/services/core/jni/onload.cpp
+++ b/services/core/jni/onload.cpp
@@ -103,7 +103,6 @@
register_android_server_HardwarePropertiesManagerService(env);
register_android_server_storage_AppFuse(env);
register_android_server_SyntheticPasswordManager(env);
- register_android_graphics_GraphicsStatsService(env);
register_android_hardware_display_DisplayViewport(env);
register_android_server_am_CachedAppOptimizer(env);
register_android_server_am_LowMemDetector(env);
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/ActiveAdmin.java b/services/devicepolicy/java/com/android/server/devicepolicy/ActiveAdmin.java
index 1c9d584..ef3b0bb 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/ActiveAdmin.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/ActiveAdmin.java
@@ -295,8 +295,8 @@
public boolean mAdminCanGrantSensorsPermissions;
public boolean mPreferentialNetworkServiceEnabled =
DevicePolicyManager.PREFERENTIAL_NETWORK_SERVICE_ENABLED_DEFAULT;
- public PreferentialNetworkServiceConfig mPreferentialNetworkServiceConfig =
- PreferentialNetworkServiceConfig.DEFAULT;
+ public List<PreferentialNetworkServiceConfig> mPreferentialNetworkServiceConfigs =
+ List.of(PreferentialNetworkServiceConfig.DEFAULT);
private static final boolean USB_DATA_SIGNALING_ENABLED_DEFAULT = true;
boolean mUsbDataSignalingEnabled = USB_DATA_SIGNALING_ENABLED_DEFAULT;
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index a8617c0..b0997c0 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -110,13 +110,13 @@
import static android.net.ConnectivityManager.PROFILE_NETWORK_PREFERENCE_DEFAULT;
import static android.net.ConnectivityManager.PROFILE_NETWORK_PREFERENCE_ENTERPRISE;
import static android.net.ConnectivityManager.PROFILE_NETWORK_PREFERENCE_ENTERPRISE_NO_FALLBACK;
-import static android.net.NetworkCapabilities.NET_ENTERPRISE_ID_1;
import static android.net.NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK;
import static android.provider.Settings.Global.PRIVATE_DNS_SPECIFIER;
import static android.provider.Settings.Secure.USER_SETUP_COMPLETE;
import static android.provider.Telephony.Carriers.DPC_URI;
import static android.provider.Telephony.Carriers.ENFORCE_KEY;
import static android.provider.Telephony.Carriers.ENFORCE_MANAGED_URI;
+import static android.provider.Telephony.Carriers.INVALID_APN_ID;
import static android.security.keystore.AttestationUtils.USE_INDIVIDUAL_ATTESTATION;
import static com.android.internal.logging.nano.MetricsProto.MetricsEvent.PROVISIONING_ENTRY_POINT_ADB;
@@ -3314,14 +3314,14 @@
updatePermissionPolicyCache(userId);
updateAdminCanGrantSensorsPermissionCache(userId);
- final PreferentialNetworkServiceConfig preferentialNetworkServiceConfig;
+ final List<PreferentialNetworkServiceConfig> preferentialNetworkServiceConfigs;
synchronized (getLockObject()) {
ActiveAdmin owner = getDeviceOrProfileOwnerAdminLocked(userId);
- preferentialNetworkServiceConfig = owner != null
- ? owner.mPreferentialNetworkServiceConfig
- : PreferentialNetworkServiceConfig.DEFAULT;
+ preferentialNetworkServiceConfigs = owner != null
+ ? owner.mPreferentialNetworkServiceConfigs
+ : List.of(PreferentialNetworkServiceConfig.DEFAULT);
}
- updateNetworkPreferenceForUser(userId, preferentialNetworkServiceConfig);
+ updateNetworkPreferenceForUser(userId, preferentialNetworkServiceConfigs);
startOwnerService(userId, "start-user");
}
@@ -3338,7 +3338,7 @@
@Override
void handleStopUser(int userId) {
- updateNetworkPreferenceForUser(userId, PreferentialNetworkServiceConfig.DEFAULT);
+ updateNetworkPreferenceForUser(userId, List.of(PreferentialNetworkServiceConfig.DEFAULT));
stopOwnerService(userId, "stop-user");
}
@@ -12002,87 +12002,50 @@
}
@Override
- public void setPreferentialNetworkServiceEnabled(boolean enabled) {
+ public void setPreferentialNetworkServiceConfigs(
+ List<PreferentialNetworkServiceConfig> preferentialNetworkServiceConfigs) {
if (!mHasFeature) {
return;
}
final CallerIdentity caller = getCallerIdentity();
- Preconditions.checkCallAuthorization(isProfileOwner(caller),
- "Caller is not profile owner;"
- + " only profile owner may control the preferential network service");
+ Preconditions.checkCallAuthorization(isProfileOwner(caller)
+ || isDeviceOwner(caller),
+ "Caller is not profile owner or device owner;"
+ + " only profile owner or device owner may control the preferential"
+ + " network service");
synchronized (getLockObject()) {
final ActiveAdmin requiredAdmin = getProfileOwnerAdminLocked(
caller.getUserId());
- if (requiredAdmin != null
- && requiredAdmin.mPreferentialNetworkServiceEnabled != enabled) {
- requiredAdmin.mPreferentialNetworkServiceEnabled = enabled;
+ if (!requiredAdmin.mPreferentialNetworkServiceConfigs.equals(
+ preferentialNetworkServiceConfigs)) {
+ requiredAdmin.mPreferentialNetworkServiceConfigs =
+ new ArrayList<>(preferentialNetworkServiceConfigs);
saveSettingsLocked(caller.getUserId());
}
}
- updateNetworkPreferenceForUser(caller.getUserId(), enabled);
+ updateNetworkPreferenceForUser(caller.getUserId(), preferentialNetworkServiceConfigs);
DevicePolicyEventLogger
.createEvent(DevicePolicyEnums.SET_PREFERENTIAL_NETWORK_SERVICE_ENABLED)
- .setBoolean(enabled)
+ .setBoolean(preferentialNetworkServiceConfigs
+ .stream().anyMatch(c -> c.isEnabled()))
.write();
}
@Override
- public boolean isPreferentialNetworkServiceEnabled(int userHandle) {
+ public List<PreferentialNetworkServiceConfig> getPreferentialNetworkServiceConfigs() {
if (!mHasFeature) {
- return false;
+ return List.of(PreferentialNetworkServiceConfig.DEFAULT);
}
final CallerIdentity caller = getCallerIdentity();
- Preconditions.checkCallAuthorization(isProfileOwner(caller),
- "Caller is not profile owner");
- synchronized (getLockObject()) {
- final ActiveAdmin requiredAdmin = getProfileOwnerAdminLocked(userHandle);
- if (requiredAdmin != null) {
- return requiredAdmin.mPreferentialNetworkServiceEnabled;
- } else {
- return false;
- }
- }
- }
-
- @Override
- public void setPreferentialNetworkServiceConfig(
- PreferentialNetworkServiceConfig preferentialNetworkServiceConfig) {
- if (!mHasFeature) {
- return;
- }
- final CallerIdentity caller = getCallerIdentity();
- Preconditions.checkCallAuthorization(isProfileOwner(caller),
- "Caller is not profile owner;"
- + " only profile owner may control the preferential network service");
- synchronized (getLockObject()) {
- final ActiveAdmin requiredAdmin = getProfileOwnerAdminLocked(
- caller.getUserId());
- if (!requiredAdmin.mPreferentialNetworkServiceConfig.equals(
- preferentialNetworkServiceConfig)) {
- requiredAdmin.mPreferentialNetworkServiceConfig = preferentialNetworkServiceConfig;
- saveSettingsLocked(caller.getUserId());
- }
- }
- updateNetworkPreferenceForUser(caller.getUserId(), preferentialNetworkServiceConfig);
- DevicePolicyEventLogger
- .createEvent(DevicePolicyEnums.SET_PREFERENTIAL_NETWORK_SERVICE_ENABLED)
- .setBoolean(preferentialNetworkServiceConfig.isEnabled())
- .write();
- }
-
- @Override
- public PreferentialNetworkServiceConfig getPreferentialNetworkServiceConfig() {
- if (!mHasFeature) {
- return PreferentialNetworkServiceConfig.DEFAULT;
- }
-
- final CallerIdentity caller = getCallerIdentity();
- Preconditions.checkCallAuthorization(isProfileOwner(caller),
- "Caller is not profile owner");
+ Preconditions.checkCallAuthorization(isProfileOwner(caller)
+ || isDeviceOwner(caller),
+ "Caller is not profile owner or device owner;"
+ + " only profile owner or device owner may retrieve the preferential"
+ + " network service configurations");
synchronized (getLockObject()) {
final ActiveAdmin requiredAdmin = getProfileOwnerAdminLocked(caller.getUserId());
- return requiredAdmin.mPreferentialNetworkServiceConfig;
+ return requiredAdmin.mPreferentialNetworkServiceConfigs;
}
}
@@ -16081,7 +16044,12 @@
Objects.requireNonNull(who, "ComponentName is null");
Objects.requireNonNull(apnSetting, "ApnSetting is null in addOverrideApn");
final CallerIdentity caller = getCallerIdentity(who);
- Preconditions.checkCallAuthorization(isDeviceOwner(caller));
+ if (apnSetting.getApnTypeBitmask() == ApnSetting.TYPE_ENTERPRISE) {
+ Preconditions.checkCallAuthorization(isDeviceOwner(caller)
+ || isProfileOwner(caller));
+ } else {
+ Preconditions.checkCallAuthorization(isDeviceOwner(caller));
+ }
TelephonyManager tm = mContext.getSystemService(TelephonyManager.class);
if (tm != null) {
@@ -16089,7 +16057,7 @@
() -> tm.addDevicePolicyOverrideApn(mContext, apnSetting));
} else {
Slogf.w(LOG_TAG, "TelephonyManager is null when trying to add override apn");
- return Telephony.Carriers.INVALID_APN_ID;
+ return INVALID_APN_ID;
}
}
@@ -16102,7 +16070,14 @@
Objects.requireNonNull(who, "ComponentName is null");
Objects.requireNonNull(apnSetting, "ApnSetting is null in updateOverrideApn");
final CallerIdentity caller = getCallerIdentity(who);
- Preconditions.checkCallAuthorization(isDeviceOwner(caller));
+ ApnSetting apn = getApnSetting(apnId);
+ if (apn != null && apn.getApnTypeBitmask() == ApnSetting.TYPE_ENTERPRISE
+ && apnSetting.getApnTypeBitmask() == ApnSetting.TYPE_ENTERPRISE) {
+ Preconditions.checkCallAuthorization(isDeviceOwner(caller)
+ || isProfileOwner(caller));
+ } else {
+ Preconditions.checkCallAuthorization(isDeviceOwner(caller));
+ }
if (apnId < 0) {
return false;
@@ -16124,7 +16099,13 @@
}
Objects.requireNonNull(who, "ComponentName is null");
final CallerIdentity caller = getCallerIdentity(who);
- Preconditions.checkCallAuthorization(isDeviceOwner(caller));
+ ApnSetting apn = getApnSetting(apnId);
+ if (apn != null && apn.getApnTypeBitmask() == ApnSetting.TYPE_ENTERPRISE) {
+ Preconditions.checkCallAuthorization(isDeviceOwner(caller)
+ || isProfileOwner(caller));
+ } else {
+ Preconditions.checkCallAuthorization(isDeviceOwner(caller));
+ }
return removeOverrideApnUnchecked(apnId);
}
@@ -16138,6 +16119,27 @@
return numDeleted > 0;
}
+ private ApnSetting getApnSetting(int apnId) {
+ if (apnId < 0) {
+ return null;
+ }
+ ApnSetting apnSetting = null;
+ Cursor cursor = mInjector.binderWithCleanCallingIdentity(
+ () -> mContext.getContentResolver().query(
+ Uri.withAppendedPath(DPC_URI, Integer.toString(apnId)), null, null, null,
+ Telephony.Carriers.DEFAULT_SORT_ORDER));
+ if (cursor != null) {
+ while (cursor.moveToNext()) {
+ apnSetting = ApnSetting.makeApnSetting(cursor);
+ if (apnSetting != null) {
+ break;
+ }
+ }
+ cursor.close();
+ }
+ return apnSetting;
+ }
+
@Override
public List<ApnSetting> getOverrideApns(@NonNull ComponentName who) {
if (!mHasFeature || !mHasTelephonyFeature) {
@@ -17824,54 +17826,38 @@
}
private void updateNetworkPreferenceForUser(int userId,
- boolean preferentialNetworkServiceEnabled) {
+ List<PreferentialNetworkServiceConfig> preferentialNetworkServiceConfigs) {
if (!isManagedProfile(userId)) {
return;
}
- ProfileNetworkPreference.Builder preferenceBuilder =
- new ProfileNetworkPreference.Builder();
- if (preferentialNetworkServiceEnabled) {
- preferenceBuilder.setPreference(PROFILE_NETWORK_PREFERENCE_ENTERPRISE);
- preferenceBuilder.setPreferenceEnterpriseId(NET_ENTERPRISE_ID_1);
- } else {
- preferenceBuilder.setPreference(PROFILE_NETWORK_PREFERENCE_DEFAULT);
- }
List<ProfileNetworkPreference> preferences = new ArrayList<>();
- preferences.add(preferenceBuilder.build());
- mInjector.binderWithCleanCallingIdentity(() ->
- mInjector.getConnectivityManager().setProfileNetworkPreferences(
- UserHandle.of(userId), preferences,
- null /* executor */, null /* listener */));
- }
-
- private void updateNetworkPreferenceForUser(int userId,
- PreferentialNetworkServiceConfig preferentialNetworkServiceConfig) {
- if (!isManagedProfile(userId)) {
- return;
- }
- ProfileNetworkPreference.Builder preferenceBuilder =
- new ProfileNetworkPreference.Builder();
- if (preferentialNetworkServiceConfig.isEnabled()) {
- if (preferentialNetworkServiceConfig.isFallbackToDefaultConnectionAllowed()) {
- preferenceBuilder.setPreference(PROFILE_NETWORK_PREFERENCE_ENTERPRISE);
+ for (PreferentialNetworkServiceConfig preferentialNetworkServiceConfig :
+ preferentialNetworkServiceConfigs) {
+ ProfileNetworkPreference.Builder preferenceBuilder =
+ new ProfileNetworkPreference.Builder();
+ if (preferentialNetworkServiceConfig.isEnabled()) {
+ if (preferentialNetworkServiceConfig.isFallbackToDefaultConnectionAllowed()) {
+ preferenceBuilder.setPreference(PROFILE_NETWORK_PREFERENCE_ENTERPRISE);
+ } else {
+ preferenceBuilder.setPreference(
+ PROFILE_NETWORK_PREFERENCE_ENTERPRISE_NO_FALLBACK);
+ }
} else {
- preferenceBuilder.setPreference(PROFILE_NETWORK_PREFERENCE_ENTERPRISE_NO_FALLBACK);
+ preferenceBuilder.setPreference(PROFILE_NETWORK_PREFERENCE_DEFAULT);
}
- } else {
- preferenceBuilder.setPreference(PROFILE_NETWORK_PREFERENCE_DEFAULT);
+ List<Integer> allowedUids = Arrays.stream(
+ preferentialNetworkServiceConfig.getIncludedUids()).boxed().collect(
+ Collectors.toList());
+ List<Integer> excludedUids = Arrays.stream(
+ preferentialNetworkServiceConfig.getExcludedUids()).boxed().collect(
+ Collectors.toList());
+ preferenceBuilder.setIncludedUids(allowedUids);
+ preferenceBuilder.setExcludedUids(excludedUids);
+ preferenceBuilder.setPreferenceEnterpriseId(
+ preferentialNetworkServiceConfig.getNetworkId());
+
+ preferences.add(preferenceBuilder.build());
}
- List<Integer> allowedUids = Arrays.stream(
- preferentialNetworkServiceConfig.getIncludedUids()).boxed().collect(
- Collectors.toList());
- List<Integer> excludedUids = Arrays.stream(
- preferentialNetworkServiceConfig.getExcludedUids()).boxed().collect(
- Collectors.toList());
- preferenceBuilder.setIncludedUids(allowedUids);
- preferenceBuilder.setExcludedUids(excludedUids);
- preferenceBuilder.setPreferenceEnterpriseId(
- preferentialNetworkServiceConfig.getNetworkId());
- List<ProfileNetworkPreference> preferences = new ArrayList<>();
- preferences.add(preferenceBuilder.build());
mInjector.binderWithCleanCallingIdentity(() ->
mInjector.getConnectivityManager().setProfileNetworkPreferences(
UserHandle.of(userId), preferences,
diff --git a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
index c5f990d..66e840b 100644
--- a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
+++ b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
@@ -112,7 +112,7 @@
try {
mIProfcollect.registerProviderStatusCallback(mProviderStatusCallback);
} catch (RemoteException e) {
- Log.e(LOG_TAG, e.getMessage());
+ Log.e(LOG_TAG, "Failed to register provider status callback: " + e.getMessage());
}
}
@@ -123,7 +123,7 @@
try {
return !mIProfcollect.get_supported_provider().isEmpty();
} catch (RemoteException e) {
- Log.e(LOG_TAG, e.getMessage());
+ Log.e(LOG_TAG, "Failed to get supported provider: " + e.getMessage());
return false;
}
}
@@ -219,7 +219,8 @@
try {
sSelfService.mIProfcollect.process();
} catch (RemoteException e) {
- Log.e(LOG_TAG, e.getMessage());
+ Log.e(LOG_TAG, "Failed to process profiles in background: "
+ + e.getMessage());
}
});
return true;
@@ -234,8 +235,11 @@
// Event observers
private void registerObservers() {
- registerAppLaunchObserver();
- registerOTAObserver();
+ BackgroundThread.get().getThreadHandler().post(
+ () -> {
+ registerAppLaunchObserver();
+ registerOTAObserver();
+ });
}
private final AppLaunchObserver mAppLaunchObserver = new AppLaunchObserver();
@@ -264,7 +268,7 @@
try {
mIProfcollect.trace_once("applaunch");
} catch (RemoteException e) {
- Log.e(LOG_TAG, e.getMessage());
+ Log.e(LOG_TAG, "Failed to initiate trace: " + e.getMessage());
}
});
}
@@ -348,7 +352,7 @@
.putExtra("filename", reportName);
context.sendBroadcast(intent);
} catch (RemoteException e) {
- Log.e(LOG_TAG, e.getMessage());
+ Log.e(LOG_TAG, "Failed to upload report: " + e.getMessage());
}
});
}
diff --git a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
index 4ae855f..a67751d 100644
--- a/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
+++ b/services/tests/servicestests/src/com/android/server/devicepolicy/DevicePolicyManagerTest.java
@@ -4137,8 +4137,8 @@
@Test
public void testSetPreferentialNetworkServiceConfig_noProfileOwner() throws Exception {
assertExpectException(SecurityException.class, null,
- () -> dpm.setPreferentialNetworkServiceConfig(
- PreferentialNetworkServiceConfig.DEFAULT));
+ () -> dpm.setPreferentialNetworkServiceConfigs(
+ List.of(PreferentialNetworkServiceConfig.DEFAULT)));
}
@Test
@@ -4178,10 +4178,10 @@
addManagedProfile(admin1, managedProfileAdminUid, admin1);
mContext.binder.callingUid = managedProfileAdminUid;
- dpm.setPreferentialNetworkServiceConfig(PreferentialNetworkServiceConfig.DEFAULT);
+ dpm.setPreferentialNetworkServiceConfigs(
+ List.of(PreferentialNetworkServiceConfig.DEFAULT));
assertThat(dpm.isPreferentialNetworkServiceEnabled()).isFalse();
- assertThat(dpm.getPreferentialNetworkServiceConfig()
- .isEnabled()).isFalse();
+ assertThat(dpm.getPreferentialNetworkServiceConfigs().get(0).isEnabled()).isFalse();
ProfileNetworkPreference preferenceDetails =
new ProfileNetworkPreference.Builder()
@@ -4207,8 +4207,8 @@
addManagedProfile(admin1, managedProfileAdminUid, admin1);
mContext.binder.callingUid = managedProfileAdminUid;
- dpm.setPreferentialNetworkServiceConfig(preferentialNetworkServiceConfigEnabled);
- assertThat(dpm.getPreferentialNetworkServiceConfig()
+ dpm.setPreferentialNetworkServiceConfigs(List.of(preferentialNetworkServiceConfigEnabled));
+ assertThat(dpm.getPreferentialNetworkServiceConfigs().get(0)
.isEnabled()).isTrue();
ProfileNetworkPreference preferenceDetails =
new ProfileNetworkPreference.Builder()
@@ -4237,8 +4237,8 @@
.setFallbackToDefaultConnectionAllowed(false)
.setIncludedUids(new int[]{1, 2})
.build();
- dpm.setPreferentialNetworkServiceConfig(preferentialNetworkServiceConfigEnabled);
- assertThat(dpm.getPreferentialNetworkServiceConfig()
+ dpm.setPreferentialNetworkServiceConfigs(List.of(preferentialNetworkServiceConfigEnabled));
+ assertThat(dpm.getPreferentialNetworkServiceConfigs().get(0)
.isEnabled()).isTrue();
List<Integer> includedList = new ArrayList<>();
includedList.add(1);
@@ -4272,8 +4272,8 @@
.setExcludedUids(new int[]{1, 2})
.build();
- dpm.setPreferentialNetworkServiceConfig(preferentialNetworkServiceConfigEnabled);
- assertThat(dpm.getPreferentialNetworkServiceConfig()
+ dpm.setPreferentialNetworkServiceConfigs(List.of(preferentialNetworkServiceConfigEnabled));
+ assertThat(dpm.getPreferentialNetworkServiceConfigs().get(0)
.isEnabled()).isTrue();
List<Integer> excludedUids = new ArrayList<>();
excludedUids.add(1);
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index cd73bda..7c98a03 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -4365,6 +4365,56 @@
"gba_ua_tls_cipher_suite_int";
/**
+ * The data stall recovery timers array in milliseconds, each element is the delay before
+ * performining next recovery action.
+ *
+ * The default value of timers array are: [180000ms, 180000ms, 180000ms] (3 minutes)
+ * Array[0]: It's the timer between RECOVERY_ACTION GET_DATA_CALL_LIST and CLEANUP, if data
+ * stall symptom still occurred, it will perform next recovery action after 180000ms.
+ * Array[1]: It's the timer between RECOVERY_ACTION CLEANUP and RADIO_RESTART, if data stall
+ * symptom still occurred, it will perform next recovery action after 180000ms.
+ * Array[2]: It's the timer between RECOVERY_ACTION RADIO_RESTART and RESET_MODEM, if data stall
+ * symptom still occurred, it will perform next recovery action after 180000ms.
+ *
+ * See the {@code RECOVERY_ACTION_*} constants in
+ * {@link com.android.internal.telephony.data.DataStallRecoveryManager}
+ * @hide
+ */
+ public static final String KEY_DATA_STALL_RECOVERY_TIMERS_LONG_ARRAY =
+ "data_stall_recovery_timers_long_array";
+
+ /**
+ * The data stall recovery action boolean array, we use this array to determine if the
+ * data stall recovery action needs to be skipped.
+ *
+ * For example, if the carrier use the same APN for both of IA and default type,
+ * the data call will not disconnect in modem side (so the RECOVERY_ACTION_CLEANUP
+ * did not effect). In this case, we can config the boolean variable of action
+ * RECOVERY_ACTION_CLEANUP to true, then it can be ignored to speed up the recovery
+ * action procedure.
+ *
+ * The default value of boolean array are: [false, false, false, false]
+ * Array[0]: When performing the recovery action, we can use this boolean value to determine
+ * if we need to perform RECOVERY_ACTION_GET_DATA_CALL_LIST.
+ * Array[1]: If data stall symptom still occurred, we can use this boolean value to determine
+ * if we need to perform RECOVERY_ACTION_CLEANUP. For example, if the carrier use the same APN
+ * for both of IA and default type, the data call will not disconnect in modem side
+ * (so the RECOVERY_ACTION_CLEANUP did not effect). In this case, we can config the boolean
+ * variable of action RECOVERY_ACTION_CLEANUP to true, then it can be ignored to speed up the
+ * recovery action procedure.
+ * Array[2]: If data stall symptom still occurred, we can use this boolean value to determine
+ * if we need to perform RECOVERY_ACTION_RADIO_RESTART.
+ * Array[3]: If data stall symptom still occurred, we can use this boolean value to determine
+ * if we need to perform RECOVERY_ACTION_MODEM_RESET.
+ *
+ * See the {@code RECOVERY_ACTION_*} constants in
+ * {@link com.android.internal.telephony.data.DataStallRecoveryManager}
+ * @hide
+ */
+ public static final String KEY_DATA_STALL_RECOVERY_SHOULD_SKIP_BOOL_ARRAY =
+ "data_stall_recovery_should_skip_bool_array";
+
+ /**
* Configs used by ImsServiceEntitlement.
*/
public static final class ImsServiceEntitlement {
@@ -5542,7 +5592,7 @@
"telephony_network_capability_priorities_string_array";
/**
- * Defines the rules for data retry.
+ * Defines the rules for data setup retry.
*
* The syntax of the retry rule:
* 1. Retry based on {@link NetworkCapabilities}. Note that only APN-type network capabilities
@@ -5574,8 +5624,34 @@
* // TODO: remove KEY_CARRIER_DATA_CALL_RETRY_CONFIG_STRINGS
* @hide
*/
- public static final String KEY_TELEPHONY_DATA_RETRY_RULES_STRING_ARRAY =
- "telephony_data_retry_rules_string_array";
+ public static final String KEY_TELEPHONY_DATA_SETUP_RETRY_RULES_STRING_ARRAY =
+ "telephony_data_setup_retry_rules_string_array";
+
+ /**
+ * Defines the rules for data handover retry.
+ *
+ * The syntax of the retry rule:
+ * 1. Retry when handover fails.
+ * "retry_interval=[n1|n2|n3|...], [maximum_retries=n]"
+ *
+ * For example,
+ * "retry_interval=1000|3000|5000, maximum_retries=10" means handover retry will happen in 1s,
+ * 3s, 5s, 5s, 5s....up to 10 times.
+ *
+ * 2. Retry when handover fails with certain fail causes.
+ * "retry_interval=[n1|n2|n3|...], fail_causes=[cause1|cause2|cause3|...], [maximum_retries=n]
+ *
+ * For example,
+ * "retry_interval=1000, maximum_retries=3, fail_causes=5" means handover retry every 1 second
+ * for up to 3 times when handover fails with the cause 5.
+ *
+ * "maximum_retries=0, fail_causes=6|10|67" means handover retry should not happen for those
+ * causes.
+ *
+ * @hide
+ */
+ public static final String KEY_TELEPHONY_DATA_HANDOVER_RETRY_RULES_STRING_ARRAY =
+ "telephony_data_handover_retry_rules_string_array";
/**
* The patterns of missed incoming call sms. This is the regular expression used for
@@ -5936,7 +6012,7 @@
"others:max_retries=3, 5000, 5000, 5000"});
sDefaults.putLong(KEY_CARRIER_DATA_CALL_APN_DELAY_DEFAULT_LONG, 20000);
sDefaults.putLong(KEY_CARRIER_DATA_CALL_APN_DELAY_FASTER_LONG, 3000);
- sDefaults.putLong(KEY_CARRIER_DATA_CALL_APN_RETRY_AFTER_DISCONNECT_LONG, 10000);
+ sDefaults.putLong(KEY_CARRIER_DATA_CALL_APN_RETRY_AFTER_DISCONNECT_LONG, 3000);
sDefaults.putInt(KEY_CARRIER_DATA_CALL_RETRY_NETWORK_REQUESTED_MAX_COUNT_INT, 3);
sDefaults.putString(KEY_CARRIER_ERI_FILE_NAME_STRING, "eri.xml");
sDefaults.putInt(KEY_DURATION_BLOCKING_DISABLED_AFTER_EMERGENCY_INT, 7200);
@@ -6404,15 +6480,19 @@
"ims:40", "dun:30", "enterprise:20", "internet:20"
});
sDefaults.putStringArray(
- KEY_TELEPHONY_DATA_RETRY_RULES_STRING_ARRAY, new String[] {
+ KEY_TELEPHONY_DATA_SETUP_RETRY_RULES_STRING_ARRAY, new String[] {
"capabilities=eims, retry_interval=1000, maximum_retries=20",
- "fail_causes=8|27|28|29|30|32|33|35|50|51|111|-5|-6|65537|65538|-3|2253|"
- + "2254, maximum_retries=0", // No retry for those causes
+ "fail_causes=8|27|28|29|30|32|33|35|50|51|111|-5|-6|65537|65538|-3|2252|"
+ + "2253|2254, maximum_retries=0", // No retry for those causes
"capabilities=mms|supl|cbs, retry_interval=2000",
"capabilities=internet|enterprise|dun|ims|fota, retry_interval=2500|3000|"
+ "5000|10000|15000|20000|40000|60000|120000|240000|"
+ "600000|1200000|1800000, maximum_retries=20"
});
+ sDefaults.putStringArray(
+ KEY_TELEPHONY_DATA_HANDOVER_RETRY_RULES_STRING_ARRAY, new String[] {
+ "retry_interval=1000|2000|4000|8000|16000, maximum_retries=5"
+ });
sDefaults.putStringArray(KEY_MISSED_INCOMING_CALL_SMS_PATTERN_STRING_ARRAY, new String[0]);
sDefaults.putBoolean(KEY_DISABLE_DUN_APN_WHILE_ROAMING_WITH_PRESET_APN_BOOL, false);
sDefaults.putString(KEY_DEFAULT_PREFERRED_APN_NAME_STRING, "");
@@ -6436,6 +6516,12 @@
sDefaults.putStringArray(KEY_IWLAN_HANDOVER_POLICY_STRING_ARRAY, new String[]{
"source=GERAN|UTRAN|EUTRAN|NGRAN|IWLAN, "
+ "target=GERAN|UTRAN|EUTRAN|NGRAN|IWLAN, type=allowed"});
+
+ // Default data stall recovery configurations.
+ sDefaults.putLongArray(KEY_DATA_STALL_RECOVERY_TIMERS_LONG_ARRAY,
+ new long[] {180000, 180000, 180000});
+ sDefaults.putBooleanArray(KEY_DATA_STALL_RECOVERY_SHOULD_SKIP_BOOL_ARRAY,
+ new boolean[] {false, false, false, false});
}
/**
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 390ffc7..63ff232 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -5985,6 +5985,7 @@
DATA_CONNECTED,
DATA_SUSPENDED,
DATA_DISCONNECTING,
+ DATA_HANDOVER_IN_PROGRESS,
})
@Retention(RetentionPolicy.SOURCE)
public @interface DataState{}
@@ -6009,6 +6010,12 @@
public static final int DATA_DISCONNECTING = 4;
/**
+ * Data connection state: Handover in progress. The connection is being transited from cellular
+ * network to IWLAN, or from IWLAN to cellular network.
+ */
+ public static final int DATA_HANDOVER_IN_PROGRESS = 5;
+
+ /**
* Used for checking if the SDK version for {@link TelephonyManager#getDataState} is above Q.
*/
@ChangeId
@@ -6024,6 +6031,7 @@
* @see #DATA_CONNECTED
* @see #DATA_SUSPENDED
* @see #DATA_DISCONNECTING
+ * @see #DATA_HANDOVER_IN_PROGRESS
*/
public int getDataState() {
try {
@@ -12534,6 +12542,25 @@
@Retention(RetentionPolicy.SOURCE)
public @interface DataEnabledReason{}
+ /** @hide */
+ @IntDef({
+ DATA_ENABLED_REASON_UNKNOWN,
+ DATA_ENABLED_REASON_USER,
+ DATA_ENABLED_REASON_POLICY,
+ DATA_ENABLED_REASON_CARRIER,
+ DATA_ENABLED_REASON_THERMAL,
+ DATA_ENABLED_REASON_OVERRIDE
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface DataEnabledChangedReason{}
+
+ /**
+ * To indicate that data was enabled or disabled due to an unknown reason.
+ * Note that this is not a valid reason for {@link #setDataEnabledForReason(int, boolean)} and
+ * is only used to indicate that data enabled was changed.
+ */
+ public static final int DATA_ENABLED_REASON_UNKNOWN = -1;
+
/**
* To indicate that user enabled or disabled data.
*/
@@ -12561,6 +12588,13 @@
public static final int DATA_ENABLED_REASON_THERMAL = 3;
/**
+ * To indicate data was enabled or disabled due to {@link MobileDataPolicy} overrides.
+ * Note that this is not a valid reason for {@link #setDataEnabledForReason(int, boolean)} and
+ * is only used to indicate that data enabled was changed due to an override.
+ */
+ public static final int DATA_ENABLED_REASON_OVERRIDE = 4;
+
+ /**
* Control of data connection and provide the reason triggering the data connection control.
* This can be called for following reasons
* <ol>
diff --git a/telephony/java/android/telephony/data/ApnSetting.java b/telephony/java/android/telephony/data/ApnSetting.java
index 8c02ffe..cb112cf 100644
--- a/telephony/java/android/telephony/data/ApnSetting.java
+++ b/telephony/java/android/telephony/data/ApnSetting.java
@@ -118,11 +118,9 @@
public static final int TYPE_VSIM = 1 << 12; // TODO: Refer to ApnTypes.VSIM
/** APN type for BIP. */
public static final int TYPE_BIP = 1 << 13; // TODO: Refer to ApnTypes.BIP
- /**
- * APN type for ENTERPRISE.
- * @hide
- */
- public static final int TYPE_ENTERPRISE = TYPE_BIP << 1;
+ /** APN type for ENTERPRISE. */
+ public static final int TYPE_ENTERPRISE = 1 << 14; //TODO: In future should be referenced from
+ // hardware.interfaces.radio.data.ApnTypes
/** @hide */
@IntDef(flag = true, prefix = {"TYPE_"}, value = {
@@ -355,6 +353,7 @@
* modem components or carriers. Non-system apps should use the integer variants instead.
* @hide
*/
+ @SystemApi
public static final String TYPE_ENTERPRISE_STRING = "enterprise";
@@ -521,11 +520,11 @@
private final boolean mAlwaysOn;
/**
- * Returns the MTU size of the IPv4 mobile interface to which the APN connected. Note this value
- * is used only if MTU size is not provided in {@link DataCallResponse}.
+ * Returns the default MTU (Maximum Transmission Unit) size in bytes of the IPv4 routes brought
+ * up by this APN setting. Note this value will only be used when MTU size is not provided
+ * in {@link DataCallResponse#getMtuV4()} during network bring up.
*
- * @return the MTU size of the APN
- * @hide
+ * @return the MTU size in bytes of the route.
*/
public int getMtuV4() {
return mMtuV4;
@@ -533,10 +532,10 @@
/**
* Returns the MTU size of the IPv6 mobile interface to which the APN connected. Note this value
- * is used only if MTU size is not provided in {@link DataCallResponse}.
+ * will only be used when MTU size is not provided in {@link DataCallResponse#getMtuV6()}
+ * during network bring up.
*
- * @return the MTU size of the APN
- * @hide
+ * @return the MTU size in bytes of the route.
*/
public int getMtuV6() {
return mMtuV6;
@@ -1753,25 +1752,25 @@
}
/**
- * Set the MTU size of the IPv4 mobile interface to which the APN connected. Note this value
- * is used only if MTU size is not provided in {@link DataCallResponse}.
+ * Set the default MTU (Maximum Transmission Unit) size in bytes of the IPv4 routes brought
+ * up by this APN setting. Note this value will only be used when MTU size is not provided
+ * in {@link DataCallResponse#getMtuV4()} during network bring up.
*
- * @param mtuV4 the MTU size to set for the APN
- * @hide
+ * @param mtuV4 the MTU size in bytes of the route.
*/
- public Builder setMtuV4(int mtuV4) {
+ public @NonNull Builder setMtuV4(int mtuV4) {
this.mMtuV4 = mtuV4;
return this;
}
/**
- * Set the MTU size of the IPv6 mobile interface to which the APN connected. Note this value
- * is used only if MTU size is not provided in {@link DataCallResponse}.
+ * Set the default MTU (Maximum Transmission Unit) size in bytes of the IPv6 routes brought
+ * up by this APN setting. Note this value will only be used when MTU size is not provided
+ * in {@link DataCallResponse#getMtuV6()} during network bring up.
*
- * @param mtuV6 the MTU size to set for the APN
- * @hide
+ * @param mtuV6 the MTU size in bytes of the route.
*/
- public Builder setMtuV6(int mtuV6) {
+ public @NonNull Builder setMtuV6(int mtuV6) {
this.mMtuV6 = mtuV6;
return this;
}
@@ -1779,15 +1778,25 @@
/**
* Sets the profile id to which the APN saved in modem.
*
- * @param profileId the profile id to set for the APN
- * @hide
+ * @param profileId the profile id to set for the APN.
*/
- public Builder setProfileId(int profileId) {
+ public @NonNull Builder setProfileId(int profileId) {
this.mProfileId = profileId;
return this;
}
/**
+ * Set if the APN setting should be persistent/non-persistent in modem.
+ *
+ * @param isPersistent {@code true} if this APN setting should be persistent/non-persistent
+ * in modem.
+ * @return The same instance of the builder.
+ */
+ public @NonNull Builder setPersistent(boolean isPersistent) {
+ return setModemCognitive(isPersistent);
+ }
+
+ /**
* Sets if the APN setting is to be set in modem.
*
* @param modemCognitive if the APN setting is to be set in modem
diff --git a/telephony/java/android/telephony/data/DataProfile.java b/telephony/java/android/telephony/data/DataProfile.java
index c1d16a9..ec04c1a 100644
--- a/telephony/java/android/telephony/data/DataProfile.java
+++ b/telephony/java/android/telephony/data/DataProfile.java
@@ -38,8 +38,10 @@
import java.util.Objects;
/**
- * Description of a mobile data profile used for establishing
- * data connections.
+ * Description of a mobile data profile used for establishing data networks. The data profile
+ * consist an {@link ApnSetting} which is needed for 2G/3G/4G networks bring up, and a
+ * {@link TrafficDescriptor} contains additional information that can be used for 5G standalone
+ * network bring up.
*
* @hide
*/
@@ -113,7 +115,9 @@
/**
* @return Id of the data profile.
+ * @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getProfileId()} instead.
*/
+ @Deprecated
public int getProfileId() {
if (mApnSetting != null) {
return mApnSetting.getProfileId();
@@ -124,9 +128,10 @@
/**
* @return The APN (Access Point Name) to establish data connection. This is a string
* specifically defined by the carrier.
+ * @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getApnName()} instead.
*/
- @NonNull
- public String getApn() {
+ @Deprecated
+ public @NonNull String getApn() {
if (mApnSetting != null) {
return TextUtils.emptyIfNull(mApnSetting.getApnName());
}
@@ -135,7 +140,9 @@
/**
* @return The connection protocol defined in 3GPP TS 27.007 section 10.1.1.
+ * @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getProtocol()} instead.
*/
+ @Deprecated
public @ProtocolType int getProtocolType() {
if (mApnSetting != null) {
return mApnSetting.getProtocol();
@@ -145,7 +152,9 @@
/**
* @return The authentication protocol used for this PDP context.
+ * @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getAuthType()} instead.
*/
+ @Deprecated
public @AuthType int getAuthType() {
if (mApnSetting != null) {
return mApnSetting.getAuthType();
@@ -154,10 +163,11 @@
}
/**
- * @return The username for APN. Can be null.
+ * @return The username for APN.
+ * @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getUser()} instead.
*/
- @Nullable
- public String getUserName() {
+ @Deprecated
+ public @Nullable String getUserName() {
if (mApnSetting != null) {
return mApnSetting.getUser();
}
@@ -165,10 +175,11 @@
}
/**
- * @return The password for APN. Can be null.
+ * @return The password for APN.
+ * @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getPassword()} instead.
*/
- @Nullable
- public String getPassword() {
+ @Deprecated
+ public @Nullable String getPassword() {
if (mApnSetting != null) {
return mApnSetting.getPassword();
}
@@ -232,7 +243,9 @@
/**
* @return The supported APN types bitmask.
+ * @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getApnTypeBitmask()} instead.
*/
+ @Deprecated
public @ApnType int getSupportedApnTypesBitmask() {
if (mApnSetting != null) {
return mApnSetting.getApnTypeBitmask();
@@ -242,7 +255,9 @@
/**
* @return The connection protocol on roaming network defined in 3GPP TS 27.007 section 10.1.1.
+ * @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#getRoamingProtocol()} instead.
*/
+ @Deprecated
public @ProtocolType int getRoamingProtocolType() {
if (mApnSetting != null) {
return mApnSetting.getRoamingProtocol();
@@ -252,7 +267,10 @@
/**
* @return The bearer bitmask indicating the applicable networks for this data profile.
+ * @deprecated use {@link #getApnSetting()} and {@link ApnSetting#getNetworkTypeBitmask()}
+ * instead.
*/
+ @Deprecated
public @NetworkTypeBitMask int getBearerBitmask() {
if (mApnSetting != null) {
return mApnSetting.getNetworkTypeBitmask();
@@ -262,7 +280,8 @@
/**
* @return The maximum transmission unit (MTU) size in bytes.
- * @deprecated use {@link #getMtuV4} or {@link #getMtuV6} instead.
+ * @deprecated use {@link #getApnSetting()} and {@link ApnSetting#getMtuV4()}/
+ * {@link ApnSetting#getMtuV6()} instead.
*/
@Deprecated
public int getMtu() {
@@ -272,7 +291,9 @@
/**
* This replaces the deprecated method getMtu.
* @return The maximum transmission unit (MTU) size in bytes, for IPv4.
+ * @deprecated use {@link #getApnSetting()} and {@link ApnSetting#getMtuV4()} instead.
*/
+ @Deprecated
public int getMtuV4() {
if (mApnSetting != null) {
return mApnSetting.getMtuV4();
@@ -282,7 +303,9 @@
/**
* @return The maximum transmission unit (MTU) size in bytes, for IPv6.
+ * @deprecated use {@link #getApnSetting()} and {@link ApnSetting#getMtuV6()} instead.
*/
+ @Deprecated
public int getMtuV6() {
if (mApnSetting != null) {
return mApnSetting.getMtuV6();
@@ -292,7 +315,9 @@
/**
* @return {@code true} if modem must persist this data profile.
+ * @deprecated Use {@link #getApnSetting()} and {@link ApnSetting#isPersistent()} instead.
*/
+ @Deprecated
public boolean isPersistent() {
if (mApnSetting != null) {
return mApnSetting.isPersistent();
@@ -320,16 +345,16 @@
}
/**
- * @return The APN setting
- * @hide TODO: Remove before T is released.
+ * @return The APN setting {@link ApnSetting}, which is used to establish data network on
+ * 2G/3G/4G.
*/
public @Nullable ApnSetting getApnSetting() {
return mApnSetting;
}
/**
- * @return The traffic descriptor
- * @hide TODO: Remove before T is released.
+ * @return The traffic descriptor {@link TrafficDescriptor}, which can be used to establish
+ * data network on 5G.
*/
public @Nullable TrafficDescriptor getTrafficDescriptor() {
return mTrafficDescriptor;
@@ -539,7 +564,10 @@
*
* @param profileId Network domain.
* @return The same instance of the builder.
+ * @deprecated use {@link #setApnSetting(ApnSetting)} and
+ * {@link ApnSetting.Builder#setProfileId(int)} instead.
*/
+ @Deprecated
public @NonNull Builder setProfileId(int profileId) {
mProfileId = profileId;
return this;
@@ -551,7 +579,10 @@
*
* @param apn Access point name
* @return The same instance of the builder.
+ * @deprecated use {@link #setApnSetting(ApnSetting)} and
+ * {@link ApnSetting.Builder#setApnName(String)} instead.
*/
+ @Deprecated
public @NonNull Builder setApn(@NonNull String apn) {
mApn = apn;
return this;
@@ -562,7 +593,10 @@
*
* @param protocolType The connection protocol defined in 3GPP TS 27.007 section 10.1.1.
* @return The same instance of the builder.
+ * @deprecated use {@link #setApnSetting(ApnSetting)} and
+ * {@link ApnSetting.Builder#setProtocol(int)} instead.
*/
+ @Deprecated
public @NonNull Builder setProtocolType(@ProtocolType int protocolType) {
mProtocolType = protocolType;
return this;
@@ -573,7 +607,10 @@
*
* @param authType The authentication type
* @return The same instance of the builder.
+ * @deprecated use {@link #setApnSetting(ApnSetting)} and
+ * {@link ApnSetting.Builder#setAuthType(int)} instead.
*/
+ @Deprecated
public @NonNull Builder setAuthType(@AuthType int authType) {
mAuthType = authType;
return this;
@@ -584,7 +621,10 @@
*
* @param userName The user name
* @return The same instance of the builder.
+ * @deprecated use {@link #setApnSetting(ApnSetting)} and
+ * {@link ApnSetting.Builder#setUser(String)} instead.
*/
+ @Deprecated
public @NonNull Builder setUserName(@NonNull String userName) {
mUserName = userName;
return this;
@@ -595,7 +635,10 @@
*
* @param password The password
* @return The same instance of the builder.
+ * @deprecated use {@link #setApnSetting(ApnSetting)} and
+ * {@link ApnSetting.Builder#setPassword(String)} (int)} instead.
*/
+ @Deprecated
public @NonNull Builder setPassword(@NonNull String password) {
mPassword = password;
return this;
@@ -628,7 +671,10 @@
*
* @param supportedApnTypesBitmask The supported APN types bitmask.
* @return The same instance of the builder.
+ * @deprecated use {@link #setApnSetting(ApnSetting)} and
+ * {@link ApnSetting.Builder#setApnTypeBitmask(int)} instead.
*/
+ @Deprecated
public @NonNull Builder setSupportedApnTypesBitmask(@ApnType int supportedApnTypesBitmask) {
mSupportedApnTypesBitmask = supportedApnTypesBitmask;
return this;
@@ -639,7 +685,10 @@
*
* @param protocolType The connection protocol defined in 3GPP TS 27.007 section 10.1.1.
* @return The same instance of the builder.
+ * @deprecated use {@link #setApnSetting(ApnSetting)} and
+ * {@link ApnSetting.Builder#setRoamingProtocol(int)} instead.
*/
+ @Deprecated
public @NonNull Builder setRoamingProtocolType(@ProtocolType int protocolType) {
mRoamingProtocolType = protocolType;
return this;
@@ -651,7 +700,10 @@
* @param bearerBitmask The bearer bitmask indicating the applicable networks for this data
* profile.
* @return The same instance of the builder.
+ * @deprecated use {@link #setApnSetting(ApnSetting)} and
+ * {@link ApnSetting.Builder#setNetworkTypeBitmask(int)} instead.
*/
+ @Deprecated
public @NonNull Builder setBearerBitmask(@NetworkTypeBitMask int bearerBitmask) {
mBearerBitmask = bearerBitmask;
return this;
@@ -662,7 +714,9 @@
*
* @param mtu The maximum transmission unit (MTU) size in bytes.
* @return The same instance of the builder.
- * @deprecated use {@link #setApnSetting(ApnSetting)} instead.
+ * @deprecated use {@link #setApnSetting(ApnSetting)} and
+ * {@link ApnSetting.Builder#setMtuV4(int)}/{@link ApnSetting.Builder#setMtuV6(int)}
+ * instead.
*/
@Deprecated
public @NonNull Builder setMtu(int mtu) {
@@ -672,11 +726,13 @@
/**
* Set the maximum transmission unit (MTU) size in bytes, for IPv4.
- * This replaces the deprecated method setMtu.
*
* @param mtu The maximum transmission unit (MTU) size in bytes.
* @return The same instance of the builder.
+ * @deprecated Use {{@link #setApnSetting(ApnSetting)}} and
+ * {@link ApnSetting.Builder#setMtuV4(int)} instead.
*/
+ @Deprecated
public @NonNull Builder setMtuV4(int mtu) {
mMtuV4 = mtu;
return this;
@@ -687,7 +743,10 @@
*
* @param mtu The maximum transmission unit (MTU) size in bytes.
* @return The same instance of the builder.
+ * @deprecated Use {{@link #setApnSetting(ApnSetting)}} and
+ * {@link ApnSetting.Builder#setMtuV6(int)} instead.
*/
+ @Deprecated
public @NonNull Builder setMtuV6(int mtu) {
mMtuV6 = mtu;
return this;
@@ -712,19 +771,23 @@
* @param isPersistent {@code true} if this data profile was used to bring up the last
* default (i.e internet) data connection successfully.
* @return The same instance of the builder.
+ * @deprecated Use {{@link #setApnSetting(ApnSetting)}} and
+ * {@link ApnSetting.Builder#setPersistent(boolean)} instead.
*/
+ @Deprecated
public @NonNull Builder setPersistent(boolean isPersistent) {
mPersistent = isPersistent;
return this;
}
/**
- * Set APN setting.
+ * Set the APN setting. Note that if an APN setting is not set here, then either
+ * {@link #setApn(String)} or {@link #setTrafficDescriptor(TrafficDescriptor)} must be
+ * called. Otherwise {@link IllegalArgumentException} will be thrown when {@link #build()}
+ * the data profile.
*
- * @param apnSetting APN setting
- * @return The same instance of the builder
- *
- * @hide // TODO: Remove before T is released.
+ * @param apnSetting The APN setting.
+ * @return The same instance of the builder.
*/
public @NonNull Builder setApnSetting(@NonNull ApnSetting apnSetting) {
mApnSetting = apnSetting;
@@ -732,12 +795,13 @@
}
/**
- * Set traffic descriptor.
+ * Set the traffic descriptor. Note that if a traffic descriptor is not set here, then
+ * either {@link #setApnSetting(ApnSetting)} or {@link #setApn(String)} must be called.
+ * Otherwise {@link IllegalArgumentException} will be thrown when {@link #build()} the data
+ * profile.
*
- * @param trafficDescriptor Traffic descriptor
- * @return The same instance of the builder
- *
- * @hide // TODO: Remove before T is released.
+ * @param trafficDescriptor The traffic descriptor.
+ * @return The same instance of the builder.
*/
public @NonNull Builder setTrafficDescriptor(@NonNull TrafficDescriptor trafficDescriptor) {
mTrafficDescriptor = trafficDescriptor;
@@ -745,9 +809,9 @@
}
/**
- * Build the DataProfile object
+ * Build the DataProfile object.
*
- * @return The data profile object
+ * @return The data profile object.
*/
public @NonNull DataProfile build() {
if (mApnSetting == null && mApn != null) {
diff --git a/telephony/java/android/telephony/ims/aidl/SipDelegateAidlWrapper.java b/telephony/java/android/telephony/ims/aidl/SipDelegateAidlWrapper.java
index f004824..b154a99 100644
--- a/telephony/java/android/telephony/ims/aidl/SipDelegateAidlWrapper.java
+++ b/telephony/java/android/telephony/ims/aidl/SipDelegateAidlWrapper.java
@@ -47,6 +47,9 @@
@Override
public void sendMessage(SipMessage sipMessage, long configVersion) {
SipDelegate d = mDelegate;
+ if (d == null) {
+ return;
+ }
final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(() -> d.sendMessage(sipMessage, configVersion));
@@ -58,6 +61,9 @@
@Override
public void notifyMessageReceived(String viaTransactionId) {
SipDelegate d = mDelegate;
+ if (d == null) {
+ return;
+ }
final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(() -> d.notifyMessageReceived(viaTransactionId));
@@ -70,6 +76,9 @@
@Override
public void notifyMessageReceiveError(String viaTransactionId, int reason) {
SipDelegate d = mDelegate;
+ if (d == null) {
+ return;
+ }
final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(() -> d.notifyMessageReceiveError(viaTransactionId, reason));
@@ -82,6 +91,9 @@
@Override
public void cleanupSession(String callId) {
SipDelegate d = mDelegate;
+ if (d == null) {
+ return;
+ }
final long token = Binder.clearCallingIdentity();
try {
mExecutor.execute(() -> d.cleanupSession(callId));
diff --git a/tools/processors/staledataclass/src/android/processor/staledataclass/StaleDataclassProcessor.kt b/tools/processors/staledataclass/src/android/processor/staledataclass/StaleDataclassProcessor.kt
index 1aec9b8..2e60f64 100644
--- a/tools/processors/staledataclass/src/android/processor/staledataclass/StaleDataclassProcessor.kt
+++ b/tools/processors/staledataclass/src/android/processor/staledataclass/StaleDataclassProcessor.kt
@@ -21,8 +21,6 @@
import com.android.codegen.CANONICAL_BUILDER_CLASS
import com.android.codegen.CODEGEN_NAME
import com.android.codegen.CODEGEN_VERSION
-import com.sun.tools.javac.code.Symbol
-import com.sun.tools.javac.code.Type
import java.io.File
import java.io.FileNotFoundException
import javax.annotation.processing.AbstractProcessor
@@ -33,6 +31,7 @@
import javax.lang.model.element.Element
import javax.lang.model.element.ElementKind
import javax.lang.model.element.TypeElement
+import javax.lang.model.type.ExecutableType
import javax.tools.Diagnostic
private const val STALE_FILE_THRESHOLD_MS = 1000
@@ -102,14 +101,13 @@
append(" ")
append(elem.annotationMirrors.joinToString(" ", transform = { annotationToString(it) }))
append(" ")
- if (elem is Symbol) {
- if (elem.type is Type.MethodType) {
- append((elem.type as Type.MethodType).returnType)
- } else {
- append(elem.type)
- }
- append(" ")
+ val type = elem.asType()
+ if (type is ExecutableType) {
+ append(type.returnType)
+ } else {
+ append(type)
}
+ append(" ")
append(elem)
}
}
@@ -234,4 +232,4 @@
override fun getSupportedSourceVersion(): SourceVersion {
return SourceVersion.latest()
}
-}
\ No newline at end of file
+}
diff --git a/tools/validatekeymaps/Android.bp b/tools/validatekeymaps/Android.bp
index 0423b7a..ff24d16 100644
--- a/tools/validatekeymaps/Android.bp
+++ b/tools/validatekeymaps/Android.bp
@@ -32,7 +32,7 @@
"libui-types",
],
target: {
- linux_glibc: {
+ host_linux: {
static_libs: [
// libbinder is only available for linux
"libbinder",