Merge "Added Java bindings to async trace functions with track argument"
diff --git a/ApiDocs.bp b/ApiDocs.bp
index 2efeab6..39f055b 100644
--- a/ApiDocs.bp
+++ b/ApiDocs.bp
@@ -226,7 +226,7 @@
"android.whichdoc offline",
],
compat_config: ":global-compat-config",
- proofread_file: "offline-sdk-docs-proofrerad.txt",
+ proofread_file: "offline-sdk-docs-proofread.txt",
args: framework_docs_only_args + " -offlinemode -title \"Android SDK\"",
static_doc_index_redirect: "docs/docs-preview-index.html",
}
@@ -243,7 +243,7 @@
hdf: [
"android.whichdoc offline",
],
- proofread_file: "offline-sdk-referenceonly-docs-proofrerad.txt",
+ proofread_file: "offline-sdk-referenceonly-docs-proofread.txt",
args: framework_docs_only_args + " -offlinemode -title \"Android SDK\" -referenceonly",
static_doc_index_redirect: "docs/docs-documentation-redirect.html",
static_doc_properties: "docs/source.properties",
@@ -261,7 +261,7 @@
hdf: [
"android.whichdoc offline",
],
- proofread_file: "offline-system-sdk-referenceonly-docs-proofrerad.txt",
+ proofread_file: "offline-system-sdk-referenceonly-docs-proofread.txt",
args: framework_docs_only_args + " -hide 101 -hide 104 -hide 108" +
" -offlinemode -title \"Android System SDK\" -referenceonly",
static_doc_index_redirect: "docs/docs-documentation-redirect.html",
@@ -278,7 +278,7 @@
"android.whichdoc online",
"android.hasSamples true",
],
- proofread_file: "online-sdk-docs-proofrerad.txt",
+ proofread_file: "online-sdk-docs-proofread.txt",
args: framework_docs_only_args +
" -toroot / -samplegroup Admin " +
" -samplegroup Background " +
@@ -307,7 +307,7 @@
"android.whichdoc online",
"android.hasSamples true",
],
- proofread_file: "online-system-api-sdk-docs-proofrerad.txt",
+ proofread_file: "online-system-api-sdk-docs-proofread.txt",
args: framework_docs_only_args +
" -referenceonly " +
" -title \"Android SDK - Including system APIs.\" " +
@@ -342,7 +342,7 @@
"android.whichdoc online",
"android.hasSamples true",
],
- proofread_file: "ds-docs-proofrerad.txt",
+ proofread_file: "ds-docs-proofread.txt",
args: framework_docs_only_args +
" -toroot / -yamlV2 -metalavaApiSince -samplegroup Admin " +
" -samplegroup Background " +
@@ -453,7 +453,7 @@
"android.whichdoc online",
"android.hasSamples true",
],
- proofread_file: "online-sdk-dev-docs-proofrerad.txt",
+ proofread_file: "online-sdk-dev-docs-proofread.txt",
args: framework_docs_only_args +
" -toroot / -samplegroup Admin " +
" -samplegroup Background " +
@@ -478,7 +478,7 @@
srcs: [
":framework-doc-stubs",
],
- proofread_file: "hidden-docs-proofrerad.txt",
+ proofread_file: "hidden-docs-proofread.txt",
args: framework_docs_only_args +
" -referenceonly " +
" -title \"Android SDK - Including hidden APIs.\"",
diff --git a/TRACE_OWNERS b/TRACE_OWNERS
new file mode 100644
index 0000000..f746a16
--- /dev/null
+++ b/TRACE_OWNERS
@@ -0,0 +1,5 @@
+# OWNERS of Trace-related files
+primiano@google.com
+timmurray@google.com
+jjaggi@google.com
+jreck@google.com
diff --git a/core/java/android/os/OWNERS b/core/java/android/os/OWNERS
index 8e5ed8f..1f3108a 100644
--- a/core/java/android/os/OWNERS
+++ b/core/java/android/os/OWNERS
@@ -66,3 +66,6 @@
# VINTF
per-file Vintf* = file:/platform/system/libvintf:/OWNERS
+
+# Tracing
+per-file Trace.java = file:/TRACE_OWNERS
diff --git a/core/jni/OWNERS b/core/jni/OWNERS
index 8cac2e8c..626a212 100644
--- a/core/jni/OWNERS
+++ b/core/jni/OWNERS
@@ -56,6 +56,7 @@
per-file android_media_midi_* = file:/media/java/android/media/midi/OWNERS
per-file android_opengl_* = file:/opengl/java/android/opengl/OWNERS
per-file android_os_storage_* = file:/core/java/android/os/storage/OWNERS
+per-file android_os_Trace* = file:/TRACE_OWNERS
per-file android_se_* = file:/omapi/java/android/se/OWNERS
per-file android_security_* = file:/core/java/android/security/OWNERS
per-file android_view_* = file:/core/java/android/view/OWNERS
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index cb3e465..236fad2 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -2566,23 +2566,27 @@
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.
+ This is deprecated. Please use config_mobile_tcp_buffers for rat-based TCP buffers sizes or
+ config_tcp_buffers for rat-independent TCP buffer sizes.
-->
<string-array name="config_mobile_tcp_buffers">
</string-array>
+ <!-- Configure tcp buffer sizes per network type in the form:
+ network-type:rmem_min,rmem_def,rmem_max,wmem_min,wmem_def,wmem_max
+
+ The network-type must be a valid DataConfigNetworkType value. If no value is found for the
+ network-type in use, config_tcp_buffers will be used instead.
+ -->
+ <string-array name="config_network_type_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>
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 55e2ca6..bacd25d 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="array" name="config_network_type_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" />
diff --git a/identity/java/android/security/identity/CredstoreIdentityCredentialStore.java b/identity/java/android/security/identity/CredstoreIdentityCredentialStore.java
index fb0880c..bbaf086 100644
--- a/identity/java/android/security/identity/CredstoreIdentityCredentialStore.java
+++ b/identity/java/android/security/identity/CredstoreIdentityCredentialStore.java
@@ -19,7 +19,10 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
+import android.os.RemoteException;
import android.os.ServiceManager;
+import android.security.GenerateRkpKey;
+import android.security.keymaster.KeymasterDefs;
class CredstoreIdentityCredentialStore extends IdentityCredentialStore {
@@ -104,6 +107,16 @@
try {
IWritableCredential wc;
wc = mStore.createCredential(credentialName, docType);
+ try {
+ GenerateRkpKey keyGen = new GenerateRkpKey(mContext);
+ // We don't know what the security level is for the backing keymint, so go ahead and
+ // poke the provisioner for both TEE and SB.
+ keyGen.notifyKeyGenerated(KeymasterDefs.KM_SECURITY_LEVEL_TRUSTED_ENVIRONMENT);
+ keyGen.notifyKeyGenerated(KeymasterDefs.KM_SECURITY_LEVEL_STRONGBOX);
+ } catch (RemoteException e) {
+ // Not really an error state. Does not apply at all if RKP is unsupported or
+ // disabled on a given device.
+ }
return new CredstoreWritableIdentityCredential(mContext, credentialName, docType, wc);
} catch (android.os.RemoteException e) {
throw new RuntimeException("Unexpected RemoteException ", e);
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
index 2af7e00..38d851e 100644
--- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java
@@ -41,6 +41,10 @@
import java.util.Enumeration;
import java.util.List;
import java.util.Locale;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
import java.util.zip.GZIPInputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@@ -51,8 +55,8 @@
private static final String TAG = "InstallationAsyncTask";
private static final int MIN_SHARED_MEMORY_SIZE = 8 << 10; // 8KiB
- private static final int MAX_SHARED_MEMORY_SIZE = 1024 << 10; // 1MiB
- private static final int DEFAULT_SHARED_MEMORY_SIZE = 64 << 10; // 64KiB
+ private static final int MAX_SHARED_MEMORY_SIZE = 8 << 20; // 8MiB
+ private static final int DEFAULT_SHARED_MEMORY_SIZE = 512 << 10; // 512KiB
private static final String SHARED_MEMORY_SIZE_PROP =
"dynamic_system.data_transfer.shared_memory.size";
@@ -488,7 +492,7 @@
installWritablePartition("userdata", mUserdataSize);
}
- private void installImages() throws IOException, ImageValidationException {
+ private void installImages() throws ExecutionException, IOException, ImageValidationException {
if (mStream != null) {
if (mIsZip) {
installStreamingZipUpdate();
@@ -500,7 +504,8 @@
}
}
- private void installStreamingGzUpdate() throws IOException, ImageValidationException {
+ private void installStreamingGzUpdate()
+ throws ExecutionException, IOException, ImageValidationException {
Log.d(TAG, "To install a streaming GZ update");
installImage("system", mSystemSize, new GZIPInputStream(mStream));
}
@@ -528,7 +533,8 @@
return total;
}
- private void installStreamingZipUpdate() throws IOException, ImageValidationException {
+ private void installStreamingZipUpdate()
+ throws ExecutionException, IOException, ImageValidationException {
Log.d(TAG, "To install a streaming ZIP update");
ZipInputStream zis = new ZipInputStream(mStream);
@@ -548,7 +554,8 @@
}
}
- private void installLocalZipUpdate() throws IOException, ImageValidationException {
+ private void installLocalZipUpdate()
+ throws ExecutionException, IOException, ImageValidationException {
Log.d(TAG, "To install a local ZIP update");
Enumeration<? extends ZipEntry> entries = mZipFile.entries();
@@ -569,7 +576,7 @@
}
private void installImageFromAnEntry(ZipEntry entry, InputStream is)
- throws IOException, ImageValidationException {
+ throws ExecutionException, IOException, ImageValidationException {
String name = entry.getName();
Log.d(TAG, "ZipEntry: " + name);
@@ -581,7 +588,7 @@
}
private void installImage(String partitionName, long uncompressedSize, InputStream is)
- throws IOException, ImageValidationException {
+ throws ExecutionException, IOException, ImageValidationException {
SparseInputStream sis = new SparseInputStream(new BufferedInputStream(is));
@@ -637,27 +644,51 @@
long prevInstalledSize = 0;
long installedSize = 0;
byte[] bytes = new byte[memoryFile.length()];
- int numBytesRead;
+ ExecutorService executor = Executors.newSingleThreadExecutor();
+ Future<Boolean> submitPromise = null;
- while ((numBytesRead = sis.read(bytes, 0, bytes.length)) != -1) {
+ while (true) {
+ final int numBytesRead = sis.read(bytes, 0, bytes.length);
+
+ if (submitPromise != null) {
+ // Wait until the previous submit task is complete.
+ while (true) {
+ try {
+ if (!submitPromise.get()) {
+ throw new IOException("Failed submitFromAshmem() to DynamicSystem");
+ }
+ break;
+ } catch (InterruptedException e) {
+ // Ignore.
+ }
+ }
+
+ // Publish the progress of the previous submit task.
+ if (installedSize > prevInstalledSize + MIN_PROGRESS_TO_PUBLISH) {
+ publishProgress(installedSize);
+ prevInstalledSize = installedSize;
+ }
+ }
+
+ // Ensure the previous submit task (submitPromise) is complete before exiting the loop.
+ if (numBytesRead < 0) {
+ break;
+ }
+
if (isCancelled()) {
return;
}
memoryFile.writeBytes(bytes, 0, 0, numBytesRead);
+ submitPromise =
+ executor.submit(() -> mInstallationSession.submitFromAshmem(numBytesRead));
- if (!mInstallationSession.submitFromAshmem(numBytesRead)) {
- throw new IOException("Failed write() to DynamicSystem");
- }
-
+ // Even though we update the bytes counter here, the actual progress is updated only
+ // after the submit task (submitPromise) is complete.
installedSize += numBytesRead;
-
- if (installedSize > prevInstalledSize + MIN_PROGRESS_TO_PUBLISH) {
- publishProgress(installedSize);
- prevInstalledSize = installedSize;
- }
}
+ // Ensure a 100% mark is published.
if (prevInstalledSize != partitionSize) {
publishProgress(partitionSize);
}
diff --git a/services/core/java/com/android/server/am/BatteryExternalStatsWorker.java b/services/core/java/com/android/server/am/BatteryExternalStatsWorker.java
index b3b74a1..c5ee259 100644
--- a/services/core/java/com/android/server/am/BatteryExternalStatsWorker.java
+++ b/services/core/java/com/android/server/am/BatteryExternalStatsWorker.java
@@ -556,8 +556,31 @@
// We were asked to fetch Bluetooth data.
final BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
if (adapter != null) {
- bluetoothReceiver = new SynchronousResultReceiver("bluetooth");
- adapter.requestControllerActivityEnergyInfo(bluetoothReceiver);
+ SynchronousResultReceiver resultReceiver =
+ new SynchronousResultReceiver("bluetooth");
+ adapter.requestControllerActivityEnergyInfo(
+ Runnable::run,
+ new BluetoothAdapter.OnBluetoothActivityEnergyInfoCallback() {
+ @Override
+ public void onBluetoothActivityEnergyInfoAvailable(
+ BluetoothActivityEnergyInfo info) {
+ Bundle bundle = new Bundle();
+ bundle.putParcelable(
+ BatteryStats.RESULT_RECEIVER_CONTROLLER_KEY, info);
+ resultReceiver.send(0, bundle);
+ }
+
+ @Override
+ public void onBluetoothActivityEnergyInfoError(int errorCode) {
+ Slog.w(TAG, "error reading Bluetooth stats: " + errorCode);
+ Bundle bundle = new Bundle();
+ bundle.putParcelable(
+ BatteryStats.RESULT_RECEIVER_CONTROLLER_KEY, null);
+ resultReceiver.send(0, bundle);
+ }
+ }
+ );
+ bluetoothReceiver = resultReceiver;
}
}
diff --git a/services/core/java/com/android/server/display/OWNERS b/services/core/java/com/android/server/display/OWNERS
index 09d96be..8e34601 100644
--- a/services/core/java/com/android/server/display/OWNERS
+++ b/services/core/java/com/android/server/display/OWNERS
@@ -3,5 +3,6 @@
hackbod@google.com
ogunwale@google.com
santoscordon@google.com
+flc@google.com
per-file ColorDisplayService.java=christyfranks@google.com
diff --git a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
index 99c675d..48d464c 100644
--- a/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
+++ b/services/core/java/com/android/server/stats/pull/StatsPullAtomService.java
@@ -1618,7 +1618,28 @@
if (adapter != null) {
SynchronousResultReceiver bluetoothReceiver =
new SynchronousResultReceiver("bluetooth");
- adapter.requestControllerActivityEnergyInfo(bluetoothReceiver);
+ adapter.requestControllerActivityEnergyInfo(
+ Runnable::run,
+ new BluetoothAdapter.OnBluetoothActivityEnergyInfoCallback() {
+ @Override
+ public void onBluetoothActivityEnergyInfoAvailable(
+ BluetoothActivityEnergyInfo info) {
+ Bundle bundle = new Bundle();
+ bundle.putParcelable(
+ BatteryStats.RESULT_RECEIVER_CONTROLLER_KEY, info);
+ bluetoothReceiver.send(0, bundle);
+ }
+
+ @Override
+ public void onBluetoothActivityEnergyInfoError(int errorCode) {
+ Slog.w(TAG, "error reading Bluetooth stats: " + errorCode);
+ Bundle bundle = new Bundle();
+ bundle.putParcelable(
+ BatteryStats.RESULT_RECEIVER_CONTROLLER_KEY, null);
+ bluetoothReceiver.send(0, bundle);
+ }
+ }
+ );
return awaitControllerInfo(bluetoothReceiver);
} else {
Slog.e(TAG, "Failed to get bluetooth adapter!");