Merge "Add tool for injecting tracing code into a method."
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 b3a6a6c..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,8 +41760,10 @@
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
@@ -42065,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
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 9f0e9a4..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";
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/net/netstats/NetworkStatsDataMigrationUtils.java b/core/java/android/net/netstats/NetworkStatsDataMigrationUtils.java
index 2dd3aaa1..5c9989e 100644
--- a/core/java/android/net/netstats/NetworkStatsDataMigrationUtils.java
+++ b/core/java/android/net/netstats/NetworkStatsDataMigrationUtils.java
@@ -27,6 +27,7 @@
import static android.telephony.SubscriptionManager.INVALID_SUBSCRIPTION_ID;
import android.annotation.NonNull;
+import android.annotation.StringDef;
import android.annotation.SystemApi;
import android.net.NetworkIdentity;
import android.net.NetworkStatsCollection;
@@ -47,6 +48,8 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
import java.net.ProtocolException;
import java.util.ArrayList;
import java.util.HashMap;
@@ -76,6 +79,15 @@
*/
public static final String PREFIX_UID_TAG = "uid_tag";
+ /** @hide */
+ @StringDef(prefix = {"PREFIX_"}, value = {
+ PREFIX_XT,
+ PREFIX_UID,
+ PREFIX_UID_TAG,
+ })
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface Prefix {}
+
private static final HashMap<String, String> sPrefixLegacyFileNameMap =
new HashMap<String, String>() {{
put(PREFIX_XT, "netstats_xt.bin");
@@ -141,13 +153,13 @@
// Get /data/system/netstats_*.bin legacy files. Does not check for existence.
@NonNull
- private static File getLegacyBinFileForPrefix(@NonNull String prefix) {
+ private static File getLegacyBinFileForPrefix(@NonNull @Prefix String prefix) {
return new File(getPlatformSystemDir(), sPrefixLegacyFileNameMap.get(prefix));
}
// List /data/system/netstats/[xt|uid|uid_tag].<start>-<end> legacy files.
@NonNull
- private static ArrayList<File> getPlatformFileListForPrefix(@NonNull String prefix) {
+ private static ArrayList<File> getPlatformFileListForPrefix(@NonNull @Prefix String prefix) {
final ArrayList<File> list = new ArrayList<>();
final File platformFiles = new File(getPlatformBaseDir(), "netstats");
if (platformFiles.exists()) {
@@ -207,7 +219,7 @@
*/
@NonNull
public static NetworkStatsCollection readPlatformCollection(
- @NonNull String prefix, long bucketDuration) throws IOException {
+ @NonNull @Prefix String prefix, long bucketDuration) throws IOException {
final NetworkStatsCollection.Builder builder =
new NetworkStatsCollection.Builder(bucketDuration);
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/ParcelableHolder.java b/core/java/android/os/ParcelableHolder.java
index 368ee2d..a739ba3 100644
--- a/core/java/android/os/ParcelableHolder.java
+++ b/core/java/android/os/ParcelableHolder.java
@@ -179,7 +179,11 @@
* Read ParcelableHolder from a parcel.
*/
public void readFromParcel(@NonNull Parcel parcel) {
- this.mStability = parcel.readInt();
+ int wireStability = parcel.readInt();
+ if (this.mStability != wireStability) {
+ throw new IllegalArgumentException("Expected stability " + this.mStability
+ + " but got " + wireStability);
+ }
mParcelable = null;
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/IStorageManager.aidl b/core/java/android/os/storage/IStorageManager.aidl
index 6c0a1f9..5bf1b04 100644
--- a/core/java/android/os/storage/IStorageManager.aidl
+++ b/core/java/android/os/storage/IStorageManager.aidl
@@ -78,37 +78,10 @@
*/
String getMountedObbPath(in String rawPath) = 24;
/**
- * Decrypts any encrypted volumes.
- */
- int decryptStorage(in String password) = 26;
- /**
- * Encrypts storage.
- */
- int encryptStorage(int type, in String password) = 27;
- /**
- * Changes the encryption password.
- */
- int changeEncryptionPassword(int type, in String password) = 28;
- /**
* Returns list of all mountable volumes.
*/
StorageVolume[] getVolumeList(int uid, in String packageName, int flags) = 29;
/**
- * Determines the encryption state of the volume.
- * @return a numerical value. See {@code ENCRYPTION_STATE_*} for possible
- * values.
- * Note that this has been replaced in most cases by the APIs in
- * StorageManager (see isEncryptable and below)
- * This is still useful to get the error state when encryption has failed
- * and CryptKeeper needs to throw up a screen advising the user what to do
- */
- int getEncryptionState() = 31;
- /**
- * Verify the encryption password against the stored volume. This method
- * may only be called by the system process.
- */
- int verifyEncryptionPassword(in String password) = 32;
- /**
* Ensure that all directories along given path exist, creating parent
* directories as needed. Validates that given path is absolute and that it
* contains no relative "." or ".." paths or symlinks. Also ensures that
@@ -117,32 +90,6 @@
*/
void mkdirs(in String callingPkg, in String path) = 34;
/**
- * Determines the type of the encryption password
- * @return PasswordType
- */
- int getPasswordType() = 35;
- /**
- * Get password from vold
- * @return password or empty string
- */
- String getPassword() = 36;
- /**
- * Securely clear password from vold
- */
- oneway void clearPassword() = 37;
- /**
- * Set a field in the crypto header.
- * @param field field to set
- * @param contents contents to set in field
- */
- oneway void setField(in String field, in String contents) = 38;
- /**
- * Gets a field from the crypto header.
- * @param field field to get
- * @return contents of field
- */
- String getField(in String field) = 39;
- /**
* Report the time of the last maintenance operation such as fstrim.
* @return Timestamp of the last maintenance operation, in the
* System.currentTimeMillis() time base
@@ -173,13 +120,13 @@
void setDebugFlags(int flags, int mask) = 60;
void createUserKey(int userId, int serialNumber, boolean ephemeral) = 61;
void destroyUserKey(int userId) = 62;
- void unlockUserKey(int userId, int serialNumber, in byte[] token, in byte[] secret) = 63;
+ void unlockUserKey(int userId, int serialNumber, in byte[] secret) = 63;
void lockUserKey(int userId) = 64;
boolean isUserKeyUnlocked(int userId) = 65;
void prepareUserStorage(in String volumeUuid, int userId, int serialNumber, int flags) = 66;
void destroyUserStorage(in String volumeUuid, int userId, int flags) = 67;
boolean isConvertibleToFBE() = 68;
- void addUserKeyAuth(int userId, int serialNumber, in byte[] token, in byte[] secret) = 70;
+ void addUserKeyAuth(int userId, int serialNumber, in byte[] secret) = 70;
void fixateNewestUserKeyAuth(int userId) = 71;
void fstrim(int flags, IVoldTaskListener listener) = 72;
AppFuseMount mountProxyFileDescriptorBridge() = 73;
@@ -195,7 +142,7 @@
void startCheckpoint(int numTries) = 85;
boolean needsCheckpoint() = 86;
void abortChanges(in String message, boolean retry) = 87;
- void clearUserKeyAuth(int userId, int serialNumber, in byte[] token, in byte[] secret) = 88;
+ void clearUserKeyAuth(int userId, int serialNumber, in byte[] secret) = 88;
void fixupAppDir(in String path) = 89;
void disableAppDataIsolation(in String pkgName, int pid, int userId) = 90;
void notifyAppIoBlocked(in String volumeUuid, int uid, int tid, int reason) = 91;
diff --git a/core/java/android/os/storage/StorageManager.java b/core/java/android/os/storage/StorageManager.java
index 39f87d5..6dd878c 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;
@@ -1529,9 +1528,9 @@
}
/** {@hide} */
- public void unlockUserKey(int userId, int serialNumber, byte[] token, byte[] secret) {
+ public void unlockUserKey(int userId, int serialNumber, byte[] secret) {
try {
- mStorageManager.unlockUserKey(userId, serialNumber, token, secret);
+ mStorageManager.unlockUserKey(userId, serialNumber, secret);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
@@ -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} */
@@ -2921,14 +2904,4 @@
public static final int CRYPT_TYPE_PATTERN = IVold.PASSWORD_TYPE_PATTERN;
/** @hide */
public static final int CRYPT_TYPE_PIN = IVold.PASSWORD_TYPE_PIN;
-
- // Constants for the data available via StorageManagerService.getField.
- /** @hide */
- public static final String SYSTEM_LOCALE_KEY = "SystemLocale";
- /** @hide */
- public static final String OWNER_INFO_KEY = "OwnerInfo";
- /** @hide */
- public static final String PATTERN_VISIBLE_KEY = "PatternVisible";
- /** @hide */
- public static final String PASSWORD_VISIBLE_KEY = "PasswordVisible";
}
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/TelephonyCallback.java b/core/java/android/telephony/TelephonyCallback.java
index baa9e6b..e8960b8 100644
--- a/core/java/android/telephony/TelephonyCallback.java
+++ b/core/java/android/telephony/TelephonyCallback.java
@@ -1409,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..0f964fc 100644
--- a/core/java/com/android/internal/widget/ILockSettings.aidl
+++ b/core/java/com/android/internal/widget/ILockSettings.aidl
@@ -51,7 +51,6 @@
VerifyCredentialResponse verifyTiedProfileChallenge(in LockscreenCredential credential, int userId, int flags);
VerifyCredentialResponse verifyGatekeeperPasswordHandle(long gatekeeperPasswordHandle, long challenge, int userId);
void removeGatekeeperPasswordHandle(long gatekeeperPasswordHandle);
- boolean checkVoldPassword(int userId);
int getCredentialType(int userId);
byte[] getHashFactor(in LockscreenCredential currentCredential, int userId);
void setSeparateProfileChallengeEnabled(int userId, boolean enabled, in LockscreenCredential managedUserPassword);
@@ -95,5 +94,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..e915969 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -505,20 +505,6 @@
}
/**
- * Check to see if vold already has the password.
- * Note that this also clears vold's copy of the password.
- * @return Whether the vold password matches or not.
- */
- public boolean checkVoldPassword(int userId) {
- try {
- return getLockSettings().checkVoldPassword(userId);
- } catch (RemoteException re) {
- Log.e(TAG, "failed to check vold password", re);
- return false;
- }
- }
-
- /**
* Returns the password history hash factor, needed to check new password against password
* history with {@link #checkPasswordHistory(byte[], byte[], int)}
*/
@@ -701,38 +687,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 +749,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 +939,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 +949,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..cb3e465 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
@@ -2565,10 +2565,27 @@
<!-- Configure mobile tcp buffer sizes in the form:
rat-name:rmem_min,rmem_def,rmem_max,wmem_min,wmem_def,wmem_max
If no value is found for the rat-name in use, the system default will be applied.
+
+ This is deprecated. Please use config_tcp_buffers.
-->
<string-array name="config_mobile_tcp_buffers">
</string-array>
+ <!-- Configure tcp buffer sizes in the form:
+ rmem_min,rmem_def,rmem_max,wmem_min,wmem_def,wmem_max
+ If this is configured as an empty string, the system default will be applied.
+
+ For now this config is used by mobile data only. In the future it should be
+ used by Wi-Fi as well.
+
+ Note that starting from Android 13, the TCP buffer size is fixed after boot up, and should
+ never be changed based on carriers or the network types. The value should be configured
+ appropriately based on the device's memory and performance. It is recommended to use lower
+ values if the device has low memory or doesn't support high-speed network such like LTE,
+ NR, or Wifi.
+ -->
+ <string name="config_tcp_buffers" translatable="false"></string>
+
<!-- Configure ethernet tcp buffersizes in the form:
rmem_min,rmem_def,rmem_max,wmem_min,wmem_def,wmem_max -->
<string name="config_ethernet_tcp_buffers" translatable="false">524288,1048576,3145728,524288,1048576,2097152</string>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 045460b..55e2ca6 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -466,6 +466,7 @@
<java-symbol type="integer" name="config_safe_media_volume_usb_mB" />
<java-symbol type="integer" name="config_mobile_mtu" />
<java-symbol type="array" name="config_mobile_tcp_buffers" />
+ <java-symbol type="string" name="config_tcp_buffers" />
<java-symbol type="integer" name="config_volte_replacement_rat"/>
<java-symbol type="integer" name="config_valid_wappush_index" />
<java-symbol type="integer" name="config_overrideHasPermanentMenuKey" />
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/WindowManager/OWNERS b/libs/WindowManager/OWNERS
index 2c61df9..780e4c1 100644
--- a/libs/WindowManager/OWNERS
+++ b/libs/WindowManager/OWNERS
@@ -1,3 +1,6 @@
set noparent
include /services/core/java/com/android/server/wm/OWNERS
+
+# Give submodule owners in shell resource approval
+per-file Shell/res*/*/*.xml = hwwang@google.com, lbill@google.com, madym@google.com
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/libs/storage/IMountService.cpp b/libs/storage/IMountService.cpp
index 055dbb2..99508a2 100644
--- a/libs/storage/IMountService.cpp
+++ b/libs/storage/IMountService.cpp
@@ -48,8 +48,6 @@
TRANSACTION_isObbMounted,
TRANSACTION_getMountedObbPath,
TRANSACTION_isExternalStorageEmulated,
- TRANSACTION_decryptStorage,
- TRANSACTION_encryptStorage,
};
class BpMountService: public BpInterface<IMountService>
@@ -517,40 +515,6 @@
path = reply.readString16();
return true;
}
-
- int32_t decryptStorage(const String16& password)
- {
- Parcel data, reply;
- data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
- data.writeString16(password);
- if (remote()->transact(TRANSACTION_decryptStorage, data, &reply) != NO_ERROR) {
- ALOGD("decryptStorage could not contact remote\n");
- return -1;
- }
- int32_t err = reply.readExceptionCode();
- if (err < 0) {
- ALOGD("decryptStorage caught exception %d\n", err);
- return err;
- }
- return reply.readInt32();
- }
-
- int32_t encryptStorage(const String16& password)
- {
- Parcel data, reply;
- data.writeInterfaceToken(IMountService::getInterfaceDescriptor());
- data.writeString16(password);
- if (remote()->transact(TRANSACTION_encryptStorage, data, &reply) != NO_ERROR) {
- ALOGD("encryptStorage could not contact remote\n");
- return -1;
- }
- int32_t err = reply.readExceptionCode();
- if (err < 0) {
- ALOGD("encryptStorage caught exception %d\n", err);
- return err;
- }
- return reply.readInt32();
- }
};
IMPLEMENT_META_INTERFACE(MountService, "android.os.storage.IStorageManager")
diff --git a/libs/storage/include/storage/IMountService.h b/libs/storage/include/storage/IMountService.h
index 5b07318..5a9c39b 100644
--- a/libs/storage/include/storage/IMountService.h
+++ b/libs/storage/include/storage/IMountService.h
@@ -70,8 +70,6 @@
const sp<IObbActionListener>& token, const int32_t nonce) = 0;
virtual bool isObbMounted(const String16& filename) = 0;
virtual bool getMountedObbPath(const String16& filename, String16& path) = 0;
- virtual int32_t decryptStorage(const String16& password) = 0;
- virtual int32_t encryptStorage(const String16& password) = 0;
};
// ----------------------------------------------------------------------------
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/BackupRestoreConfirmation/res/values/strings.xml b/packages/BackupRestoreConfirmation/res/values/strings.xml
index 3fb3fd4..5c90fd0 100644
--- a/packages/BackupRestoreConfirmation/res/values/strings.xml
+++ b/packages/BackupRestoreConfirmation/res/values/strings.xml
@@ -44,8 +44,6 @@
<string name="backup_enc_password_text">Please enter a password to use for encrypting the full backup data. If this is left blank, your current backup password will be used:</string>
<!-- Text for message to user that they may optionally supply an encryption password to use for a full backup operation. -->
<string name="backup_enc_password_optional">If you wish to encrypt the full backup data, enter a password below:</string>
- <!-- Text for message to user that they must supply an encryption password to use for a full backup operation because their phone is locked. -->
- <string name="backup_enc_password_required">Since your device is encrypted, you are required to encrypt your backup. Please enter a password below:</string>
<!-- Text for message to user when performing a full restore operation, explaining that they must enter the password originally used to encrypt the full backup data. -->
<string name="restore_enc_password_text">If the restore data is encrypted, please enter the password below:</string>
diff --git a/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java b/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java
index d6b6bf8..3c790f0 100644
--- a/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java
+++ b/packages/BackupRestoreConfirmation/src/com/android/backupconfirm/BackupRestoreConfirmation.java
@@ -27,8 +27,6 @@
import android.os.Message;
import android.os.RemoteException;
import android.os.ServiceManager;
-import android.os.storage.IStorageManager;
-import android.os.storage.StorageManager;
import android.text.Editable;
import android.text.TextWatcher;
import android.util.Slog;
@@ -66,10 +64,8 @@
Handler mHandler;
IBackupManager mBackupManager;
- IStorageManager mStorageManager;
FullObserver mObserver;
int mToken;
- boolean mIsEncrypted;
boolean mDidAcknowledge;
String mAction;
@@ -144,7 +140,6 @@
}
mBackupManager = IBackupManager.Stub.asInterface(ServiceManager.getService(Context.BACKUP_SERVICE));
- mStorageManager = IStorageManager.Stub.asInterface(ServiceManager.getService("mount"));
mHandler = new ObserverHandler(getApplicationContext());
final Object oldObserver = getLastNonConfigurationInstance();
@@ -248,20 +243,13 @@
mDenyButton.setEnabled(!mDidAcknowledge);
}
- // We vary the password prompt depending on whether one is predefined, and whether
- // the device is encrypted.
- mIsEncrypted = deviceIsEncrypted();
+ // We vary the password prompt depending on whether one is predefined.
if (!haveBackupPassword()) {
curPwDesc.setVisibility(View.GONE);
mCurPassword.setVisibility(View.GONE);
if (layoutId == R.layout.confirm_backup) {
TextView encPwDesc = findViewById(R.id.enc_password_desc);
- if (mIsEncrypted) {
- encPwDesc.setText(R.string.backup_enc_password_required);
- monitorEncryptionPassword();
- } else {
- encPwDesc.setText(R.string.backup_enc_password_optional);
- }
+ encPwDesc.setText(R.string.backup_enc_password_optional);
}
}
}
@@ -312,20 +300,6 @@
}
}
- boolean deviceIsEncrypted() {
- try {
- return mStorageManager.getEncryptionState()
- != StorageManager.ENCRYPTION_STATE_NONE
- && mStorageManager.getPasswordType()
- != StorageManager.CRYPT_TYPE_DEFAULT;
- } catch (Exception e) {
- // If we can't talk to the storagemanager service we have a serious problem; fail
- // "secure" i.e. assuming that the device is encrypted.
- Slog.e(TAG, "Unable to communicate with storagemanager service: " + e.getMessage());
- return true;
- }
- }
-
boolean haveBackupPassword() {
try {
return mBackupManager.hasBackupPassword();
diff --git a/packages/ConnectivityT/framework-t/src/android/app/usage/NetworkStatsManager.java b/packages/ConnectivityT/framework-t/src/android/app/usage/NetworkStatsManager.java
index ca080ce..bf518b2 100644
--- a/packages/ConnectivityT/framework-t/src/android/app/usage/NetworkStatsManager.java
+++ b/packages/ConnectivityT/framework-t/src/android/app/usage/NetworkStatsManager.java
@@ -1061,9 +1061,9 @@
@RequiresPermission(anyOf = {
NetworkStack.PERMISSION_MAINLINE_NETWORK_STACK,
android.Manifest.permission.NETWORK_STACK})
- public void setUidForeground(int uid, boolean uidForeground) {
+ public void noteUidForeground(int uid, boolean uidForeground) {
try {
- mService.setUidForeground(uid, uidForeground);
+ mService.noteUidForeground(uid, uidForeground);
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
}
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/INetworkStatsService.aidl b/packages/ConnectivityT/framework-t/src/android/net/INetworkStatsService.aidl
index efe626d..c86f7fd 100644
--- a/packages/ConnectivityT/framework-t/src/android/net/INetworkStatsService.aidl
+++ b/packages/ConnectivityT/framework-t/src/android/net/INetworkStatsService.aidl
@@ -91,7 +91,7 @@
in INetworkStatsProvider provider);
/** Mark given UID as being in foreground for stats purposes. */
- void setUidForeground(int uid, boolean uidForeground);
+ void noteUidForeground(int uid, boolean uidForeground);
/** Advise persistence threshold; may be overridden internally. */
void advisePersistThreshold(long thresholdBytes);
diff --git a/packages/ConnectivityT/framework-t/src/android/net/NetworkStats.java b/packages/ConnectivityT/framework-t/src/android/net/NetworkStats.java
index f681ba1..06f2a62 100644
--- a/packages/ConnectivityT/framework-t/src/android/net/NetworkStats.java
+++ b/packages/ConnectivityT/framework-t/src/android/net/NetworkStats.java
@@ -327,16 +327,11 @@
* @param uid uid of this {@link Entry}. {@link #UID_TETHERING} if this {@link Entry} is
* for tethering. Or {@link #UID_ALL} if this {@link NetworkStats} is only
* counting iface stats.
- * @param set usage state of this {@link Entry}. Should be one of the following
- * values: {@link #SET_DEFAULT}, {@link #SET_FOREGROUND}.
+ * @param set usage state of this {@link Entry}.
* @param tag tag of this {@link Entry}.
- * @param metered metered state of this {@link Entry}. Should be one of the following
- * values: {link #METERED_YES}, {link #METERED_NO}.
- * @param roaming roaming state of this {@link Entry}. Should be one of the following
- * values: {link #ROAMING_YES}, {link #ROAMING_NO}.
- * @param defaultNetwork default network status of this {@link Entry}. Should be one
- * of the following values: {link #DEFAULT_NETWORK_YES},
- * {link #DEFAULT_NETWORK_NO}.
+ * @param metered metered state of this {@link Entry}.
+ * @param roaming roaming state of this {@link Entry}.
+ * @param defaultNetwork default network status of this {@link Entry}.
* @param rxBytes Number of bytes received for this {@link Entry}. Statistics should
* represent the contents of IP packets, including IP headers.
* @param rxPackets Number of packets received for this {@link Entry}. Statistics should
@@ -401,8 +396,7 @@
}
/**
- * @return the set state of this entry. Should be one of the following
- * values: {@link #SET_DEFAULT}, {@link #SET_FOREGROUND}.
+ * @return the set state of this entry.
*/
@State public int getSet() {
return set;
@@ -416,24 +410,21 @@
}
/**
- * @return the metered state. Should be one of the following
- * values: {link #METERED_YES}, {link #METERED_NO}.
+ * @return the metered state.
*/
@Meteredness public int getMetered() {
return metered;
}
/**
- * @return the roaming state. Should be one of the following
- * values: {link #ROAMING_YES}, {link #ROAMING_NO}.
+ * @return the roaming state.
*/
@Roaming public int getRoaming() {
return roaming;
}
/**
- * @return the default network state. Should be one of the following
- * values: {link #DEFAULT_NETWORK_YES}, {link #DEFAULT_NETWORK_NO}.
+ * @return the default network state.
*/
@DefaultNetwork public int getDefaultNetwork() {
return defaultNetwork;
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 f835581..3db635b 100644
--- a/packages/ConnectivityT/service/src/com/android/server/net/NetworkStatsService.java
+++ b/packages/ConnectivityT/service/src/com/android/server/net/NetworkStatsService.java
@@ -1194,7 +1194,7 @@
}
@VisibleForTesting
- public void setUidForeground(int uid, boolean uidForeground) {
+ public void noteUidForeground(int uid, boolean uidForeground) {
PermissionUtils.enforceNetworkStackPermission(mContext);
synchronized (mStatsLock) {
final int set = uidForeground ? SET_FOREGROUND : SET_DEFAULT;
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/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/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index e9f288d..896f01a 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -1573,14 +1573,6 @@
if (DEBUG) Log.d(TAG, "doKeyguard: not showing because lockscreen is off");
return;
}
-
- if (mLockPatternUtils.checkVoldPassword(KeyguardUpdateMonitor.getCurrentUser())) {
- if (DEBUG) Log.d(TAG, "Not showing lock screen since just decrypted");
- // Without this, settings is not enabled until the lock screen first appears
- setShowingLocked(false);
- hideLocked();
- return;
- }
}
if (DEBUG) Log.d(TAG, "doKeyguard: showing the lock screen");
diff --git a/services/backup/java/com/android/server/backup/UserBackupManagerService.java b/services/backup/java/com/android/server/backup/UserBackupManagerService.java
index 0b95fef..65b1776 100644
--- a/services/backup/java/com/android/server/backup/UserBackupManagerService.java
+++ b/services/backup/java/com/android/server/backup/UserBackupManagerService.java
@@ -89,8 +89,6 @@
import android.os.SystemClock;
import android.os.UserHandle;
import android.os.WorkSource;
-import android.os.storage.IStorageManager;
-import android.os.storage.StorageManager;
import android.provider.Settings;
import android.text.TextUtils;
import android.util.ArraySet;
@@ -336,7 +334,6 @@
private final ActivityManagerInternal mActivityManagerInternal;
private PowerManager mPowerManager;
private final AlarmManager mAlarmManager;
- private final IStorageManager mStorageManager;
private final BackupManagerConstants mConstants;
private final BackupWakeLock mWakelock;
private final BackupHandler mBackupHandler;
@@ -567,7 +564,6 @@
mBackupPasswordManager = null;
mPackageManagerBinder = null;
mActivityManager = null;
- mStorageManager = null;
mBackupManagerBinder = null;
mScheduledBackupEligibility = null;
}
@@ -591,7 +587,6 @@
mAlarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
- mStorageManager = IStorageManager.Stub.asInterface(ServiceManager.getService("mount"));
Objects.requireNonNull(parent, "parent cannot be null");
mBackupManagerBinder = BackupManagerService.asInterface(parent.asBinder());
@@ -2252,26 +2247,6 @@
}
}
- /** For adb backup/restore. */
- public boolean deviceIsEncrypted() {
- try {
- return mStorageManager.getEncryptionState()
- != StorageManager.ENCRYPTION_STATE_NONE
- && mStorageManager.getPasswordType()
- != StorageManager.CRYPT_TYPE_DEFAULT;
- } catch (Exception e) {
- // If we can't talk to the storagemanager service we have a serious problem; fail
- // "secure" i.e. assuming that the device is encrypted.
- Slog.e(
- TAG,
- addUserIdToLogMessage(
- mUserId,
- "Unable to communicate with storagemanager service: "
- + e.getMessage()));
- return true;
- }
- }
-
// ----- Full-data backup scheduling -----
/**
diff --git a/services/backup/java/com/android/server/backup/fullbackup/PerformAdbBackupTask.java b/services/backup/java/com/android/server/backup/fullbackup/PerformAdbBackupTask.java
index 448e086..01d90f6 100644
--- a/services/backup/java/com/android/server/backup/fullbackup/PerformAdbBackupTask.java
+++ b/services/backup/java/com/android/server/backup/fullbackup/PerformAdbBackupTask.java
@@ -316,12 +316,6 @@
try {
boolean encrypting = (mEncryptPassword != null && mEncryptPassword.length() > 0);
- // Only allow encrypted backups of encrypted devices
- if (mUserBackupManagerService.deviceIsEncrypted() && !encrypting) {
- Slog.e(TAG, "Unencrypted backup of encrypted device; aborting");
- return;
- }
-
OutputStream finalOutput = ofstream;
// Verify that the given password matches the currently-active
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..9c8cb8c 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;
@@ -1122,8 +1120,7 @@
if (initLocked) {
mVold.lockUserKey(user.id);
} else {
- mVold.unlockUserKey(user.id, user.serialNumber, encodeBytes(null),
- encodeBytes(null));
+ mVold.unlockUserKey(user.id, user.serialNumber, encodeBytes(null));
}
} catch (Exception e) {
Slog.wtf(TAG, e);
@@ -1380,39 +1377,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() {
@@ -3107,203 +3071,6 @@
}
}
- @Override
- public int getEncryptionState() {
- mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER,
- "no permission to access the crypt keeper");
-
- try {
- return mVold.fdeComplete();
- } catch (Exception e) {
- Slog.wtf(TAG, e);
- return StorageManager.ENCRYPTION_STATE_ERROR_UNKNOWN;
- }
- }
-
- @Override
- public int decryptStorage(String password) {
- mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER,
- "no permission to access the crypt keeper");
-
- if (TextUtils.isEmpty(password)) {
- throw new IllegalArgumentException("password cannot be empty");
- }
-
- if (DEBUG_EVENTS) {
- Slog.i(TAG, "decrypting storage...");
- }
-
- try {
- mVold.fdeCheckPassword(password);
- mHandler.postDelayed(() -> {
- try {
- mVold.fdeRestart();
- } catch (Exception e) {
- Slog.wtf(TAG, e);
- }
- }, DateUtils.SECOND_IN_MILLIS);
- return 0;
- } catch (ServiceSpecificException e) {
- Slog.e(TAG, "fdeCheckPassword failed", e);
- return e.errorCode;
- } catch (Exception e) {
- Slog.wtf(TAG, e);
- return StorageManager.ENCRYPTION_STATE_ERROR_UNKNOWN;
- }
- }
-
- @Override
- public int encryptStorage(int type, String password) {
- mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER,
- "no permission to access the crypt keeper");
-
- if (type == StorageManager.CRYPT_TYPE_DEFAULT) {
- password = "";
- } else if (TextUtils.isEmpty(password)) {
- throw new IllegalArgumentException("password cannot be empty");
- }
-
- if (DEBUG_EVENTS) {
- Slog.i(TAG, "encrypting storage...");
- }
-
- try {
- mVold.fdeEnable(type, password, 0);
- } catch (Exception e) {
- Slog.wtf(TAG, e);
- return -1;
- }
-
- return 0;
- }
-
- /** Set the password for encrypting the main key.
- * @param type One of the CRYPTO_TYPE_XXX consts defined in StorageManager.
- * @param password The password to set.
- */
- @Override
- public int changeEncryptionPassword(int type, String password) {
- mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER,
- "no permission to access the crypt keeper");
-
- if (StorageManager.isFileEncryptedNativeOnly()) {
- // Not supported on FBE devices
- return -1;
- }
-
- if (type == StorageManager.CRYPT_TYPE_DEFAULT) {
- password = "";
- } else if (TextUtils.isEmpty(password)) {
- throw new IllegalArgumentException("password cannot be empty");
- }
-
- if (DEBUG_EVENTS) {
- Slog.i(TAG, "changing encryption password...");
- }
-
- try {
- mVold.fdeChangePassword(type, password);
- return 0;
- } catch (Exception e) {
- Slog.wtf(TAG, e);
- return -1;
- }
- }
-
- /**
- * Validate a user-supplied password string with cryptfs
- */
- @Override
- public int verifyEncryptionPassword(String password) throws RemoteException {
- // Only the system process is permitted to validate passwords
- if (Binder.getCallingUid() != android.os.Process.SYSTEM_UID) {
- throw new SecurityException("no permission to access the crypt keeper");
- }
-
- mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER,
- "no permission to access the crypt keeper");
-
- if (TextUtils.isEmpty(password)) {
- throw new IllegalArgumentException("password cannot be empty");
- }
-
- if (DEBUG_EVENTS) {
- Slog.i(TAG, "validating encryption password...");
- }
-
- try {
- mVold.fdeVerifyPassword(password);
- return 0;
- } catch (Exception e) {
- Slog.wtf(TAG, e);
- return -1;
- }
- }
-
- /**
- * Get the type of encryption used to encrypt the main key.
- * @return The type, one of the CRYPT_TYPE_XXX consts from StorageManager.
- */
- @Override
- public int getPasswordType() {
- mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER,
- "no permission to access the crypt keeper");
-
- try {
- return mVold.fdeGetPasswordType();
- } catch (Exception e) {
- Slog.wtf(TAG, e);
- return -1;
- }
- }
-
- /**
- * Set a field in the crypto header.
- * @param field field to set
- * @param contents contents to set in field
- */
- @Override
- public void setField(String field, String contents) throws RemoteException {
- mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER,
- "no permission to access the crypt keeper");
-
- if (!StorageManager.isBlockEncrypted()) {
- // Only supported on FDE devices
- return;
- }
-
- try {
- mVold.fdeSetField(field, contents);
- return;
- } catch (Exception e) {
- Slog.wtf(TAG, e);
- return;
- }
- }
-
- /**
- * Gets a field from the crypto header.
- * @param field field to get
- * @return contents of field
- */
- @Override
- public String getField(String field) throws RemoteException {
- mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER,
- "no permission to access the crypt keeper");
-
- if (!StorageManager.isBlockEncrypted()) {
- // Only supported on FDE devices
- return null;
- }
-
- try {
- return mVold.fdeGetField(field);
- } catch (Exception e) {
- Slog.wtf(TAG, e);
- return null;
- }
- }
-
/**
* Is userdata convertible to file based encryption?
* @return non zero for convertible
@@ -3386,33 +3153,6 @@
}
@Override
- public String getPassword() throws RemoteException {
- mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER,
- "only keyguard can retrieve password");
-
- try {
- return mVold.fdeGetPassword();
- } catch (Exception e) {
- Slog.wtf(TAG, e);
- return null;
- }
- }
-
- @Override
- public void clearPassword() throws RemoteException {
- mContext.enforceCallingOrSelfPermission(Manifest.permission.CRYPT_KEEPER,
- "only keyguard can clear password");
-
- try {
- mVold.fdeClearPassword();
- return;
- } catch (Exception e) {
- Slog.wtf(TAG, e);
- return;
- }
- }
-
- @Override
public void createUserKey(int userId, int serialNumber, boolean ephemeral) {
enforcePermission(android.Manifest.permission.STORAGE_INTERNAL);
@@ -3443,43 +3183,45 @@
}
/*
- * Add this token/secret pair to the set of ways we can recover a disk encryption key.
- * Changing the token/secret for a disk encryption key is done in two phases: first, adding
- * a new token/secret pair with this call, then delting all other pairs with
- * fixateNewestUserKeyAuth. This allows other places where a credential is used, such as
- * Gatekeeper, to be updated between the two calls.
+ * Add this secret to the set of ways we can recover a user's disk
+ * encryption key. Changing the secret for a disk encryption key is done in
+ * two phases. First, this method is called to add the new secret binding.
+ * Second, fixateNewestUserKeyAuth is called to delete all other bindings.
+ * This allows other places where a credential is used, such as Gatekeeper,
+ * to be updated between the two calls.
*/
@Override
- public void addUserKeyAuth(int userId, int serialNumber, byte[] token, byte[] secret) {
+ public void addUserKeyAuth(int userId, int serialNumber, byte[] secret) {
enforcePermission(android.Manifest.permission.STORAGE_INTERNAL);
try {
- mVold.addUserKeyAuth(userId, serialNumber, encodeBytes(token), encodeBytes(secret));
+ mVold.addUserKeyAuth(userId, serialNumber, encodeBytes(secret));
} catch (Exception e) {
Slog.wtf(TAG, e);
}
}
/*
- * Clear disk encryption key bound to the associated token / secret pair. Removing the user
- * binding of the Disk encryption key is done in two phases: first, this call will retrieve
- * the disk encryption key using the provided token / secret pair and store it by
- * encrypting it with a keymaster key not bound to the user, then fixateNewestUserKeyAuth
- * is called to delete all other bindings of the disk encryption key.
+ * Store a user's disk encryption key without secret binding. Removing the
+ * secret for a disk encryption key is done in two phases. First, this
+ * method is called to retrieve the key using the provided secret and store
+ * it encrypted with a keystore key not bound to the user. Second,
+ * fixateNewestUserKeyAuth is called to delete the key's other bindings.
*/
@Override
- public void clearUserKeyAuth(int userId, int serialNumber, byte[] token, byte[] secret) {
+ public void clearUserKeyAuth(int userId, int serialNumber, byte[] secret) {
enforcePermission(android.Manifest.permission.STORAGE_INTERNAL);
try {
- mVold.clearUserKeyAuth(userId, serialNumber, encodeBytes(token), encodeBytes(secret));
+ mVold.clearUserKeyAuth(userId, serialNumber, encodeBytes(secret));
} catch (Exception e) {
Slog.wtf(TAG, e);
}
}
/*
- * Delete all disk encryption token/secret pairs except the most recently added one
+ * Delete all bindings of a user's disk encryption key except the most
+ * recently added one.
*/
@Override
public void fixateNewestUserKeyAuth(int userId) {
@@ -3493,11 +3235,10 @@
}
@Override
- public void unlockUserKey(int userId, int serialNumber, byte[] token, byte[] secret) {
+ public void unlockUserKey(int userId, int serialNumber, byte[] secret) {
boolean isFsEncrypted = StorageManager.isFileEncryptedNativeOrEmulated();
Slog.d(TAG, "unlockUserKey: " + userId
+ " isFileEncryptedNativeOrEmulated: " + isFsEncrypted
- + " hasToken: " + (token != null)
+ " hasSecret: " + (secret != null));
enforcePermission(android.Manifest.permission.STORAGE_INTERNAL);
@@ -3517,8 +3258,7 @@
return;
}
try {
- mVold.unlockUserKey(userId, serialNumber, encodeBytes(token),
- encodeBytes(secret));
+ mVold.unlockUserKey(userId, serialNumber, encodeBytes(secret));
} catch (Exception e) {
Slog.wtf(TAG, e);
return;
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 9f59a5f..f978b2b 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -15108,9 +15108,23 @@
return mUserController.startUser(userId, /* foreground */ true, unlockListener);
}
+ /**
+ * Unlocks the given user.
+ *
+ * @param userId The ID of the user to unlock.
+ * @param token No longer used. (This parameter cannot be removed because
+ * this method is marked with UnsupportedAppUsage, so its
+ * signature might not be safe to change.)
+ * @param secret The secret needed to unlock the user's credential-encrypted
+ * storage, or null if no secret is needed.
+ * @param listener An optional progress listener.
+ *
+ * @return true if the user was successfully unlocked, otherwise false.
+ */
@Override
- public boolean unlockUser(int userId, byte[] token, byte[] secret, IProgressListener listener) {
- return mUserController.unlockUser(userId, token, secret, listener);
+ public boolean unlockUser(int userId, @Nullable byte[] token, @Nullable byte[] secret,
+ @Nullable IProgressListener listener) {
+ return mUserController.unlockUser(userId, secret, listener);
}
@Override
diff --git a/services/core/java/com/android/server/am/UserController.java b/services/core/java/com/android/server/am/UserController.java
index b28b1a6..5a43f4d 100644
--- a/services/core/java/com/android/server/am/UserController.java
+++ b/services/core/java/com/android/server/am/UserController.java
@@ -714,15 +714,9 @@
if (!Objects.equals(info.lastLoggedInFingerprint, Build.FINGERPRINT)
|| SystemProperties.getBoolean("persist.pm.mock-upgrade", false)) {
// Suppress double notifications for managed profiles that
- // were unlocked automatically as part of their parent user
- // being unlocked.
- final boolean quiet;
- if (info.isManagedProfile()) {
- quiet = !uss.tokenProvided
- || !mLockPatternUtils.isSeparateProfileChallengeEnabled(userId);
- } else {
- quiet = false;
- }
+ // were unlocked automatically as part of their parent user being
+ // unlocked. TODO(b/217442918): this code doesn't work correctly.
+ final boolean quiet = info.isManagedProfile();
mInjector.sendPreBootBroadcast(userId, quiet,
() -> finishUserUnlockedCompleted(uss));
} else {
@@ -1658,27 +1652,25 @@
}
}
- boolean unlockUser(final @UserIdInt int userId, byte[] token, byte[] secret,
- IProgressListener listener) {
+ boolean unlockUser(final @UserIdInt int userId, byte[] secret, IProgressListener listener) {
checkCallingPermission(INTERACT_ACROSS_USERS_FULL, "unlockUser");
EventLog.writeEvent(EventLogTags.UC_UNLOCK_USER, userId);
final long binderToken = Binder.clearCallingIdentity();
try {
- return unlockUserCleared(userId, token, secret, listener);
+ return unlockUserCleared(userId, secret, listener);
} finally {
Binder.restoreCallingIdentity(binderToken);
}
}
/**
- * Attempt to unlock user without a credential token. This typically
- * succeeds when the device doesn't have credential-encrypted storage, or
- * when the credential-encrypted storage isn't tied to a user-provided
- * PIN or pattern.
+ * Attempt to unlock user without a secret. This typically succeeds when the
+ * device doesn't have credential-encrypted storage, or when the
+ * credential-encrypted storage isn't tied to a user-provided PIN or
+ * pattern.
*/
private boolean maybeUnlockUser(final @UserIdInt int userId) {
- // Try unlocking storage using empty token
- return unlockUserCleared(userId, null, null, null);
+ return unlockUserCleared(userId, null, null);
}
private static void notifyFinished(@UserIdInt int userId, IProgressListener listener) {
@@ -1689,7 +1681,7 @@
}
}
- private boolean unlockUserCleared(final @UserIdInt int userId, byte[] token, byte[] secret,
+ private boolean unlockUserCleared(final @UserIdInt int userId, byte[] secret,
IProgressListener listener) {
UserState uss;
if (!StorageManager.isUserKeyUnlocked(userId)) {
@@ -1697,7 +1689,7 @@
final IStorageManager storageManager = mInjector.getStorageManager();
try {
// We always want to unlock user storage, even user is not started yet
- storageManager.unlockUserKey(userId, userInfo.serialNumber, token, secret);
+ storageManager.unlockUserKey(userId, userInfo.serialNumber, secret);
} catch (RemoteException | RuntimeException e) {
Slogf.w(TAG, "Failed to unlock: " + e.getMessage());
}
@@ -1707,7 +1699,6 @@
uss = mStartedUsers.get(userId);
if (uss != null) {
uss.mUnlockProgress.addListener(listener);
- uss.tokenProvided = (token != null);
}
}
// Bail if user isn't actually running
diff --git a/services/core/java/com/android/server/am/UserState.java b/services/core/java/com/android/server/am/UserState.java
index 40fc306..71a5511 100644
--- a/services/core/java/com/android/server/am/UserState.java
+++ b/services/core/java/com/android/server/am/UserState.java
@@ -56,7 +56,6 @@
public int state = STATE_BOOTING;
public int lastState = STATE_BOOTING;
public boolean switching;
- public boolean tokenProvided;
/** Callback for key eviction. */
public interface KeyEvictedCallback {
@@ -149,7 +148,6 @@
@Override
public String toString() {
return "[UserState: id=" + mHandle.getIdentifier() + ", state=" + stateToString(state)
- + ", lastState=" + stateToString(lastState) + ", switching=" + switching
- + ", tokenProvided=" + tokenProvided + "]";
+ + ", lastState=" + stateToString(lastState) + ", switching=" + switching + "]";
}
}
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsService.java b/services/core/java/com/android/server/locksettings/LockSettingsService.java
index 7d5b7e5..6cd0af6 100644
--- a/services/core/java/com/android/server/locksettings/LockSettingsService.java
+++ b/services/core/java/com/android/server/locksettings/LockSettingsService.java
@@ -237,8 +237,6 @@
private final RebootEscrowManager mRebootEscrowManager;
- private boolean mFirstCallToVold;
-
// Current password metric for all users on the device. Updated when user unlocks
// the device or changes password. Removed when user is stopped.
@GuardedBy("this")
@@ -573,8 +571,6 @@
mStrongAuth = injector.getStrongAuth();
mActivityManager = injector.getActivityManager();
- mFirstCallToVold = true;
-
IntentFilter filter = new IntentFilter();
filter.addAction(Intent.ACTION_USER_ADDED);
filter.addAction(Intent.ACTION_USER_STARTING);
@@ -1370,7 +1366,7 @@
* can end up calling into other system services to process user unlock request (via
* {@link com.android.server.SystemServiceManager#unlockUser} </em>
*/
- private void unlockUser(int userId, byte[] token, byte[] secret) {
+ private void unlockUser(int userId, byte[] secret) {
Slog.i(TAG, "Unlocking user " + userId + " with secret only, length "
+ (secret != null ? secret.length : 0));
// TODO: make this method fully async so we can update UI with progress strings
@@ -1395,7 +1391,7 @@
};
try {
- mActivityManager.unlockUser(userId, token, secret, listener);
+ mActivityManager.unlockUser(userId, null, secret, listener);
} catch (RemoteException e) {
throw e.rethrowAsRuntimeException();
}
@@ -1722,46 +1718,17 @@
}
}
synchronized (mSpManager) {
- if (shouldMigrateToSyntheticPasswordLocked(userId)) {
- initializeSyntheticPasswordLocked(currentHandle.hash, savedCredential, userId);
- return spBasedSetLockCredentialInternalLocked(credential, savedCredential, userId,
- isLockTiedToParent);
- }
+ initializeSyntheticPasswordLocked(currentHandle.hash, savedCredential, userId);
+ return spBasedSetLockCredentialInternalLocked(credential, savedCredential, userId,
+ isLockTiedToParent);
}
- if (DEBUG) Slog.d(TAG, "setLockCredentialInternal: user=" + userId);
- byte[] enrolledHandle = enrollCredential(currentHandle.hash,
- savedCredential.getCredential(), credential.getCredential(), userId);
- if (enrolledHandle == null) {
- Slog.w(TAG, String.format("Failed to enroll %s: incorrect credential",
- credential.isPattern() ? "pattern" : "password"));
- return false;
- }
- CredentialHash willStore = CredentialHash.create(enrolledHandle, credential.getType());
- mStorage.writeCredentialHash(willStore, userId);
- // Still update PASSWORD_TYPE_KEY if we are running in pre-synthetic password code path,
- // since it forms part of the state that determines the credential type
- // @see getCredentialTypeInternal
- setKeyguardStoredQuality(
- LockPatternUtils.credentialTypeToPasswordQuality(credential.getType()), userId);
- // push new secret and auth token to vold
- GateKeeperResponse gkResponse;
- try {
- gkResponse = getGateKeeperService().verifyChallenge(userId, 0, willStore.hash,
- credential.getCredential());
- } catch (RemoteException e) {
- throw new IllegalStateException("Failed to verify current credential", e);
- }
- setUserKeyProtection(userId, credential, convertResponse(gkResponse));
- fixateNewestUserKeyAuth(userId);
- // Refresh the auth token
- doVerifyCredential(credential, userId, null /* progressCallback */, 0 /* flags */);
- synchronizeUnifiedWorkChallengeForProfiles(userId, null);
- sendCredentialsOnChangeIfRequired(credential, userId, isLockTiedToParent);
- return true;
}
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 +1737,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 +1830,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);
@@ -1968,52 +1887,9 @@
mStorage.writeChildProfileLock(userId, outputStream.toByteArray());
}
- private byte[] enrollCredential(byte[] enrolledHandle,
- byte[] enrolledCredential, byte[] toEnroll, int userId) {
- checkWritePermission(userId);
- GateKeeperResponse response;
- try {
- response = getGateKeeperService().enroll(userId, enrolledHandle,
- enrolledCredential, toEnroll);
- } catch (RemoteException e) {
- Slog.e(TAG, "Failed to enroll credential", e);
- return null;
- }
-
- if (response == null) {
- return null;
- }
-
- byte[] hash = response.getPayload();
- if (hash != null) {
- setKeystorePassword(toEnroll, userId);
- } else {
- // Should not happen
- Slog.e(TAG, "Throttled while enrolling a password");
- }
- return hash;
- }
-
- private void setAuthlessUserKeyProtection(int userId, byte[] key) {
- if (DEBUG) Slog.d(TAG, "setAuthlessUserKeyProtectiond: user=" + userId);
- addUserKeyAuth(userId, null, key);
- }
-
- private void setUserKeyProtection(int userId, LockscreenCredential credential,
- VerifyCredentialResponse vcr) {
+ private void setUserKeyProtection(int userId, byte[] key) {
if (DEBUG) Slog.d(TAG, "setUserKeyProtection: user=" + userId);
- if (vcr == null) {
- throw new IllegalArgumentException("Null response verifying a credential we just set");
- }
- if (vcr.getResponseCode() != VerifyCredentialResponse.RESPONSE_OK) {
- throw new IllegalArgumentException("Non-OK response verifying a credential we just set "
- + vcr.getResponseCode());
- }
- byte[] token = vcr.getGatekeeperHAT();
- if (token == null) {
- throw new IllegalArgumentException("Empty payload verifying a credential we just set");
- }
- addUserKeyAuth(userId, token, secretFromCredential(credential));
+ addUserKeyAuth(userId, key);
}
private void clearUserKeyProtection(int userId, byte[] secret) {
@@ -2021,7 +1897,7 @@
final UserInfo userInfo = mUserManager.getUserInfo(userId);
final long callingId = Binder.clearCallingIdentity();
try {
- mStorageManager.clearUserKeyAuth(userId, userInfo.serialNumber, null, secret);
+ mStorageManager.clearUserKeyAuth(userId, userInfo.serialNumber, secret);
} catch (RemoteException e) {
throw new IllegalStateException("clearUserKeyAuth failed user=" + userId);
} finally {
@@ -2054,21 +1930,21 @@
}
/** Unlock disk encryption */
- private void unlockUserKey(int userId, byte[] token, byte[] secret) {
+ private void unlockUserKey(int userId, byte[] secret) {
final UserInfo userInfo = mUserManager.getUserInfo(userId);
try {
- mStorageManager.unlockUserKey(userId, userInfo.serialNumber, token, secret);
+ mStorageManager.unlockUserKey(userId, userInfo.serialNumber, secret);
} catch (RemoteException e) {
throw new IllegalStateException("Failed to unlock user key " + userId, e);
}
}
- private void addUserKeyAuth(int userId, byte[] token, byte[] secret) {
+ private void addUserKeyAuth(int userId, byte[] secret) {
final UserInfo userInfo = mUserManager.getUserInfo(userId);
final long callingId = Binder.clearCallingIdentity();
try {
- mStorageManager.addUserKeyAuth(userId, userInfo.serialNumber, token, secret);
+ mStorageManager.addUserKeyAuth(userId, userInfo.serialNumber, secret);
} catch (RemoteException e) {
throw new IllegalStateException("Failed to add new key to vold " + userId, e);
} finally {
@@ -2336,9 +2212,8 @@
setUserPasswordMetrics(credential, userId);
unlockKeystore(credential.getCredential(), userId);
- Slog.i(TAG, "Unlocking user " + userId + " with token length "
- + response.getGatekeeperHAT().length);
- unlockUser(userId, response.getGatekeeperHAT(), secretFromCredential(credential));
+ Slog.i(TAG, "Unlocking user " + userId);
+ unlockUser(userId, secretFromCredential(credential));
if (isManagedProfileWithSeparatedLock(userId)) {
setDeviceUnlockedForUser(userId);
@@ -2412,77 +2287,6 @@
});
}
- private LockscreenCredential createPattern(String patternString) {
- final byte[] patternBytes = patternString.getBytes();
- LockscreenCredential pattern = LockscreenCredential.createPattern(
- LockPatternUtils.byteArrayToPattern(patternBytes));
- Arrays.fill(patternBytes, (byte) 0);
- return pattern;
- }
-
- @Override
- public boolean checkVoldPassword(int userId) {
- if (!mFirstCallToVold) {
- return false;
- }
- mFirstCallToVold = false;
-
- checkPasswordReadPermission();
-
- // There's no guarantee that this will safely connect, but if it fails
- // we will simply show the lock screen when we shouldn't, so relatively
- // benign. There is an outside chance something nasty would happen if
- // this service restarted before vold stales out the password in this
- // case. The nastiness is limited to not showing the lock screen when
- // we should, within the first minute of decrypting the phone if this
- // service can't connect to vold, it restarts, and then the new instance
- // does successfully connect.
- final IStorageManager service = mInjector.getStorageManager();
- // TODO(b/120484642): Update vold to return a password as a byte array
- String password;
- final long identity = Binder.clearCallingIdentity();
- try {
- password = service.getPassword();
- service.clearPassword();
- } catch (RemoteException e) {
- Slog.w(TAG, "vold getPassword() failed", e);
- return false;
- } finally {
- Binder.restoreCallingIdentity(identity);
- }
- if (TextUtils.isEmpty(password)) {
- return false;
- }
-
- try {
- final LockscreenCredential credential;
- switch (getCredentialTypeInternal(userId)) {
- case CREDENTIAL_TYPE_PATTERN:
- credential = createPattern(password);
- break;
- case CREDENTIAL_TYPE_PIN:
- credential = LockscreenCredential.createPin(password);
- break;
- case CREDENTIAL_TYPE_PASSWORD:
- credential = LockscreenCredential.createPassword(password);
- break;
- default:
- credential = null;
- Slog.e(TAG, "Unknown credential type");
- }
-
- if (credential != null
- && checkCredential(credential, userId, null /* progressCallback */)
- .getResponseCode() == GateKeeperResponse.RESPONSE_OK) {
- return true;
- }
- } catch (Exception e) {
- Slog.e(TAG, "checkVoldPassword failed: ", e);
- }
-
- return false;
- }
-
private void removeUser(int userId, boolean unknownUser) {
Slog.i(TAG, "RemoveUser: " + userId);
removeBiometricsForUser(userId);
@@ -2846,7 +2650,7 @@
mSpManager.newSidForUser(getGateKeeperService(), auth, userId);
}
mSpManager.verifyChallenge(getGateKeeperService(), auth, 0L, userId);
- setAuthlessUserKeyProtection(userId, auth.deriveDiskEncryptionKey());
+ setUserKeyProtection(userId, auth.deriveDiskEncryptionKey());
setKeystorePassword(auth.deriveKeyStorePassword(), userId);
} else {
clearUserKeyProtection(userId, null);
@@ -2998,7 +2802,7 @@
{
final byte[] secret = authToken.deriveDiskEncryptionKey();
- unlockUser(userId, null, secret);
+ unlockUser(userId, secret);
Arrays.fill(secret, (byte) 0);
}
activateEscrowTokens(authToken, userId);
@@ -3048,7 +2852,7 @@
// a new SID, and re-add keys to vold and keystore.
mSpManager.newSidForUser(getGateKeeperService(), auth, userId);
mSpManager.verifyChallenge(getGateKeeperService(), auth, 0L, userId);
- setAuthlessUserKeyProtection(userId, auth.deriveDiskEncryptionKey());
+ setUserKeyProtection(userId, auth.deriveDiskEncryptionKey());
fixateNewestUserKeyAuth(userId);
setKeystorePassword(auth.deriveKeyStorePassword(), userId);
}
@@ -3063,7 +2867,7 @@
// Clear key from vold so ActivityManager can just unlock the user with empty secret
// during boot. Vold storage needs to be unlocked before manipulation of the keys can
// succeed.
- unlockUserKey(userId, null, auth.deriveDiskEncryptionKey());
+ unlockUserKey(userId, auth.deriveDiskEncryptionKey());
clearUserKeyProtection(userId, auth.deriveDiskEncryptionKey());
fixateNewestUserKeyAuth(userId);
unlockKeystore(auth.deriveKeyStorePassword(), userId);
@@ -3333,7 +3137,7 @@
// If clearing credential, unlock the user manually in order to progress user start
// Call unlockUser() on a handler thread so no lock is held (either by LSS or by
// the caller like DPMS), otherwise it can lead to deadlock.
- mHandler.post(() -> unlockUser(userId, null, null));
+ mHandler.post(() -> unlockUser(userId, null));
}
notifyPasswordChanged(userId);
notifySeparateProfileChallengeChanged(userId);
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
index 0a77430..71cc361 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -4124,7 +4124,7 @@
"updateNetworkStats: " + uid + "/" + (uidForeground ? "F" : "B"));
}
try {
- mNetworkStats.setUidForeground(uid, uidForeground);
+ mNetworkStats.noteUidForeground(uid, uidForeground);
} finally {
Trace.traceEnd(Trace.TRACE_TAG_NETWORK);
}
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 b0d23a4..66e840b 100644
--- a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
+++ b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
@@ -235,8 +235,11 @@
// Event observers
private void registerObservers() {
- registerAppLaunchObserver();
- registerOTAObserver();
+ BackgroundThread.get().getThreadHandler().post(
+ () -> {
+ registerAppLaunchObserver();
+ registerOTAObserver();
+ });
}
private final AppLaunchObserver mAppLaunchObserver = new AppLaunchObserver();
diff --git a/services/tests/servicestests/src/com/android/server/am/UserControllerTest.java b/services/tests/servicestests/src/com/android/server/am/UserControllerTest.java
index 9ffb5017..5562308 100644
--- a/services/tests/servicestests/src/com/android/server/am/UserControllerTest.java
+++ b/services/tests/servicestests/src/com/android/server/am/UserControllerTest.java
@@ -589,8 +589,7 @@
setUpUser(userId, 0);
mUserController.startUser(userId, /* foreground= */ false);
verify(mInjector.mStorageManagerMock, times(1))
- .unlockUserKey(userId, /* serialNumber= */ 0, /* token= */ null, /* secret= */
- null);
+ .unlockUserKey(userId, /* serialNumber= */ 0, /* secret= */ null);
mUserStates.put(userId, mUserController.getStartedUserState(userId));
}
@@ -599,8 +598,7 @@
assertThat(mUserController.startProfile(userId)).isTrue();
verify(mInjector.mStorageManagerMock, times(1))
- .unlockUserKey(userId, /* serialNumber= */ 0, /* token= */ null, /* secret= */
- null);
+ .unlockUserKey(userId, /* serialNumber= */ 0, /* secret= */ null);
mUserStates.put(userId, mUserController.getStartedUserState(userId));
}
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/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java b/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java
index d62f83c..e220841 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java
@@ -221,11 +221,10 @@
Object[] args = invocation.getArguments();
mStorageManager.addUserKeyAuth((int) args[0] /* userId */,
(int) args[1] /* serialNumber */,
- (byte[]) args[2] /* token */,
- (byte[]) args[3] /* secret */);
+ (byte[]) args[2] /* secret */);
return null;
}
- }).when(sm).addUserKeyAuth(anyInt(), anyInt(), any(), any());
+ }).when(sm).addUserKeyAuth(anyInt(), anyInt(), any());
doAnswer(new Answer<Void>() {
@Override
@@ -233,11 +232,10 @@
Object[] args = invocation.getArguments();
mStorageManager.clearUserKeyAuth((int) args[0] /* userId */,
(int) args[1] /* serialNumber */,
- (byte[]) args[2] /* token */,
- (byte[]) args[3] /* secret */);
+ (byte[]) args[2] /* secret */);
return null;
}
- }).when(sm).clearUserKeyAuth(anyInt(), anyInt(), any(), any());
+ }).when(sm).clearUserKeyAuth(anyInt(), anyInt(), any());
doAnswer(
new Answer<Void>() {
diff --git a/services/tests/servicestests/src/com/android/server/locksettings/FakeStorageManager.java b/services/tests/servicestests/src/com/android/server/locksettings/FakeStorageManager.java
index 102bac1..619ef70 100644
--- a/services/tests/servicestests/src/com/android/server/locksettings/FakeStorageManager.java
+++ b/services/tests/servicestests/src/com/android/server/locksettings/FakeStorageManager.java
@@ -19,7 +19,6 @@
import android.os.IProgressListener;
import android.os.RemoteException;
import android.util.ArrayMap;
-import android.util.Pair;
import junit.framework.AssertionFailedError;
@@ -29,56 +28,56 @@
public class FakeStorageManager {
- private ArrayMap<Integer, ArrayList<Pair<byte[], byte[]>>> mAuth = new ArrayMap<>();
+ private ArrayMap<Integer, ArrayList<byte[]>> mAuth = new ArrayMap<>();
private boolean mIgnoreBadUnlock;
- public void addUserKeyAuth(int userId, int serialNumber, byte[] token, byte[] secret) {
- getUserAuth(userId).add(new Pair<>(token, secret));
+ public void addUserKeyAuth(int userId, int serialNumber, byte[] secret) {
+ getUserAuth(userId).add(secret);
}
- public void clearUserKeyAuth(int userId, int serialNumber, byte[] token, byte[] secret) {
- ArrayList<Pair<byte[], byte[]>> auths = getUserAuth(userId);
- if (token == null && secret == null) {
+ public void clearUserKeyAuth(int userId, int serialNumber, byte[] secret) {
+ ArrayList<byte[]> auths = getUserAuth(userId);
+ if (secret == null) {
return;
}
- auths.remove(new Pair<>(token, secret));
- auths.add(new Pair<>(null, null));
+ auths.remove(secret);
+ auths.add(null);
}
public void fixateNewestUserKeyAuth(int userId) {
- ArrayList<Pair<byte[], byte[]>> auths = mAuth.get(userId);
- Pair<byte[], byte[]> latest = auths.get(auths.size() - 1);
+ ArrayList<byte[]> auths = mAuth.get(userId);
+ byte[] latest = auths.get(auths.size() - 1);
auths.clear();
auths.add(latest);
}
- private ArrayList<Pair<byte[], byte[]>> getUserAuth(int userId) {
+ private ArrayList<byte[]> getUserAuth(int userId) {
if (!mAuth.containsKey(userId)) {
- ArrayList<Pair<byte[], byte[]>> auths = new ArrayList<Pair<byte[], byte[]>>();
- auths.add(new Pair(null, null));
- mAuth.put(userId, auths);
+ ArrayList<byte[]> auths = new ArrayList<>();
+ auths.add(null);
+ mAuth.put(userId, auths);
}
return mAuth.get(userId);
}
public byte[] getUserUnlockToken(int userId) {
- ArrayList<Pair<byte[], byte[]>> auths = getUserAuth(userId);
+ ArrayList<byte[]> auths = getUserAuth(userId);
if (auths.size() != 1) {
throw new AssertionFailedError("More than one secret exists");
}
- return auths.get(0).second;
+ return auths.get(0);
}
public void unlockUser(int userId, byte[] secret, IProgressListener listener)
throws RemoteException {
listener.onStarted(userId, null);
listener.onFinished(userId, null);
- ArrayList<Pair<byte[], byte[]>> auths = getUserAuth(userId);
+ ArrayList<byte[]> auths = getUserAuth(userId);
if (auths.size() > 1) {
throw new AssertionFailedError("More than one secret exists");
}
- Pair<byte[], byte[]> auth = auths.get(0);
- if (!Arrays.equals(secret, auth.second)) {
+ byte[] auth = auths.get(0);
+ if (!Arrays.equals(secret, auth)) {
if (!mIgnoreBadUnlock) {
throw new AssertionFailedError("Invalid secret to unlock user " + userId);
}
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java
index cd73bda..4a5a137 100644
--- a/telephony/java/android/telephony/CarrierConfigManager.java
+++ b/telephony/java/android/telephony/CarrierConfigManager.java
@@ -2938,19 +2938,6 @@
"signal_strength_nr_nsa_use_lte_as_primary_bool";
/**
- * String array of TCP buffer sizes per network type.
- * The entries should be of the following form, with values in bytes:
- * "network_name:read_min,read_default,read_max,write_min,write_default,write_max".
- * For NR (5G), the following network names should be used:
- * - NR_NSA: NR NSA, sub-6 frequencies
- * - NR_NSA_MMWAVE: NR NSA, mmwave frequencies
- * - NR_SA: NR SA, sub-6 frequencies
- * - NR_SA_MMWAVE: NR SA, mmwave frequencies
- * @hide
- */
- public static final String KEY_TCP_BUFFERS_STRING_ARRAY = "tcp_buffers_string_array";
-
- /**
* String array of default bandwidth values per network type.
* The entries should be of form: "network_name:downlink,uplink", with values in Kbps.
* For NR (5G), the following network names should be used:
@@ -4365,6 +4352,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 +5579,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 +5611,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 +5999,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);
@@ -6246,28 +6309,6 @@
"iDEN:14,14", "LTE:30000,15000", "HSPA+:13000,3400", "GSM:24,24",
"TD_SCDMA:115,115", "LTE_CA:30000,15000", "NR_NSA:47000,18000",
"NR_NSA_MMWAVE:145000,60000", "NR_SA:145000,60000", "NR_SA_MMWAVE:145000,60000"});
- sDefaults.putStringArray(KEY_TCP_BUFFERS_STRING_ARRAY, new String[]{
- "GPRS:4092,8760,48000,4096,8760,48000", "EDGE:4093,26280,70800,4096,16384,70800",
- "UMTS:58254,349525,1048576,58254,349525,1048576",
- "CDMA:4094,87380,262144,4096,16384,262144",
- "1xRTT:16384,32768,131072,4096,16384,102400",
- "EvDo_0:4094,87380,262144,4096,16384,262144",
- "EvDo_A:4094,87380,262144,4096,16384,262144",
- "HSDPA:61167,367002,1101005,8738,52429,262114",
- "HSUPA:40778,244668,734003,16777,100663,301990",
- "HSPA:40778,244668,734003,16777,100663,301990",
- "EvDo_B:4094,87380,262144,4096,16384,262144",
- "eHRPD:131072,262144,1048576,4096,16384,524288",
- "iDEN:4094,87380,262144,4096,16384,262144",
- "LTE:524288,1048576,2097152,262144,524288,1048576",
- "HSPA+:122334,734003,2202010,32040,192239,576717",
- "GSM:4092,8760,48000,4096,8760,48000",
- "TD_SCDMA:58254,349525,1048576,58254,349525,1048576",
- "LTE_CA:4096,6291456,12582912,4096,1048576,2097152",
- "NR_NSA:2097152,6291456,16777216,512000,2097152,8388608",
- "NR_NSA_MMWAVE:2097152,6291456,16777216,512000,2097152,8388608",
- "NR_SA:2097152,6291456,16777216,512000,2097152,8388608",
- "NR_SA_MMWAVE:2097152,6291456,16777216,512000,2097152,8388608"});
sDefaults.putBoolean(KEY_BANDWIDTH_NR_NSA_USE_LTE_VALUE_FOR_UPLINK_BOOL, false);
sDefaults.putString(KEY_WCDMA_DEFAULT_SIGNAL_STRENGTH_MEASUREMENT_STRING, "rssi");
sDefaults.putBoolean(KEY_CONFIG_SHOW_ORIG_DIAL_STRING_FOR_CDMA_BOOL, false);
@@ -6404,15 +6445,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 +6481,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 6705ca8..63ff232 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -12542,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.
*/
@@ -12569,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 977fe33..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";
diff --git a/telephony/java/android/telephony/data/DataService.java b/telephony/java/android/telephony/data/DataService.java
index 892eb29..bd346d5 100644
--- a/telephony/java/android/telephony/data/DataService.java
+++ b/telephony/java/android/telephony/data/DataService.java
@@ -31,6 +31,7 @@
import android.os.Looper;
import android.os.Message;
import android.os.RemoteException;
+import android.telephony.AccessNetworkConstants.RadioAccessNetworkType;
import android.util.Log;
import android.util.SparseArray;
@@ -166,7 +167,8 @@
* link properties of the existing data connection, otherwise null.
* @param callback The result callback for this request.
*/
- public void setupDataCall(int accessNetworkType, @NonNull DataProfile dataProfile,
+ public void setupDataCall(
+ @RadioAccessNetworkType int accessNetworkType, @NonNull DataProfile dataProfile,
boolean isRoaming, boolean allowRoaming,
@SetupDataReason int reason, @Nullable LinkProperties linkProperties,
@NonNull DataServiceCallback callback) {
@@ -214,7 +216,8 @@
* for example, a zero-rating slice.
* @param callback The result callback for this request.
*/
- public void setupDataCall(int accessNetworkType, @NonNull DataProfile dataProfile,
+ public void setupDataCall(
+ @RadioAccessNetworkType int accessNetworkType, @NonNull DataProfile dataProfile,
boolean isRoaming, boolean allowRoaming,
@SetupDataReason int reason,
@Nullable LinkProperties linkProperties,
@@ -294,6 +297,9 @@
* with reason {@link DataService.REQUEST_REASON_HANDOVER}. The target transport now owns
* the transferred resources and is responsible for releasing them.
*
+ * <p/>
+ * Note that the callback will be executed on binder thread.
+ *
* @param cid The identifier of the data call which is provided in {@link DataCallResponse}
* @param callback The result callback for this request.
*
@@ -322,6 +328,9 @@
* </li>
* </ul>
*
+ * <p/>
+ * Note that the callback will be executed on binder thread.
+ *
* @param cid The identifier of the data call which is provided in {@link DataCallResponse}
* @param callback The result callback for this request.
*
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",