Merge "Add ROLLBACK_ROOT_TRIGGERED enum to WatchdogRollback"
diff --git a/api/current.txt b/api/current.txt
index 3c89539..775c10c 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -22855,6 +22855,7 @@
method public float getBearing();
method public float getBearingAccuracyDegrees();
method public long getElapsedRealtimeNanos();
+ method public long getElapsedRealtimeUncertaintyNanos();
method public android.os.Bundle getExtras();
method public double getLatitude();
method public double getLongitude();
@@ -22867,6 +22868,7 @@
method public boolean hasAltitude();
method public boolean hasBearing();
method public boolean hasBearingAccuracy();
+ method public boolean hasElapsedRealtimeUncertaintyNanos();
method public boolean hasSpeed();
method public boolean hasSpeedAccuracy();
method public boolean hasVerticalAccuracy();
@@ -22882,6 +22884,7 @@
method public void setBearing(float);
method public void setBearingAccuracyDegrees(float);
method public void setElapsedRealtimeNanos(long);
+ method public void setElapsedRealtimeUncertaintyNanos(long);
method public void setExtras(android.os.Bundle);
method public void setLatitude(double);
method public void setLongitude(double);
@@ -43823,7 +43826,7 @@
public final class PhoneAccountSuggestion implements android.os.Parcelable {
method public int describeContents();
- method public android.telecom.PhoneAccountHandle getPhoneAccountHandle();
+ method @NonNull public android.telecom.PhoneAccountHandle getPhoneAccountHandle();
method public int getReason();
method public boolean shouldAutoSelect();
method public void writeToParcel(android.os.Parcel, int);
diff --git a/api/system-current.txt b/api/system-current.txt
index f54a874..e5cf1f8 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -6991,7 +6991,7 @@
}
public final class PhoneAccountSuggestion implements android.os.Parcelable {
- ctor public PhoneAccountSuggestion(android.telecom.PhoneAccountHandle, int, boolean);
+ ctor public PhoneAccountSuggestion(@NonNull android.telecom.PhoneAccountHandle, int, boolean);
}
public class PhoneAccountSuggestionService extends android.app.Service {
@@ -7678,7 +7678,7 @@
public final class PhoneNumberRange implements android.os.Parcelable {
ctor public PhoneNumberRange(@NonNull String, @NonNull String, @NonNull String, @NonNull String);
method public int describeContents();
- method public boolean matches(String);
+ method public boolean matches(@NonNull String);
method public void writeToParcel(android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.telephony.PhoneNumberRange> CREATOR;
}
@@ -7926,7 +7926,7 @@
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean enableDataConnectivity();
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean enableModemForSlot(int, boolean);
method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void enableVideoCalling(boolean);
- method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getAidForAppType(int);
+ method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getAidForAppType(int);
method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List<android.service.carrier.CarrierIdentifier> getAllowedCarriers(int);
method public java.util.List<java.lang.String> getCarrierPackageNamesForIntent(android.content.Intent);
method public java.util.List<java.lang.String> getCarrierPackageNamesForIntentAndPhone(android.content.Intent, int);
@@ -7942,9 +7942,10 @@
method @Deprecated public boolean getDataEnabled();
method @Deprecated public boolean getDataEnabled(int);
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean getEmergencyCallbackMode();
- method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimDomain();
+ method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimDomain();
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimIst();
method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List<android.util.Pair<java.lang.Integer,java.lang.Integer>> getLogicalToPhysicalSlotMapping();
+ method public static long getMaxNumberVerificationTimeoutMillis();
method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getPreferredNetworkTypeBitmap();
method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public int getRadioPowerState();
method public int getSimApplicationState();
@@ -8005,7 +8006,6 @@
field public static final String EXTRA_SIM_STATE = "android.telephony.extra.SIM_STATE";
field public static final String EXTRA_VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL = "android.telephony.extra.VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL";
field public static final String EXTRA_VOICEMAIL_SCRAMBLED_PIN_STRING = "android.telephony.extra.VOICEMAIL_SCRAMBLED_PIN_STRING";
- field public static final long MAX_NUMBER_VERIFICATION_TIMEOUT_MILLIS = 60000L; // 0xea60L
field public static final long NETWORK_TYPE_BITMASK_1xRTT = 64L; // 0x40L
field public static final long NETWORK_TYPE_BITMASK_CDMA = 8L; // 0x8L
field public static final long NETWORK_TYPE_BITMASK_EDGE = 2L; // 0x2L
@@ -9295,12 +9295,12 @@
public class MbmsGroupCallServiceBase extends android.app.Service {
ctor public MbmsGroupCallServiceBase();
method public void dispose(int) throws android.os.RemoteException;
- method public int initialize(android.telephony.mbms.MbmsGroupCallSessionCallback, int) throws android.os.RemoteException;
+ method public int initialize(@NonNull android.telephony.mbms.MbmsGroupCallSessionCallback, int) throws android.os.RemoteException;
method public void onAppCallbackDied(int, int);
method public android.os.IBinder onBind(android.content.Intent);
- method public int startGroupCall(int, long, java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>, android.telephony.mbms.GroupCallCallback);
+ method public int startGroupCall(int, long, @NonNull java.util.List<java.lang.Integer>, @NonNull java.util.List<java.lang.Integer>, @NonNull android.telephony.mbms.GroupCallCallback);
method public void stopGroupCall(int, long);
- method public void updateGroupCall(int, long, java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>);
+ method public void updateGroupCall(int, long, @NonNull java.util.List<java.lang.Integer>, @NonNull java.util.List<java.lang.Integer>);
}
public class MbmsStreamingServiceBase extends android.os.Binder {
diff --git a/api/test-current.txt b/api/test-current.txt
index 7a10034..1e9802a 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -2321,7 +2321,7 @@
}
public final class PhoneAccountSuggestion implements android.os.Parcelable {
- ctor public PhoneAccountSuggestion(android.telecom.PhoneAccountHandle, int, boolean);
+ ctor public PhoneAccountSuggestion(@NonNull android.telecom.PhoneAccountHandle, int, boolean);
}
public class PhoneAccountSuggestionService extends android.app.Service {
@@ -2440,12 +2440,12 @@
public class MbmsGroupCallServiceBase extends android.app.Service {
ctor public MbmsGroupCallServiceBase();
method public void dispose(int) throws android.os.RemoteException;
- method public int initialize(android.telephony.mbms.MbmsGroupCallSessionCallback, int) throws android.os.RemoteException;
+ method public int initialize(@NonNull android.telephony.mbms.MbmsGroupCallSessionCallback, int) throws android.os.RemoteException;
method public void onAppCallbackDied(int, int);
method public android.os.IBinder onBind(android.content.Intent);
- method public int startGroupCall(int, long, java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>, android.telephony.mbms.GroupCallCallback);
+ method public int startGroupCall(int, long, @NonNull java.util.List<java.lang.Integer>, @NonNull java.util.List<java.lang.Integer>, @NonNull android.telephony.mbms.GroupCallCallback);
method public void stopGroupCall(int, long);
- method public void updateGroupCall(int, long, java.util.List<java.lang.Integer>, java.util.List<java.lang.Integer>);
+ method public void updateGroupCall(int, long, @NonNull java.util.List<java.lang.Integer>, @NonNull java.util.List<java.lang.Integer>);
}
public class MbmsStreamingServiceBase extends android.os.Binder {
diff --git a/cmds/hid/hid b/cmds/hid/hid
index 2359fcd..3931da1 100755
--- a/cmds/hid/hid
+++ b/cmds/hid/hid
@@ -5,4 +5,10 @@
#
base=/system
export CLASSPATH=$base/framework/hid.jar
+
+# Preload the native portion libhidcommand_jni.so to bypass the dependency
+# checks in the Java classloader, which prohibit dependencies that aren't
+# listed in system/core/rootdir/etc/public.libraries.android.txt.
+export LD_PRELOAD=libhidcommand_jni.so
+
exec app_process $base/bin com.android.commands.hid.Hid "$@"
diff --git a/cmds/statsd/src/StatsService.cpp b/cmds/statsd/src/StatsService.cpp
index 69fbf1f..9ac888b 100644
--- a/cmds/statsd/src/StatsService.cpp
+++ b/cmds/statsd/src/StatsService.cpp
@@ -1229,70 +1229,81 @@
hardware::Return<void> StatsService::reportSpeakerImpedance(
const SpeakerImpedance& speakerImpedance) {
- LogEvent event(getWallClockSec() * NS_PER_SEC, getElapsedRealtimeNs(), speakerImpedance);
- mProcessor->OnLogEvent(&event);
+ android::util::stats_write(android::util::SPEAKER_IMPEDANCE_REPORTED,
+ speakerImpedance.speakerLocation, speakerImpedance.milliOhms);
return hardware::Void();
}
hardware::Return<void> StatsService::reportHardwareFailed(const HardwareFailed& hardwareFailed) {
- LogEvent event(getWallClockSec() * NS_PER_SEC, getElapsedRealtimeNs(), hardwareFailed);
- mProcessor->OnLogEvent(&event);
+ android::util::stats_write(android::util::HARDWARE_FAILED, int32_t(hardwareFailed.hardwareType),
+ hardwareFailed.hardwareLocation, int32_t(hardwareFailed.errorCode));
return hardware::Void();
}
hardware::Return<void> StatsService::reportPhysicalDropDetected(
const PhysicalDropDetected& physicalDropDetected) {
- LogEvent event(getWallClockSec() * NS_PER_SEC, getElapsedRealtimeNs(), physicalDropDetected);
- mProcessor->OnLogEvent(&event);
+ android::util::stats_write(android::util::PHYSICAL_DROP_DETECTED,
+ int32_t(physicalDropDetected.confidencePctg), physicalDropDetected.accelPeak,
+ physicalDropDetected.freefallDuration);
return hardware::Void();
}
hardware::Return<void> StatsService::reportChargeCycles(const ChargeCycles& chargeCycles) {
- LogEvent event(getWallClockSec() * NS_PER_SEC, getElapsedRealtimeNs(), chargeCycles);
- mProcessor->OnLogEvent(&event);
+ std::vector<int32_t> buckets = chargeCycles.cycleBucket;
+ int initialSize = buckets.size();
+ for (int i = 0; i < 10 - initialSize; i++) {
+ buckets.push_back(-1); // Push -1 for buckets that do not exist.
+ }
+ android::util::stats_write(android::util::CHARGE_CYCLES_REPORTED, buckets[0], buckets[1],
+ buckets[2], buckets[3], buckets[4], buckets[5], buckets[6], buckets[7], buckets[8],
+ buckets[9]);
return hardware::Void();
}
hardware::Return<void> StatsService::reportBatteryHealthSnapshot(
const BatteryHealthSnapshotArgs& batteryHealthSnapshotArgs) {
- LogEvent event(getWallClockSec() * NS_PER_SEC, getElapsedRealtimeNs(),
- batteryHealthSnapshotArgs);
- mProcessor->OnLogEvent(&event);
+ android::util::stats_write(android::util::BATTERY_HEALTH_SNAPSHOT,
+ int32_t(batteryHealthSnapshotArgs.type), batteryHealthSnapshotArgs.temperatureDeciC,
+ batteryHealthSnapshotArgs.voltageMicroV, batteryHealthSnapshotArgs.currentMicroA,
+ batteryHealthSnapshotArgs.openCircuitVoltageMicroV,
+ batteryHealthSnapshotArgs.resistanceMicroOhm, batteryHealthSnapshotArgs.levelPercent);
return hardware::Void();
}
hardware::Return<void> StatsService::reportSlowIo(const SlowIo& slowIo) {
- LogEvent event(getWallClockSec() * NS_PER_SEC, getElapsedRealtimeNs(), slowIo);
- mProcessor->OnLogEvent(&event);
+ android::util::stats_write(android::util::SLOW_IO, int32_t(slowIo.operation), slowIo.count);
return hardware::Void();
}
hardware::Return<void> StatsService::reportBatteryCausedShutdown(
const BatteryCausedShutdown& batteryCausedShutdown) {
- LogEvent event(getWallClockSec() * NS_PER_SEC, getElapsedRealtimeNs(), batteryCausedShutdown);
- mProcessor->OnLogEvent(&event);
+ android::util::stats_write(android::util::BATTERY_CAUSED_SHUTDOWN,
+ batteryCausedShutdown.voltageMicroV);
return hardware::Void();
}
hardware::Return<void> StatsService::reportUsbPortOverheatEvent(
const UsbPortOverheatEvent& usbPortOverheatEvent) {
- LogEvent event(getWallClockSec() * NS_PER_SEC, getElapsedRealtimeNs(), usbPortOverheatEvent);
- mProcessor->OnLogEvent(&event);
+ android::util::stats_write(android::util::USB_PORT_OVERHEAT_EVENT_REPORTED,
+ usbPortOverheatEvent.plugTemperatureDeciC, usbPortOverheatEvent.maxTemperatureDeciC,
+ usbPortOverheatEvent.timeToOverheat, usbPortOverheatEvent.timeToHysteresis,
+ usbPortOverheatEvent.timeToInactive);
return hardware::Void();
}
hardware::Return<void> StatsService::reportSpeechDspStat(
const SpeechDspStat& speechDspStat) {
- LogEvent event(getWallClockSec() * NS_PER_SEC, getElapsedRealtimeNs(), speechDspStat);
- mProcessor->OnLogEvent(&event);
+ android::util::stats_write(android::util::SPEECH_DSP_STAT_REPORTED,
+ speechDspStat.totalUptimeMillis, speechDspStat.totalDowntimeMillis,
+ speechDspStat.totalCrashCount, speechDspStat.totalRecoverCount);
return hardware::Void();
}
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 7579065..a983b27 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -252,7 +252,7 @@
}
// Pulled events will start at field 10000.
- // Next: 10048
+ // Next: 10056
oneof pulled {
WifiBytesTransfer wifi_bytes_transfer = 10000;
WifiBytesTransferByFgBg wifi_bytes_transfer_by_fg_bg = 10001;
@@ -308,6 +308,8 @@
TrainInfo train_info = 10051;
TimeZoneDataInfo time_zone_data_info = 10052;
SDCardInfo sdcard_info = 10053;
+ GpuStatsGlobalInfo gpu_stats_global_info = 10054;
+ GpuStatsAppInfo gpu_stats_app_info = 10055;
}
// DO NOT USE field numbers above 100,000 in AOSP.
@@ -5689,3 +5691,55 @@
// A version identifier for the data set on device. e.g. "2018i"
optional string tzdb_version = 1;
}
+
+/*
+ * Logs the GPU stats global health information.
+ *
+ * Logged from:
+ * frameworks/native/services/gpuservice/gpustats/
+ */
+message GpuStatsGlobalInfo {
+ // Package name of the gpu driver.
+ optional string driver_package_name = 1;
+
+ // Version name of the gpu driver.
+ optional string driver_version_name = 2;
+
+ // Version code of the gpu driver.
+ optional int64 driver_version_code = 3;
+
+ // Build time of the gpu driver in UTC as seconds since January 1, 1970.
+ optional int64 driver_build_time = 4;
+
+ // Total count of the gl driver gets loaded.
+ optional int64 gl_loading_count = 5;
+
+ // Total count of the gl driver fails to be loaded.
+ optional int64 gl_loading_failure_count = 6;
+
+ // Total count of the Vulkan driver gets loaded.
+ optional int64 vk_loading_count = 7;
+
+ // Total count of the Vulkan driver fails to be loaded.
+ optional int64 vk_loading_failure_count = 8;
+}
+
+/*
+ * Logs the GPU stats per app health information.
+ *
+ * Logged from:
+ * frameworks/native/services/gpuservice/gpustats/
+ */
+message GpuStatsAppInfo {
+ // Package name of the application that loads the gpu driver.
+ optional string app_package_name = 1;
+
+ // Version code of the gpu driver this app loads.
+ optional int64 driver_version_code = 2;
+
+ // List of all the gl driver loading times for this app.
+ repeated int64 gl_driver_loading_time = 3;
+
+ // List of all the Vulkan driver laoding times for this app.
+ repeated int64 vk_driver_loading_time = 4;
+}
diff --git a/cmds/statsd/src/logd/LogEvent.cpp b/cmds/statsd/src/logd/LogEvent.cpp
index dec36b5..0430e4e 100644
--- a/cmds/statsd/src/logd/LogEvent.cpp
+++ b/cmds/statsd/src/logd/LogEvent.cpp
@@ -21,6 +21,7 @@
#include "statslog.h"
#include <binder/IPCThreadState.h>
+#include <private/android_filesystem_config.h>
namespace android {
namespace os {
@@ -202,140 +203,11 @@
}
LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
- const SpeakerImpedance& speakerImpedance) {
- mLogdTimestampNs = wallClockTimestampNs;
- mElapsedTimestampNs = elapsedTimestampNs;
- mTagId = android::util::SPEAKER_IMPEDANCE_REPORTED;
-
- mValues.push_back(
- FieldValue(Field(mTagId, getSimpleField(1)), Value(speakerImpedance.speakerLocation)));
- mValues.push_back(
- FieldValue(Field(mTagId, getSimpleField(2)), Value(speakerImpedance.milliOhms)));
-}
-
-LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
- const HardwareFailed& hardwareFailed) {
- mLogdTimestampNs = wallClockTimestampNs;
- mElapsedTimestampNs = elapsedTimestampNs;
- mTagId = android::util::HARDWARE_FAILED;
-
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(1)),
- Value(int32_t(hardwareFailed.hardwareType))));
- mValues.push_back(
- FieldValue(Field(mTagId, getSimpleField(2)), Value(hardwareFailed.hardwareLocation)));
- mValues.push_back(
- FieldValue(Field(mTagId, getSimpleField(3)), Value(int32_t(hardwareFailed.errorCode))));
-}
-
-LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
- const PhysicalDropDetected& physicalDropDetected) {
- mLogdTimestampNs = wallClockTimestampNs;
- mElapsedTimestampNs = elapsedTimestampNs;
- mTagId = android::util::PHYSICAL_DROP_DETECTED;
-
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(1)),
- Value(int32_t(physicalDropDetected.confidencePctg))));
- mValues.push_back(
- FieldValue(Field(mTagId, getSimpleField(2)), Value(physicalDropDetected.accelPeak)));
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(3)),
- Value(physicalDropDetected.freefallDuration)));
-}
-
-LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
- const ChargeCycles& chargeCycles) {
- mLogdTimestampNs = wallClockTimestampNs;
- mElapsedTimestampNs = elapsedTimestampNs;
- mTagId = android::util::CHARGE_CYCLES_REPORTED;
-
- for (size_t i = 0; i < chargeCycles.cycleBucket.size(); i++) {
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(i + 1)),
- Value(chargeCycles.cycleBucket[i])));
- }
-}
-
-LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
- const BatteryHealthSnapshotArgs& batteryHealthSnapshotArgs) {
- mLogdTimestampNs = wallClockTimestampNs;
- mElapsedTimestampNs = elapsedTimestampNs;
- mTagId = android::util::BATTERY_HEALTH_SNAPSHOT;
-
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(1)),
- Value(int32_t(batteryHealthSnapshotArgs.type))));
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(2)),
- Value(batteryHealthSnapshotArgs.temperatureDeciC)));
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(3)),
- Value(batteryHealthSnapshotArgs.voltageMicroV)));
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(4)),
- Value(batteryHealthSnapshotArgs.currentMicroA)));
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(5)),
- Value(batteryHealthSnapshotArgs.openCircuitVoltageMicroV)));
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(6)),
- Value(batteryHealthSnapshotArgs.resistanceMicroOhm)));
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(7)),
- Value(batteryHealthSnapshotArgs.levelPercent)));
-}
-
-LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs, const SlowIo& slowIo) {
- mLogdTimestampNs = wallClockTimestampNs;
- mElapsedTimestampNs = elapsedTimestampNs;
- mTagId = android::util::SLOW_IO;
-
- int pos[] = {1};
- mValues.push_back(
- FieldValue(Field(mTagId, getSimpleField(1)), Value(int32_t(slowIo.operation))));
- pos[0]++;
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(2)), Value(slowIo.count)));
-}
-
-LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
- const SpeechDspStat& speechDspStat) {
- mLogdTimestampNs = wallClockTimestampNs;
- mElapsedTimestampNs = elapsedTimestampNs;
- mTagId = android::util::SPEECH_DSP_STAT_REPORTED;
-
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(1)),
- Value(speechDspStat.totalUptimeMillis)));
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(2)),
- Value(speechDspStat.totalDowntimeMillis)));
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(3)),
- Value(speechDspStat.totalCrashCount)));
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(4)),
- Value(speechDspStat.totalRecoverCount)));
-}
-
-LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
- const BatteryCausedShutdown& batteryCausedShutdown) {
- mLogdTimestampNs = wallClockTimestampNs;
- mElapsedTimestampNs = elapsedTimestampNs;
- mTagId = android::util::BATTERY_CAUSED_SHUTDOWN;
-
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(1)),
- Value(batteryCausedShutdown.voltageMicroV)));
-}
-
-LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
- const UsbPortOverheatEvent& usbPortOverheatEvent) {
- mLogdTimestampNs = wallClockTimestampNs;
- mElapsedTimestampNs = elapsedTimestampNs;
- mTagId = android::util::USB_PORT_OVERHEAT_EVENT_REPORTED;
-
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(1)),
- Value(usbPortOverheatEvent.plugTemperatureDeciC)));
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(2)),
- Value(usbPortOverheatEvent.maxTemperatureDeciC)));
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(3)),
- Value(usbPortOverheatEvent.timeToOverheat)));
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(4)),
- Value(usbPortOverheatEvent.timeToHysteresis)));
- mValues.push_back(FieldValue(Field(mTagId, getSimpleField(5)),
- Value(usbPortOverheatEvent.timeToInactive)));
-}
-
-LogEvent::LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
const VendorAtom& vendorAtom) {
mLogdTimestampNs = wallClockTimestampNs;
mElapsedTimestampNs = elapsedTimestampNs;
mTagId = vendorAtom.atomId;
+ mLogUid = AID_STATSD;
mValues.push_back(
FieldValue(Field(mTagId, getSimpleField(1)), Value(vendorAtom.reverseDomainName)));
diff --git a/cmds/statsd/src/logd/LogEvent.h b/cmds/statsd/src/logd/LogEvent.h
index 111a619..2fde8b4 100644
--- a/cmds/statsd/src/logd/LogEvent.h
+++ b/cmds/statsd/src/logd/LogEvent.h
@@ -108,33 +108,6 @@
const std::vector<uint8_t>& experimentIds, int32_t userId);
explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
- const SpeakerImpedance& speakerImpedance);
-
- explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
- const HardwareFailed& hardwareFailed);
-
- explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
- const PhysicalDropDetected& physicalDropDetected);
-
- explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
- const ChargeCycles& chargeCycles);
-
- explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
- const BatteryHealthSnapshotArgs& batteryHealthSnapshotArgs);
-
- explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
- const SlowIo& slowIo);
-
- explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
- const BatteryCausedShutdown& batteryCausedShutdown);
-
- explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
- const UsbPortOverheatEvent& usbPortOverheatEvent);
-
- explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
- const SpeechDspStat& speechDspStat);
-
- explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
const VendorAtom& vendorAtom);
explicit LogEvent(int64_t wallClockTimestampNs, int64_t elapsedTimestampNs,
diff --git a/core/java/android/companion/BluetoothDeviceFilterUtils.java b/core/java/android/companion/BluetoothDeviceFilterUtils.java
index bd507a6..75e726b 100644
--- a/core/java/android/companion/BluetoothDeviceFilterUtils.java
+++ b/core/java/android/companion/BluetoothDeviceFilterUtils.java
@@ -30,6 +30,7 @@
import android.util.Log;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;
@@ -78,11 +79,12 @@
static boolean matchesServiceUuid(ParcelUuid serviceUuid, ParcelUuid serviceUuidMask,
BluetoothDevice device) {
+ ParcelUuid[] uuids = device.getUuids();
final boolean result = serviceUuid == null ||
ScanFilter.matchesServiceUuids(
serviceUuid,
serviceUuidMask,
- Arrays.asList(device.getUuids()));
+ uuids == null ? Collections.emptyList() : Arrays.asList(uuids));
if (DEBUG) debugLogMatchResult(result, device, serviceUuid);
return result;
}
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index dffbd89..caf3e93 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -2655,26 +2655,24 @@
* Sets the maximum number of milliseconds that SQLite connection is allowed to be idle
* before it is closed and removed from the pool.
*
- * <p>DO NOT USE this method unless you fully understand the implication
- * of what it does.
- * A connection timeout allows the system to internally close a connection to a SQLite
- * database after a given timeout.
- * This is good for reducing app's memory consumption, but it has
- * side effects that are hard to predict. For example, SQLite internally maintains
- * a lot of "per-connection" states that apps can typically modify with a {@code PRAGMA}
- * statement, and such states will be reset once the connection is closed.
- * The system does not provide a callback that would allow apps to
- * reconfigure a newly created connection and thus there's no way to re-configure
- * connections when they're re-made internally. Do not use it unless you're sure
- * your app uses no per-connection states.
+ * <p><b>DO NOT USE</b> this method.
+ * This feature has negative side effects that are very hard to foresee.
+ * <p>A connection timeout allows the system to internally close a connection to
+ * a SQLite database after a given timeout, which is good for reducing app's memory
+ * consumption.
+ * <b>However</b> the side effect is it <b>will reset all of SQLite's per-connection
+ * states</b>, which are typically modified with a {@code PRAGMA} statement, and
+ * these states <b>will not be restored</b> when a connection is re-established
+ * internally, and the system does not provide a callback for an app to reconfigure a
+ * connection.
+ * This feature may only be used if an app relies on none of such per-connection states.
*
* @param idleConnectionTimeoutMs timeout in milliseconds. Use {@link Long#MAX_VALUE}
* to allow unlimited idle connections.
*
* @see SQLiteOpenHelper#setIdleConnectionTimeout(long)
*
- * @deprecated DO NOT USE this method unless you fully understand the implication
- * of what it does.
+ * @deprecated DO NOT USE this method. See the javadoc for the details.
*/
@NonNull
@Deprecated
diff --git a/core/java/android/database/sqlite/SQLiteOpenHelper.java b/core/java/android/database/sqlite/SQLiteOpenHelper.java
index 8163c4d..62cec0e 100644
--- a/core/java/android/database/sqlite/SQLiteOpenHelper.java
+++ b/core/java/android/database/sqlite/SQLiteOpenHelper.java
@@ -267,8 +267,8 @@
* <p>This method should be called from the constructor of the subclass,
* before opening the database
*
- * <p>DO NOT USE this method unless you fully understand the implication
- * of what it does.
+ * <p><b>DO NOT USE</b> this method.
+ * This feature has negative side effects that are very hard to foresee.
* See the javadoc of
* {@link SQLiteDatabase.OpenParams.Builder#setIdleConnectionTimeout(long)}
* for the details.
@@ -278,8 +278,9 @@
*
* @see SQLiteDatabase.OpenParams.Builder#setIdleConnectionTimeout(long)
*
- * @deprecated DO NOT USE this method unless you fully understand the implication
- * of what it does.
+ * @deprecated DO NOT USE this method. See the javadoc of
+ * {@link SQLiteDatabase.OpenParams.Builder#setIdleConnectionTimeout(long)}
+ * for the details.
*/
@Deprecated
public void setIdleConnectionTimeout(@IntRange(from = 0) final long idleConnectionTimeoutMs) {
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index cd43b42..03fc2a9 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -529,7 +529,8 @@
return ZYGOTE_PROCESS.start(processClass, niceName, uid, gid, gids,
runtimeFlags, mountExternal, targetSdkVersion, seInfo,
abi, instructionSet, appDataDir, invokeWith, packageName,
- packagesForUid, sandboxId, /*useBlastulaPool=*/ true, zygoteArgs);
+ packagesForUid, sandboxId, /*useUnspecializedAppProcessPool=*/ true,
+ zygoteArgs);
}
/** @hide */
@@ -550,7 +551,8 @@
return WebViewZygote.getProcess().start(processClass, niceName, uid, gid, gids,
runtimeFlags, mountExternal, targetSdkVersion, seInfo,
abi, instructionSet, appDataDir, invokeWith, packageName,
- packagesForUid, sandboxId, /*useBlastulaPool=*/ false, zygoteArgs);
+ packagesForUid, sandboxId, /*useUnspecializedAppProcessPool=*/ false,
+ zygoteArgs);
}
/**
diff --git a/core/java/android/os/ZygoteProcess.java b/core/java/android/os/ZygoteProcess.java
index 650232f..60f4f06 100644
--- a/core/java/android/os/ZygoteProcess.java
+++ b/core/java/android/os/ZygoteProcess.java
@@ -82,9 +82,9 @@
private static final String LOG_TAG = "ZygoteProcess";
/**
- * The default value for enabling the blastula pool.
+ * The default value for enabling the unspecialized app process (USAP) pool.
*/
- private static final String BLASTULA_POOL_ENABLED_DEFAULT = "false";
+ private static final String USAP_POOL_ENABLED_DEFAULT = "false";
/**
* The name of the socket used to communicate with the primary zygote.
@@ -97,14 +97,14 @@
private final LocalSocketAddress mZygoteSecondarySocketAddress;
/**
- * The name of the socket used to communicate with the primary blastula pool.
+ * The name of the socket used to communicate with the primary USAP pool.
*/
- private final LocalSocketAddress mBlastulaPoolSocketAddress;
+ private final LocalSocketAddress mUsapPoolSocketAddress;
/**
- * The name of the socket used to communicate with the secondary (alternate ABI) blastula pool.
+ * The name of the socket used to communicate with the secondary (alternate ABI) USAP pool.
*/
- private final LocalSocketAddress mBlastulaPoolSecondarySocketAddress;
+ private final LocalSocketAddress mUsapPoolSecondarySocketAddress;
public ZygoteProcess() {
mZygoteSocketAddress =
@@ -114,15 +114,15 @@
new LocalSocketAddress(Zygote.SECONDARY_SOCKET_NAME,
LocalSocketAddress.Namespace.RESERVED);
- mBlastulaPoolSocketAddress =
- new LocalSocketAddress(Zygote.BLASTULA_POOL_PRIMARY_SOCKET_NAME,
+ mUsapPoolSocketAddress =
+ new LocalSocketAddress(Zygote.USAP_POOL_PRIMARY_SOCKET_NAME,
LocalSocketAddress.Namespace.RESERVED);
- mBlastulaPoolSecondarySocketAddress =
- new LocalSocketAddress(Zygote.BLASTULA_POOL_SECONDARY_SOCKET_NAME,
+ mUsapPoolSecondarySocketAddress =
+ new LocalSocketAddress(Zygote.USAP_POOL_SECONDARY_SOCKET_NAME,
LocalSocketAddress.Namespace.RESERVED);
- if (fetchBlastulaPoolEnabledProp()) {
- informZygotesOfBlastulaPoolStatus();
+ if (fetchUsapPoolEnabledProp()) {
+ informZygotesOfUsapPoolStatus();
}
}
@@ -131,8 +131,8 @@
mZygoteSocketAddress = primarySocketAddress;
mZygoteSecondarySocketAddress = secondarySocketAddress;
- mBlastulaPoolSocketAddress = null;
- mBlastulaPoolSecondarySocketAddress = null;
+ mUsapPoolSocketAddress = null;
+ mUsapPoolSecondarySocketAddress = null;
}
public LocalSocketAddress getPrimarySocketAddress() {
@@ -144,7 +144,7 @@
*/
public static class ZygoteState {
final LocalSocketAddress mZygoteSocketAddress;
- final LocalSocketAddress mBlastulaSocketAddress;
+ final LocalSocketAddress mUsapSocketAddress;
private final LocalSocket mZygoteSessionSocket;
@@ -156,13 +156,13 @@
private boolean mClosed;
private ZygoteState(LocalSocketAddress zygoteSocketAddress,
- LocalSocketAddress blastulaSocketAddress,
+ LocalSocketAddress usapSocketAddress,
LocalSocket zygoteSessionSocket,
DataInputStream zygoteInputStream,
BufferedWriter zygoteOutputWriter,
List<String> abiList) {
this.mZygoteSocketAddress = zygoteSocketAddress;
- this.mBlastulaSocketAddress = blastulaSocketAddress;
+ this.mUsapSocketAddress = usapSocketAddress;
this.mZygoteSessionSocket = zygoteSessionSocket;
this.mZygoteInputStream = zygoteInputStream;
this.mZygoteOutputWriter = zygoteOutputWriter;
@@ -171,16 +171,16 @@
/**
* Create a new ZygoteState object by connecting to the given Zygote socket and saving the
- * given blastula socket address.
+ * given USAP socket address.
*
* @param zygoteSocketAddress Zygote socket to connect to
- * @param blastulaSocketAddress Blastula socket address to save for later
+ * @param usapSocketAddress USAP socket address to save for later
* @return A new ZygoteState object containing a session socket for the given Zygote socket
* address
* @throws IOException
*/
public static ZygoteState connect(LocalSocketAddress zygoteSocketAddress,
- LocalSocketAddress blastulaSocketAddress)
+ LocalSocketAddress usapSocketAddress)
throws IOException {
DataInputStream zygoteInputStream = null;
@@ -202,16 +202,16 @@
throw ex;
}
- return new ZygoteState(zygoteSocketAddress, blastulaSocketAddress,
+ return new ZygoteState(zygoteSocketAddress, usapSocketAddress,
zygoteSessionSocket, zygoteInputStream, zygoteOutputWriter,
getAbiList(zygoteOutputWriter, zygoteInputStream));
}
- LocalSocket getBlastulaSessionSocket() throws IOException {
- final LocalSocket blastulaSessionSocket = new LocalSocket();
- blastulaSessionSocket.connect(this.mBlastulaSocketAddress);
+ LocalSocket getUsapSessionSocket() throws IOException {
+ final LocalSocket usapSessionSocket = new LocalSocket();
+ usapSessionSocket.connect(this.mUsapSocketAddress);
- return blastulaSessionSocket;
+ return usapSessionSocket;
}
boolean matches(String abi) {
@@ -268,13 +268,13 @@
private ZygoteState secondaryZygoteState;
/**
- * If the blastula pool should be created and used to start applications.
+ * If the USAP pool should be created and used to start applications.
*
- * Setting this value to false will disable the creation, maintenance, and use of the blastula
- * pool. When the blastula pool is disabled the application lifecycle will be identical to
+ * Setting this value to false will disable the creation, maintenance, and use of the USAP
+ * pool. When the USAP pool is disabled the application lifecycle will be identical to
* previous versions of Android.
*/
- private boolean mBlastulaPoolEnabled = false;
+ private boolean mUsapPoolEnabled = false;
/**
* Start a new process.
@@ -328,11 +328,11 @@
@Nullable String packageName,
@Nullable String[] packagesForUid,
@Nullable String sandboxId,
- boolean useBlastulaPool,
+ boolean useUsapPool,
@Nullable String[] zygoteArgs) {
// TODO (chriswailes): Is there a better place to check this value?
- if (fetchBlastulaPoolEnabledPropWithMinInterval()) {
- informZygotesOfBlastulaPoolStatus();
+ if (fetchUsapPoolEnabledPropWithMinInterval()) {
+ informZygotesOfUsapPoolStatus();
}
try {
@@ -340,7 +340,7 @@
runtimeFlags, mountExternal, targetSdkVersion, seInfo,
abi, instructionSet, appDataDir, invokeWith, /*startChildZygote=*/false,
packageName, packagesForUid, sandboxId,
- useBlastulaPool, zygoteArgs);
+ useUsapPool, zygoteArgs);
} catch (ZygoteStartFailedEx ex) {
Log.e(LOG_TAG,
"Starting VM process through Zygote failed");
@@ -388,7 +388,7 @@
*/
@GuardedBy("mLock")
private Process.ProcessStartResult zygoteSendArgsAndGetResult(
- ZygoteState zygoteState, boolean useBlastulaPool, ArrayList<String> args)
+ ZygoteState zygoteState, boolean useUsapPool, ArrayList<String> args)
throws ZygoteStartFailedEx {
// Throw early if any of the arguments are malformed. This means we can
// avoid writing a partial response to the zygote.
@@ -415,41 +415,41 @@
Process.ProcessStartResult result = new Process.ProcessStartResult();
// TODO (chriswailes): Move branch body into separate function.
- if (useBlastulaPool && mBlastulaPoolEnabled && isValidBlastulaCommand(args)) {
- LocalSocket blastulaSessionSocket = null;
+ if (useUsapPool && mUsapPoolEnabled && isValidUsapCommand(args)) {
+ LocalSocket usapSessionSocket = null;
try {
- blastulaSessionSocket = zygoteState.getBlastulaSessionSocket();
+ usapSessionSocket = zygoteState.getUsapSessionSocket();
- final BufferedWriter blastulaWriter =
+ final BufferedWriter usapWriter =
new BufferedWriter(
- new OutputStreamWriter(blastulaSessionSocket.getOutputStream()),
+ new OutputStreamWriter(usapSessionSocket.getOutputStream()),
Zygote.SOCKET_BUFFER_SIZE);
- final DataInputStream blastulaReader =
- new DataInputStream(blastulaSessionSocket.getInputStream());
+ final DataInputStream usapReader =
+ new DataInputStream(usapSessionSocket.getInputStream());
- blastulaWriter.write(msgStr);
- blastulaWriter.flush();
+ usapWriter.write(msgStr);
+ usapWriter.flush();
- result.pid = blastulaReader.readInt();
- // Blastulas can't be used to spawn processes that need wrappers.
+ result.pid = usapReader.readInt();
+ // USAPs can't be used to spawn processes that need wrappers.
result.usingWrapper = false;
if (result.pid < 0) {
- throw new ZygoteStartFailedEx("Blastula specialization failed");
+ throw new ZygoteStartFailedEx("USAP specialization failed");
}
return result;
} catch (IOException ex) {
- // If there was an IOException using the blastula pool we will log the error and
+ // If there was an IOException using the USAP pool we will log the error and
// attempt to start the process through the Zygote.
- Log.e(LOG_TAG, "IO Exception while communicating with blastula pool - "
+ Log.e(LOG_TAG, "IO Exception while communicating with USAP pool - "
+ ex.getMessage());
} finally {
try {
- blastulaSessionSocket.close();
+ usapSessionSocket.close();
} catch (IOException ex) {
- Log.e(LOG_TAG, "Failed to close blastula session socket: " + ex.getMessage());
+ Log.e(LOG_TAG, "Failed to close USAP session socket: " + ex.getMessage());
}
}
}
@@ -481,9 +481,9 @@
}
/**
- * Flags that may not be passed to a blastula.
+ * Flags that may not be passed to a USAP.
*/
- private static final String[] INVALID_BLASTULA_FLAGS = {
+ private static final String[] INVALID_USAP_FLAGS = {
"--query-abi-list",
"--get-pid",
"--preload-default",
@@ -497,13 +497,13 @@
};
/**
- * Tests a command list to see if it is valid to send to a blastula.
- * @param args Zygote/Blastula command arguments
- * @return True if the command can be passed to a blastula; false otherwise
+ * Tests a command list to see if it is valid to send to a USAP.
+ * @param args Zygote/USAP command arguments
+ * @return True if the command can be passed to a USAP; false otherwise
*/
- private static boolean isValidBlastulaCommand(ArrayList<String> args) {
+ private static boolean isValidUsapCommand(ArrayList<String> args) {
for (String flag : args) {
- for (String badFlag : INVALID_BLASTULA_FLAGS) {
+ for (String badFlag : INVALID_USAP_FLAGS) {
if (flag.startsWith(badFlag)) {
return false;
}
@@ -551,7 +551,7 @@
@Nullable String packageName,
@Nullable String[] packagesForUid,
@Nullable String sandboxId,
- boolean useBlastulaPool,
+ boolean useUnspecializedAppProcessPool,
@Nullable String[] extraArgs)
throws ZygoteStartFailedEx {
ArrayList<String> argsForZygote = new ArrayList<String>();
@@ -651,41 +651,41 @@
synchronized(mLock) {
return zygoteSendArgsAndGetResult(openZygoteSocketIfNeeded(abi),
- useBlastulaPool,
+ useUnspecializedAppProcessPool,
argsForZygote);
}
}
- private boolean fetchBlastulaPoolEnabledProp() {
- boolean origVal = mBlastulaPoolEnabled;
+ private boolean fetchUsapPoolEnabledProp() {
+ boolean origVal = mUsapPoolEnabled;
final String propertyString =
Zygote.getSystemProperty(
- DeviceConfig.RuntimeNative.BLASTULA_POOL_ENABLED,
- BLASTULA_POOL_ENABLED_DEFAULT);
+ DeviceConfig.RuntimeNative.USAP_POOL_ENABLED,
+ USAP_POOL_ENABLED_DEFAULT);
if (!propertyString.isEmpty()) {
- mBlastulaPoolEnabled =
+ mUsapPoolEnabled =
Zygote.getSystemPropertyBoolean(
- DeviceConfig.RuntimeNative.BLASTULA_POOL_ENABLED,
- Boolean.parseBoolean(BLASTULA_POOL_ENABLED_DEFAULT));
+ DeviceConfig.RuntimeNative.USAP_POOL_ENABLED,
+ Boolean.parseBoolean(USAP_POOL_ENABLED_DEFAULT));
}
- if (origVal != mBlastulaPoolEnabled) {
- Log.i(LOG_TAG, "blastulaPoolEnabled = " + mBlastulaPoolEnabled);
+ if (origVal != mUsapPoolEnabled) {
+ Log.i(LOG_TAG, "usapPoolEnabled = " + mUsapPoolEnabled);
}
- return origVal != mBlastulaPoolEnabled;
+ return origVal != mUsapPoolEnabled;
}
private long mLastPropCheckTimestamp = 0;
- private boolean fetchBlastulaPoolEnabledPropWithMinInterval() {
+ private boolean fetchUsapPoolEnabledPropWithMinInterval() {
final long currentTimestamp = SystemClock.elapsedRealtime();
if (currentTimestamp - mLastPropCheckTimestamp >= Zygote.PROPERTY_CHECK_INTERVAL) {
mLastPropCheckTimestamp = currentTimestamp;
- return fetchBlastulaPoolEnabledProp();
+ return fetchUsapPoolEnabledProp();
}
return false;
@@ -882,7 +882,7 @@
private void attemptConnectionToPrimaryZygote() throws IOException {
if (primaryZygoteState == null || primaryZygoteState.isClosed()) {
primaryZygoteState =
- ZygoteState.connect(mZygoteSocketAddress, mBlastulaPoolSocketAddress);
+ ZygoteState.connect(mZygoteSocketAddress, mUsapPoolSocketAddress);
maybeSetApiBlacklistExemptions(primaryZygoteState, false);
maybeSetHiddenApiAccessLogSampleRate(primaryZygoteState);
@@ -897,7 +897,7 @@
if (secondaryZygoteState == null || secondaryZygoteState.isClosed()) {
secondaryZygoteState =
ZygoteState.connect(mZygoteSecondarySocketAddress,
- mBlastulaPoolSecondarySocketAddress);
+ mUsapPoolSecondarySocketAddress);
maybeSetApiBlacklistExemptions(secondaryZygoteState, false);
maybeSetHiddenApiAccessLogSampleRate(secondaryZygoteState);
@@ -1052,11 +1052,11 @@
}
/**
- * Sends messages to the zygotes telling them to change the status of their blastula pools. If
+ * Sends messages to the zygotes telling them to change the status of their USAP pools. If
* this notification fails the ZygoteProcess will fall back to the previous behavior.
*/
- private void informZygotesOfBlastulaPoolStatus() {
- final String command = "1\n--blastula-pool-enabled=" + mBlastulaPoolEnabled + "\n";
+ private void informZygotesOfUsapPoolStatus() {
+ final String command = "1\n--usap-pool-enabled=" + mUsapPoolEnabled + "\n";
synchronized (mLock) {
try {
@@ -1065,8 +1065,8 @@
primaryZygoteState.mZygoteOutputWriter.write(command);
primaryZygoteState.mZygoteOutputWriter.flush();
} catch (IOException ioe) {
- mBlastulaPoolEnabled = !mBlastulaPoolEnabled;
- Log.w(LOG_TAG, "Failed to inform zygotes of blastula pool status: "
+ mUsapPoolEnabled = !mUsapPoolEnabled;
+ Log.w(LOG_TAG, "Failed to inform zygotes of USAP pool status: "
+ ioe.getMessage());
return;
}
@@ -1082,7 +1082,7 @@
secondaryZygoteState.mZygoteInputStream.readInt();
} catch (IOException ioe) {
throw new IllegalStateException(
- "Blastula pool state change cause an irrecoverable error",
+ "USAP pool state change cause an irrecoverable error",
ioe);
}
} catch (IOException ioe) {
@@ -1096,7 +1096,7 @@
primaryZygoteState.mZygoteInputStream.readInt();
} catch (IOException ioe) {
throw new IllegalStateException(
- "Blastula pool state change cause an irrecoverable error",
+ "USAP pool state change cause an irrecoverable error",
ioe);
}
}
@@ -1150,7 +1150,7 @@
abi, instructionSet, null /* appDataDir */, null /* invokeWith */,
true /* startChildZygote */, null /* packageName */,
null /* packagesForUid */, null /* sandboxId */,
- false /* useBlastulaPool */, extraArgs);
+ false /* useUsapPool */, extraArgs);
} catch (ZygoteStartFailedEx ex) {
throw new RuntimeException("Starting child-zygote through Zygote failed", ex);
}
diff --git a/core/java/android/provider/DeviceConfig.java b/core/java/android/provider/DeviceConfig.java
index 010e3b1..2cd3c48 100644
--- a/core/java/android/provider/DeviceConfig.java
+++ b/core/java/android/provider/DeviceConfig.java
@@ -145,32 +145,32 @@
*/
/**
- * If {@code true}, enables the blastula pool feature.
+ * If {@code true}, enables the unspecialized app process (USAP) pool feature.
*
* @hide for internal use only
*/
- String BLASTULA_POOL_ENABLED = "blastula_pool_enabled";
+ String USAP_POOL_ENABLED = "usap_pool_enabled";
/**
- * The maximum number of processes to keep in the blastula pool.
+ * The maximum number of processes to keep in the USAP pool.
*
* @hide for internal use only
*/
- String BLASTULA_POOL_SIZE_MAX = "blastula_pool_size_max";
+ String USAP_POOL_SIZE_MAX = "usap_pool_size_max";
/**
- * The minimum number of processes to keep in the blastula pool.
+ * The minimum number of processes to keep in the USAP pool.
*
* @hide for internal use only
*/
- String BLASTULA_POOL_SIZE_MIN = "blastula_pool_size_min";
+ String USAP_POOL_SIZE_MIN = "usap_pool_size_min";
/**
* The threshold used to determine if the pool should be refilled.
*
* @hide for internal use only
*/
- String BLASTULA_POOL_REFILL_THRESHOLD = "blastula_refill_threshold";
+ String USAP_POOL_REFILL_THRESHOLD = "usap_refill_threshold";
}
/**
diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java
index 0ccaec0..2bba3c9 100644
--- a/core/java/com/android/internal/os/Zygote.java
+++ b/core/java/com/android/internal/os/Zygote.java
@@ -126,8 +126,8 @@
/** Read-write external storage should be mounted instead of package sandbox */
public static final int MOUNT_EXTERNAL_FULL = IVold.REMOUNT_MODE_FULL;
- /** Number of bytes sent to the Zygote over blastula pipes or the pool event FD */
- public static final int BLASTULA_MANAGEMENT_MESSAGE_BYTES = 8;
+ /** Number of bytes sent to the Zygote over USAP pipes or the pool event FD */
+ public static final int USAP_MANAGEMENT_MESSAGE_BYTES = 8;
/**
* An extraArg passed when a zygote process is forking a child-zygote, specifying a name
@@ -187,12 +187,12 @@
/**
* @hide for internal use only
*/
- public static final String BLASTULA_POOL_PRIMARY_SOCKET_NAME = "blastula_pool";
+ public static final String USAP_POOL_PRIMARY_SOCKET_NAME = "usap_pool_primary";
/**
* @hide for internal use only
*/
- public static final String BLASTULA_POOL_SECONDARY_SOCKET_NAME = "blastula_pool_secondary";
+ public static final String USAP_POOL_SECONDARY_SOCKET_NAME = "usap_pool_secondary";
private Zygote() {}
@@ -262,7 +262,7 @@
String sandboxId);
/**
- * Specialize a Blastula instance. The current VM must have been started
+ * Specialize an unspecialized app process. The current VM must have been started
* with the -Xzygote flag.
*
* @param uid The UNIX uid that the new process should setuid() to before spawning any threads
@@ -282,12 +282,11 @@
* @param instructionSet null-ok The instruction set to use.
* @param appDataDir null-ok The data directory of the app.
*/
- public static void specializeBlastula(int uid, int gid, int[] gids, int runtimeFlags,
+ public static void specializeAppProcess(int uid, int gid, int[] gids, int runtimeFlags,
int[][] rlimits, int mountExternal, String seInfo, String niceName,
boolean startChildZygote, String instructionSet, String appDataDir, String packageName,
String[] packagesForUID, String sandboxId) {
-
- nativeSpecializeBlastula(uid, gid, gids, runtimeFlags, rlimits, mountExternal, seInfo,
+ nativeSpecializeAppProcess(uid, gid, gids, runtimeFlags, rlimits, mountExternal, seInfo,
niceName, startChildZygote, instructionSet, appDataDir,
packageName, packagesForUID, sandboxId);
@@ -306,7 +305,7 @@
ZygoteHooks.postForkCommon();
}
- private static native void nativeSpecializeBlastula(int uid, int gid, int[] gids,
+ private static native void nativeSpecializeAppProcess(int uid, int gid, int[] gids,
int runtimeFlags, int[][] rlimits, int mountExternal, String seInfo, String niceName,
boolean startChildZygote, String instructionSet, String appDataDir, String packageName,
String[] packagesForUID, String sandboxId);
@@ -427,11 +426,11 @@
defaultValue);
}
- protected static void emptyBlastulaPool() {
- nativeEmptyBlastulaPool();
+ protected static void emptyUsapPool() {
+ nativeEmptyUsapPool();
}
- private static native void nativeEmptyBlastulaPool();
+ private static native void nativeEmptyUsapPool();
/**
* Returns the value of a system property converted to a boolean using specific logic.
@@ -454,105 +453,105 @@
}
/**
- * @return Number of blastulas currently in the pool
+ * @return Number of unspecialized app processes currently in the pool
*/
- static int getBlastulaPoolCount() {
- return nativeGetBlastulaPoolCount();
+ static int getUsapPoolCount() {
+ return nativeGetUsapPoolCount();
}
- private static native int nativeGetBlastulaPoolCount();
+ private static native int nativeGetUsapPoolCount();
/**
* @return The event FD used for communication between the signal handler and the ZygoteServer
* poll loop
*/
- static FileDescriptor getBlastulaPoolEventFD() {
+ static FileDescriptor getUsapPoolEventFD() {
FileDescriptor fd = new FileDescriptor();
- fd.setInt$(nativeGetBlastulaPoolEventFD());
+ fd.setInt$(nativeGetUsapPoolEventFD());
return fd;
}
- private static native int nativeGetBlastulaPoolEventFD();
+ private static native int nativeGetUsapPoolEventFD();
/**
- * Fork a new blastula process from the zygote
+ * Fork a new unspecialized app process from the zygote
*
* @param sessionSocketRawFDs Anonymous session sockets that are currently open
- * @return In the Zygote process this function will always return null; in blastula processes
- * this function will return a Runnable object representing the new application that is
- * passed up from blastulaMain.
+ * @return In the Zygote process this function will always return null; in unspecialized app
+ * processes this function will return a Runnable object representing the new
+ * application that is passed up from usapMain.
*/
- static Runnable forkBlastula(LocalServerSocket blastulaPoolSocket,
- int[] sessionSocketRawFDs) {
+ static Runnable forkUsap(LocalServerSocket usapPoolSocket,
+ int[] sessionSocketRawFDs) {
FileDescriptor[] pipeFDs = null;
try {
pipeFDs = Os.pipe2(O_CLOEXEC);
} catch (ErrnoException errnoEx) {
- throw new IllegalStateException("Unable to create blastula pipe.", errnoEx);
+ throw new IllegalStateException("Unable to create USAP pipe.", errnoEx);
}
int pid =
- nativeForkBlastula(pipeFDs[0].getInt$(), pipeFDs[1].getInt$(), sessionSocketRawFDs);
+ nativeForkUsap(pipeFDs[0].getInt$(), pipeFDs[1].getInt$(), sessionSocketRawFDs);
if (pid == 0) {
IoUtils.closeQuietly(pipeFDs[0]);
- return blastulaMain(blastulaPoolSocket, pipeFDs[1]);
+ return usapMain(usapPoolSocket, pipeFDs[1]);
} else {
// The read-end of the pipe will be closed by the native code.
- // See removeBlastulaTableEntry();
+ // See removeUsapTableEntry();
IoUtils.closeQuietly(pipeFDs[1]);
return null;
}
}
- private static native int nativeForkBlastula(int readPipeFD,
+ private static native int nativeForkUsap(int readPipeFD,
int writePipeFD,
int[] sessionSocketRawFDs);
/**
- * This function is used by blastulas to wait for specialization requests from the system
- * server.
+ * This function is used by unspecialized app processes to wait for specialization requests from
+ * the system server.
*
* @param writePipe The write end of the reporting pipe used to communicate with the poll loop
* of the ZygoteServer.
* @return A runnable oject representing the new application.
*/
- private static Runnable blastulaMain(LocalServerSocket blastulaPoolSocket,
- FileDescriptor writePipe) {
+ private static Runnable usapMain(LocalServerSocket usapPoolSocket,
+ FileDescriptor writePipe) {
final int pid = Process.myPid();
LocalSocket sessionSocket = null;
- DataOutputStream blastulaOutputStream = null;
+ DataOutputStream usapOutputStream = null;
Credentials peerCredentials = null;
ZygoteArguments args = null;
while (true) {
try {
- sessionSocket = blastulaPoolSocket.accept();
+ sessionSocket = usapPoolSocket.accept();
- BufferedReader blastulaReader =
+ BufferedReader usapReader =
new BufferedReader(new InputStreamReader(sessionSocket.getInputStream()));
- blastulaOutputStream =
+ usapOutputStream =
new DataOutputStream(sessionSocket.getOutputStream());
peerCredentials = sessionSocket.getPeerCredentials();
- String[] argStrings = readArgumentList(blastulaReader);
+ String[] argStrings = readArgumentList(usapReader);
if (argStrings != null) {
args = new ZygoteArguments(argStrings);
// TODO (chriswailes): Should this only be run for debug builds?
- validateBlastulaCommand(args);
+ validateUsapCommand(args);
break;
} else {
- Log.e("Blastula", "Truncated command received.");
+ Log.e("USAP", "Truncated command received.");
IoUtils.closeQuietly(sessionSocket);
}
} catch (Exception ex) {
- Log.e("Blastula", ex.getMessage());
+ Log.e("USAP", ex.getMessage());
IoUtils.closeQuietly(sessionSocket);
}
}
@@ -571,29 +570,29 @@
try {
// Used by ZygoteProcess.zygoteSendArgsAndGetResult to fill in a
// Process.ProcessStartResult object.
- blastulaOutputStream.writeInt(pid);
+ usapOutputStream.writeInt(pid);
} catch (IOException ioEx) {
- Log.e("Blastula", "Failed to write response to session socket: " + ioEx.getMessage());
+ Log.e("USAP", "Failed to write response to session socket: " + ioEx.getMessage());
System.exit(-1);
} finally {
IoUtils.closeQuietly(sessionSocket);
- IoUtils.closeQuietly(blastulaPoolSocket);
+ IoUtils.closeQuietly(usapPoolSocket);
}
try {
ByteArrayOutputStream buffer =
- new ByteArrayOutputStream(Zygote.BLASTULA_MANAGEMENT_MESSAGE_BYTES);
+ new ByteArrayOutputStream(Zygote.USAP_MANAGEMENT_MESSAGE_BYTES);
DataOutputStream outputStream = new DataOutputStream(buffer);
- // This is written as a long so that the blastula reporting pipe and blastula pool
- // event FD handlers in ZygoteServer.runSelectLoop can be unified. These two cases
- // should both send/receive 8 bytes.
+ // This is written as a long so that the USAP reporting pipe and USAP pool event FD
+ // handlers in ZygoteServer.runSelectLoop can be unified. These two cases should both
+ // send/receive 8 bytes.
outputStream.writeLong(pid);
outputStream.flush();
Os.write(writePipe, buffer.toByteArray(), 0, buffer.size());
} catch (Exception ex) {
- Log.e("Blastula",
+ Log.e("USAP",
String.format("Failed to write PID (%d) to pipe (%d): %s",
pid, writePipe.getInt$(), ex.getMessage()));
System.exit(-1);
@@ -601,7 +600,7 @@
IoUtils.closeQuietly(writePipe);
}
- specializeBlastula(args.mUid, args.mGid, args.mGids,
+ specializeAppProcess(args.mUid, args.mGid, args.mGids,
args.mRuntimeFlags, rlimits, args.mMountExternal,
args.mSeInfo, args.mNiceName, args.mStartChildZygote,
args.mInstructionSet, args.mAppDataDir, args.mPackageName,
@@ -619,37 +618,37 @@
null /* classLoader */);
}
- private static final String BLASTULA_ERROR_PREFIX = "Invalid command to blastula: ";
+ private static final String USAP_ERROR_PREFIX = "Invalid command to USAP: ";
/**
- * Checks a set of zygote arguments to see if they can be handled by a blastula. Throws an
+ * Checks a set of zygote arguments to see if they can be handled by a USAP. Throws an
* exception if an invalid arugment is encountered.
* @param args The arguments to test
*/
- private static void validateBlastulaCommand(ZygoteArguments args) {
+ private static void validateUsapCommand(ZygoteArguments args) {
if (args.mAbiListQuery) {
- throw new IllegalArgumentException(BLASTULA_ERROR_PREFIX + "--query-abi-list");
+ throw new IllegalArgumentException(USAP_ERROR_PREFIX + "--query-abi-list");
} else if (args.mPidQuery) {
- throw new IllegalArgumentException(BLASTULA_ERROR_PREFIX + "--get-pid");
+ throw new IllegalArgumentException(USAP_ERROR_PREFIX + "--get-pid");
} else if (args.mPreloadDefault) {
- throw new IllegalArgumentException(BLASTULA_ERROR_PREFIX + "--preload-default");
+ throw new IllegalArgumentException(USAP_ERROR_PREFIX + "--preload-default");
} else if (args.mPreloadPackage != null) {
- throw new IllegalArgumentException(BLASTULA_ERROR_PREFIX + "--preload-package");
+ throw new IllegalArgumentException(USAP_ERROR_PREFIX + "--preload-package");
} else if (args.mPreloadApp != null) {
- throw new IllegalArgumentException(BLASTULA_ERROR_PREFIX + "--preload-app");
+ throw new IllegalArgumentException(USAP_ERROR_PREFIX + "--preload-app");
} else if (args.mStartChildZygote) {
- throw new IllegalArgumentException(BLASTULA_ERROR_PREFIX + "--start-child-zygote");
+ throw new IllegalArgumentException(USAP_ERROR_PREFIX + "--start-child-zygote");
} else if (args.mApiBlacklistExemptions != null) {
throw new IllegalArgumentException(
- BLASTULA_ERROR_PREFIX + "--set-api-blacklist-exemptions");
+ USAP_ERROR_PREFIX + "--set-api-blacklist-exemptions");
} else if (args.mHiddenApiAccessLogSampleRate != -1) {
throw new IllegalArgumentException(
- BLASTULA_ERROR_PREFIX + "--hidden-api-log-sampling-rate=");
+ USAP_ERROR_PREFIX + "--hidden-api-log-sampling-rate=");
} else if (args.mHiddenApiAccessStatslogSampleRate != -1) {
throw new IllegalArgumentException(
- BLASTULA_ERROR_PREFIX + "--hidden-api-statslog-sampling-rate=");
+ USAP_ERROR_PREFIX + "--hidden-api-statslog-sampling-rate=");
} else if (args.mInvokeWith != null) {
- throw new IllegalArgumentException(BLASTULA_ERROR_PREFIX + "--invoke-with");
+ throw new IllegalArgumentException(USAP_ERROR_PREFIX + "--invoke-with");
} else if (args.mPermittedCapabilities != 0 || args.mEffectiveCapabilities != 0) {
throw new ZygoteSecurityException("Client may not specify capabilities: "
+ "permitted=0x" + Long.toHexString(args.mPermittedCapabilities)
@@ -658,25 +657,25 @@
}
/**
- * @return Raw file descriptors for the read-end of blastula reporting pipes.
+ * @return Raw file descriptors for the read-end of USAP reporting pipes.
*/
- protected static int[] getBlastulaPipeFDs() {
- return nativeGetBlastulaPipeFDs();
+ protected static int[] getUsapPipeFDs() {
+ return nativeGetUsapPipeFDs();
}
- private static native int[] nativeGetBlastulaPipeFDs();
+ private static native int[] nativeGetUsapPipeFDs();
/**
- * Remove the blastula table entry for the provided process ID.
+ * Remove the USAP table entry for the provided process ID.
*
- * @param blastulaPID Process ID of the entry to remove
+ * @param usapPID Process ID of the entry to remove
* @return True if the entry was removed; false if it doesn't exist
*/
- protected static boolean removeBlastulaTableEntry(int blastulaPID) {
- return nativeRemoveBlastulaTableEntry(blastulaPID);
+ protected static boolean removeUsapTableEntry(int usapPID) {
+ return nativeRemoveUsapTableEntry(usapPID);
}
- private static native boolean nativeRemoveBlastulaTableEntry(int blastulaPID);
+ private static native boolean nativeRemoveUsapTableEntry(int usapPID);
/**
* uid 1000 (Process.SYSTEM_UID) may specify any uid > 1000 in normal
diff --git a/core/java/com/android/internal/os/ZygoteArguments.java b/core/java/com/android/internal/os/ZygoteArguments.java
index 3beee78..28642d8 100644
--- a/core/java/com/android/internal/os/ZygoteArguments.java
+++ b/core/java/com/android/internal/os/ZygoteArguments.java
@@ -103,8 +103,8 @@
/**
*
*/
- boolean mBlastulaPoolEnabled;
- boolean mBlastulaPoolStatusSpecified = false;
+ boolean mUsapPoolEnabled;
+ boolean mUsapPoolStatusSpecified = false;
/**
* from all --rlimit=r,c,m
@@ -418,9 +418,9 @@
throw new IllegalArgumentException("Duplicate arg specified");
}
mSandboxId = arg.substring(arg.indexOf('=') + 1);
- } else if (arg.startsWith("--blastula-pool-enabled=")) {
- mBlastulaPoolStatusSpecified = true;
- mBlastulaPoolEnabled = Boolean.parseBoolean(arg.substring(arg.indexOf('=') + 1));
+ } else if (arg.startsWith("--usap-pool-enabled=")) {
+ mUsapPoolStatusSpecified = true;
+ mUsapPoolEnabled = Boolean.parseBoolean(arg.substring(arg.indexOf('=') + 1));
expectRuntimeArgs = false;
} else {
break;
diff --git a/core/java/com/android/internal/os/ZygoteConnection.java b/core/java/com/android/internal/os/ZygoteConnection.java
index bcdce31..87adce7 100644
--- a/core/java/com/android/internal/os/ZygoteConnection.java
+++ b/core/java/com/android/internal/os/ZygoteConnection.java
@@ -159,8 +159,8 @@
return null;
}
- if (parsedArgs.mBlastulaPoolStatusSpecified) {
- return handleBlastulaPoolStatusChange(zygoteServer, parsedArgs.mBlastulaPoolEnabled);
+ if (parsedArgs.mUsapPoolStatusSpecified) {
+ return handleUsapPoolStatusChange(zygoteServer, parsedArgs.mUsapPoolEnabled);
}
if (parsedArgs.mPreloadDefault) {
@@ -331,18 +331,18 @@
}
}
- private Runnable stateChangeWithBlastulaPoolReset(ZygoteServer zygoteServer,
+ private Runnable stateChangeWithUsapPoolReset(ZygoteServer zygoteServer,
Runnable stateChangeCode) {
try {
- if (zygoteServer.isBlastulaPoolEnabled()) {
- Zygote.emptyBlastulaPool();
+ if (zygoteServer.isUsapPoolEnabled()) {
+ Zygote.emptyUsapPool();
}
stateChangeCode.run();
- if (zygoteServer.isBlastulaPoolEnabled()) {
+ if (zygoteServer.isUsapPoolEnabled()) {
Runnable fpResult =
- zygoteServer.fillBlastulaPool(
+ zygoteServer.fillUsapPool(
new int[]{mSocket.getFileDescriptor().getInt$()});
if (fpResult != null) {
@@ -363,24 +363,24 @@
* Makes the necessary changes to implement a new API blacklist exemption policy, and then
* responds to the system server, letting it know that the task has been completed.
*
- * This necessitates a change to the internal state of the Zygote. As such, if the blastula
- * pool is enabled all existing blastulas have an incorrect API blacklist exemption list. To
+ * This necessitates a change to the internal state of the Zygote. As such, if the USAP
+ * pool is enabled all existing USAPs have an incorrect API blacklist exemption list. To
* properly handle this request the pool must be emptied and refilled. This process can return
* a Runnable object that must be returned to ZygoteServer.runSelectLoop to be invoked.
*
* @param zygoteServer The server object that received the request
* @param exemptions The new exemption list.
- * @return A Runnable object representing a new app in any blastulas spawned from here; the
+ * @return A Runnable object representing a new app in any USAPs spawned from here; the
* zygote process will always receive a null value from this function.
*/
private Runnable handleApiBlacklistExemptions(ZygoteServer zygoteServer, String[] exemptions) {
- return stateChangeWithBlastulaPoolReset(zygoteServer,
+ return stateChangeWithUsapPoolReset(zygoteServer,
() -> ZygoteInit.setApiBlacklistExemptions(exemptions));
}
- private Runnable handleBlastulaPoolStatusChange(ZygoteServer zygoteServer, boolean newStatus) {
+ private Runnable handleUsapPoolStatusChange(ZygoteServer zygoteServer, boolean newStatus) {
try {
- Runnable fpResult = zygoteServer.setBlastulaPoolStatus(newStatus, mSocket);
+ Runnable fpResult = zygoteServer.setUsapPoolStatus(newStatus, mSocket);
if (fpResult == null) {
mSocketOutStream.writeInt(0);
@@ -473,8 +473,8 @@
/**
* Changes the API access log sample rate for the Zygote and processes spawned from it.
*
- * This necessitates a change to the internal state of the Zygote. As such, if the blastula
- * pool is enabled all existing blastulas have an incorrect API access log sample rate. To
+ * This necessitates a change to the internal state of the Zygote. As such, if the USAP
+ * pool is enabled all existing USAPs have an incorrect API access log sample rate. To
* properly handle this request the pool must be emptied and refilled. This process can return
* a Runnable object that must be returned to ZygoteServer.runSelectLoop to be invoked.
*
@@ -486,11 +486,10 @@
*/
private Runnable handleHiddenApiAccessLogSampleRate(ZygoteServer zygoteServer,
int samplingRate, int statsdSamplingRate) {
- return stateChangeWithBlastulaPoolReset(zygoteServer, () -> {
+ return stateChangeWithUsapPoolReset(zygoteServer, () -> {
int maxSamplingRate = Math.max(samplingRate, statsdSamplingRate);
ZygoteInit.setHiddenApiAccessLogSampleRate(maxSamplingRate);
- HiddenApiUsageLogger.setHiddenApiAccessLogSampleRates(samplingRate,
- statsdSamplingRate);
+ HiddenApiUsageLogger.setHiddenApiAccessLogSampleRates(samplingRate, statsdSamplingRate);
ZygoteInit.setHiddenApiUsageLogger(HiddenApiUsageLogger.getInstance());
});
}
diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java
index 7cddf75..a5e7202 100644
--- a/core/java/com/android/internal/os/ZygoteInit.java
+++ b/core/java/com/android/internal/os/ZygoteInit.java
@@ -99,7 +99,7 @@
private static final String ABI_LIST_ARG = "--abi-list=";
// TODO (chriswailes): Re-name this --zygote-socket-name= and then add a
- // --blastula-socket-name parameter.
+ // --usap-socket-name parameter.
private static final String SOCKET_NAME_ARG = "--socket-name=";
/**
diff --git a/core/java/com/android/internal/os/ZygoteServer.java b/core/java/com/android/internal/os/ZygoteServer.java
index c4c98ba..6595317 100644
--- a/core/java/com/android/internal/os/ZygoteServer.java
+++ b/core/java/com/android/internal/os/ZygoteServer.java
@@ -51,39 +51,40 @@
public static final String TAG = "ZygoteServer";
/**
- * The maximim value that will be accepted from the BLASTULA_POOL_SIZE_MAX device property.
- * is a mirror of BLASTULA_POOL_MAX_LIMIT found in com_android_internal_os_Zygote.cpp.
+ * The maximim value that will be accepted from the USAP_POOL_SIZE_MAX device property.
+ * is a mirror of USAP_POOL_MAX_LIMIT found in com_android_internal_os_Zygote.cpp.
*/
- private static final int BLASTULA_POOL_SIZE_MAX_LIMIT = 100;
+ private static final int USAP_POOL_SIZE_MAX_LIMIT = 100;
/**
- * The minimum value that will be accepted from the BLASTULA_POOL_SIZE_MIN device property.
+ * The minimum value that will be accepted from the USAP_POOL_SIZE_MIN device property.
*/
- private static final int BLASTULA_POOL_SIZE_MIN_LIMIT = 1;
+ private static final int USAP_POOL_SIZE_MIN_LIMIT = 1;
- /** The default value used for the BLASTULA_POOL_SIZE_MAX device property */
- private static final String BLASTULA_POOL_SIZE_MAX_DEFAULT = "10";
+ /** The default value used for the USAP_POOL_SIZE_MAX device property */
+ private static final String USAP_POOL_SIZE_MAX_DEFAULT = "10";
- /** The default value used for the BLASTULA_POOL_SIZE_MIN device property */
- private static final String BLASTULA_POOL_SIZE_MIN_DEFAULT = "1";
+ /** The default value used for the USAP_POOL_SIZE_MIN device property */
+ private static final String USAP_POOL_SIZE_MIN_DEFAULT = "1";
/**
- * Indicates if this Zygote server can support a blastula pool. Currently this should only be
- * true for the primary and secondary Zygotes, and not the App Zygotes or the WebView Zygote.
+ * Indicates if this Zygote server can support a unspecialized app process pool. Currently this
+ * should only be true for the primary and secondary Zygotes, and not the App Zygotes or the
+ * WebView Zygote.
*
* TODO (chriswailes): Make this an explicit argument to the constructor
*/
- private final boolean mBlastulaPoolSupported;
+ private final boolean mUsapPoolSupported;
/**
- * If the blastula pool should be created and used to start applications.
+ * If the unspecialized app process pool should be created and used to start applications.
*
- * Setting this value to false will disable the creation, maintenance, and use of the blastula
- * pool. When the blastula pool is disabled the application lifecycle will be identical to
+ * Setting this value to false will disable the creation, maintenance, and use of the USAP
+ * pool. When the USAP pool is disabled the application lifecycle will be identical to
* previous versions of Android.
*/
- private boolean mBlastulaPoolEnabled = false;
+ private boolean mUsapPoolEnabled = false;
/**
* Listening socket that accepts new server connections.
@@ -91,15 +92,15 @@
private LocalServerSocket mZygoteSocket;
/**
- * The name of the blastula socket to use if the blastula pool is enabled.
+ * The name of the unspecialized app process pool socket to use if the USAP pool is enabled.
*/
- private LocalServerSocket mBlastulaPoolSocket;
+ private LocalServerSocket mUsapPoolSocket;
/**
* File descriptor used for communication between the signal handler and the ZygoteServer poll
* loop.
* */
- private FileDescriptor mBlastulaPoolEventFD;
+ private FileDescriptor mUsapPoolEventFD;
/**
* Whether or not mZygoteSocket's underlying FD should be closed directly.
@@ -116,62 +117,61 @@
private boolean mIsForkChild;
/**
- * The runtime-adjustable maximum Blastula pool size.
+ * The runtime-adjustable maximum USAP pool size.
*/
- private int mBlastulaPoolSizeMax = 0;
+ private int mUsapPoolSizeMax = 0;
/**
- * The runtime-adjustable minimum Blastula pool size.
+ * The runtime-adjustable minimum USAP pool size.
*/
- private int mBlastulaPoolSizeMin = 0;
+ private int mUsapPoolSizeMin = 0;
/**
- * The runtime-adjustable value used to determine when to re-fill the
- * blastula pool. The pool will be re-filled when
- * (sBlastulaPoolMax - gBlastulaPoolCount) >= sBlastulaPoolRefillThreshold.
+ * The runtime-adjustable value used to determine when to re-fill the USAP pool. The pool will
+ * be re-filled when (mUsapPoolMax - gUsapPoolCount) >= sUsapPoolRefillThreshold.
*/
- private int mBlastulaPoolRefillThreshold = 0;
+ private int mUsapPoolRefillThreshold = 0;
ZygoteServer() {
- mBlastulaPoolEventFD = null;
+ mUsapPoolEventFD = null;
mZygoteSocket = null;
- mBlastulaPoolSocket = null;
+ mUsapPoolSocket = null;
- mBlastulaPoolSupported = false;
+ mUsapPoolSupported = false;
}
/**
- * Initialize the Zygote server with the Zygote server socket, blastula pool server socket,
- * and blastula pool event FD.
+ * Initialize the Zygote server with the Zygote server socket, USAP pool server socket, and USAP
+ * pool event FD.
*
* @param isPrimaryZygote If this is the primary Zygote or not.
*/
ZygoteServer(boolean isPrimaryZygote) {
- mBlastulaPoolEventFD = Zygote.getBlastulaPoolEventFD();
+ mUsapPoolEventFD = Zygote.getUsapPoolEventFD();
if (isPrimaryZygote) {
mZygoteSocket = Zygote.createManagedSocketFromInitSocket(Zygote.PRIMARY_SOCKET_NAME);
- mBlastulaPoolSocket =
+ mUsapPoolSocket =
Zygote.createManagedSocketFromInitSocket(
- Zygote.BLASTULA_POOL_PRIMARY_SOCKET_NAME);
+ Zygote.USAP_POOL_PRIMARY_SOCKET_NAME);
} else {
mZygoteSocket = Zygote.createManagedSocketFromInitSocket(Zygote.SECONDARY_SOCKET_NAME);
- mBlastulaPoolSocket =
+ mUsapPoolSocket =
Zygote.createManagedSocketFromInitSocket(
- Zygote.BLASTULA_POOL_SECONDARY_SOCKET_NAME);
+ Zygote.USAP_POOL_SECONDARY_SOCKET_NAME);
}
- fetchBlastulaPoolPolicyProps();
+ fetchUsapPoolPolicyProps();
- mBlastulaPoolSupported = true;
+ mUsapPoolSupported = true;
}
void setForkChild() {
mIsForkChild = true;
}
- public boolean isBlastulaPoolEnabled() {
- return mBlastulaPoolEnabled;
+ public boolean isUsapPoolEnabled() {
+ return mUsapPoolEnabled;
}
/**
@@ -240,95 +240,95 @@
return mZygoteSocket.getFileDescriptor();
}
- private void fetchBlastulaPoolPolicyProps() {
- if (mBlastulaPoolSupported) {
- final String blastulaPoolSizeMaxPropString =
+ private void fetchUsapPoolPolicyProps() {
+ if (mUsapPoolSupported) {
+ final String usapPoolSizeMaxPropString =
Zygote.getSystemProperty(
- DeviceConfig.RuntimeNative.BLASTULA_POOL_SIZE_MAX,
- BLASTULA_POOL_SIZE_MAX_DEFAULT);
+ DeviceConfig.RuntimeNative.USAP_POOL_SIZE_MAX,
+ USAP_POOL_SIZE_MAX_DEFAULT);
- if (!blastulaPoolSizeMaxPropString.isEmpty()) {
- mBlastulaPoolSizeMax =
+ if (!usapPoolSizeMaxPropString.isEmpty()) {
+ mUsapPoolSizeMax =
Integer.min(
- Integer.parseInt(blastulaPoolSizeMaxPropString),
- BLASTULA_POOL_SIZE_MAX_LIMIT);
+ Integer.parseInt(usapPoolSizeMaxPropString),
+ USAP_POOL_SIZE_MAX_LIMIT);
}
- final String blastulaPoolSizeMinPropString =
+ final String usapPoolSizeMinPropString =
Zygote.getSystemProperty(
- DeviceConfig.RuntimeNative.BLASTULA_POOL_SIZE_MIN,
- BLASTULA_POOL_SIZE_MIN_DEFAULT);
+ DeviceConfig.RuntimeNative.USAP_POOL_SIZE_MIN,
+ USAP_POOL_SIZE_MIN_DEFAULT);
- if (!blastulaPoolSizeMinPropString.isEmpty()) {
- mBlastulaPoolSizeMin =
+ if (!usapPoolSizeMinPropString.isEmpty()) {
+ mUsapPoolSizeMin =
Integer.max(
- Integer.parseInt(blastulaPoolSizeMinPropString),
- BLASTULA_POOL_SIZE_MIN_LIMIT);
+ Integer.parseInt(usapPoolSizeMinPropString),
+ USAP_POOL_SIZE_MIN_LIMIT);
}
- final String blastulaPoolRefillThresholdPropString =
+ final String usapPoolRefillThresholdPropString =
Zygote.getSystemProperty(
- DeviceConfig.RuntimeNative.BLASTULA_POOL_REFILL_THRESHOLD,
- Integer.toString(mBlastulaPoolSizeMax / 2));
+ DeviceConfig.RuntimeNative.USAP_POOL_REFILL_THRESHOLD,
+ Integer.toString(mUsapPoolSizeMax / 2));
- if (!blastulaPoolRefillThresholdPropString.isEmpty()) {
- mBlastulaPoolRefillThreshold =
+ if (!usapPoolRefillThresholdPropString.isEmpty()) {
+ mUsapPoolRefillThreshold =
Integer.min(
- Integer.parseInt(blastulaPoolRefillThresholdPropString),
- mBlastulaPoolSizeMax);
+ Integer.parseInt(usapPoolRefillThresholdPropString),
+ mUsapPoolSizeMax);
}
}
}
private long mLastPropCheckTimestamp = 0;
- private void fetchBlastulaPoolPolicyPropsWithMinInterval() {
+ private void fetchUsapPoolPolicyPropsWithMinInterval() {
final long currentTimestamp = SystemClock.elapsedRealtime();
if (currentTimestamp - mLastPropCheckTimestamp >= Zygote.PROPERTY_CHECK_INTERVAL) {
- fetchBlastulaPoolPolicyProps();
+ fetchUsapPoolPolicyProps();
mLastPropCheckTimestamp = currentTimestamp;
}
}
/**
- * Checks to see if the current policy says that pool should be refilled, and spawns new
- * blastulas if necessary.
+ * Checks to see if the current policy says that pool should be refilled, and spawns new USAPs
+ * if necessary.
*
* @param sessionSocketRawFDs Anonymous session sockets that are currently open
- * @return In the Zygote process this function will always return null; in blastula processes
- * this function will return a Runnable object representing the new application that is
- * passed up from blastulaMain.
+ * @return In the Zygote process this function will always return null; in unspecialized app
+ * processes this function will return a Runnable object representing the new
+ * application that is passed up from usapMain.
*/
- Runnable fillBlastulaPool(int[] sessionSocketRawFDs) {
- Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "Zygote:FillBlastulaPool");
+ Runnable fillUsapPool(int[] sessionSocketRawFDs) {
+ Trace.traceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER, "Zygote:FillUsapPool");
- int blastulaPoolCount = Zygote.getBlastulaPoolCount();
- int numBlastulasToSpawn = mBlastulaPoolSizeMax - blastulaPoolCount;
+ int usapPoolCount = Zygote.getUsapPoolCount();
+ int numUsapsToSpawn = mUsapPoolSizeMax - usapPoolCount;
- if (blastulaPoolCount < mBlastulaPoolSizeMin
- || numBlastulasToSpawn >= mBlastulaPoolRefillThreshold) {
+ if (usapPoolCount < mUsapPoolSizeMin
+ || numUsapsToSpawn >= mUsapPoolRefillThreshold) {
// Disable some VM functionality and reset some system values
// before forking.
ZygoteHooks.preFork();
Zygote.resetNicePriority();
- while (blastulaPoolCount++ < mBlastulaPoolSizeMax) {
- Runnable caller = Zygote.forkBlastula(mBlastulaPoolSocket, sessionSocketRawFDs);
+ while (usapPoolCount++ < mUsapPoolSizeMax) {
+ Runnable caller = Zygote.forkUsap(mUsapPoolSocket, sessionSocketRawFDs);
if (caller != null) {
return caller;
}
}
- // Re-enable runtime services for the Zygote. Blastula services
- // are re-enabled in specializeBlastula.
+ // Re-enable runtime services for the Zygote. Services for unspecialized app process
+ // are re-enabled in specializeAppProcess.
ZygoteHooks.postForkCommon();
Log.i("zygote",
- "Filled the blastula pool. New blastulas: " + numBlastulasToSpawn);
+ "Filled the USAP pool. New USAPs: " + numUsapsToSpawn);
}
Trace.traceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER);
@@ -337,23 +337,23 @@
}
/**
- * Empty or fill the blastula pool as dictated by the current and new blastula pool statuses.
+ * Empty or fill the USAP pool as dictated by the current and new USAP pool statuses.
*/
- Runnable setBlastulaPoolStatus(boolean newStatus, LocalSocket sessionSocket) {
- if (!mBlastulaPoolSupported) {
+ Runnable setUsapPoolStatus(boolean newStatus, LocalSocket sessionSocket) {
+ if (!mUsapPoolSupported) {
Log.w(TAG,
- "Attempting to enable a blastula pool for a Zygote that doesn't support it.");
+ "Attempting to enable a USAP pool for a Zygote that doesn't support it.");
return null;
- } else if (mBlastulaPoolEnabled == newStatus) {
+ } else if (mUsapPoolEnabled == newStatus) {
return null;
}
- mBlastulaPoolEnabled = newStatus;
+ mUsapPoolEnabled = newStatus;
if (newStatus) {
- return fillBlastulaPool(new int[]{ sessionSocket.getFileDescriptor().getInt$() });
+ return fillUsapPool(new int[]{ sessionSocket.getFileDescriptor().getInt$() });
} else {
- Zygote.emptyBlastulaPool();
+ Zygote.emptyUsapPool();
return null;
}
}
@@ -371,25 +371,25 @@
peers.add(null);
while (true) {
- fetchBlastulaPoolPolicyPropsWithMinInterval();
+ fetchUsapPoolPolicyPropsWithMinInterval();
- int[] blastulaPipeFDs = null;
+ int[] usapPipeFDs = null;
StructPollfd[] pollFDs = null;
// Allocate enough space for the poll structs, taking into account
- // the state of the blastula pool for this Zygote (could be a
+ // the state of the USAP pool for this Zygote (could be a
// regular Zygote, a WebView Zygote, or an AppZygote).
- if (mBlastulaPoolEnabled) {
- blastulaPipeFDs = Zygote.getBlastulaPipeFDs();
- pollFDs = new StructPollfd[socketFDs.size() + 1 + blastulaPipeFDs.length];
+ if (mUsapPoolEnabled) {
+ usapPipeFDs = Zygote.getUsapPipeFDs();
+ pollFDs = new StructPollfd[socketFDs.size() + 1 + usapPipeFDs.length];
} else {
pollFDs = new StructPollfd[socketFDs.size()];
}
/*
- * For reasons of correctness the blastula pool pipe and event FDs
+ * For reasons of correctness the USAP pool pipe and event FDs
* must be processed before the session and server sockets. This
- * is to ensure that the blastula pool accounting information is
+ * is to ensure that the USAP pool accounting information is
* accurate when handling other requests like API blacklist
* exemptions.
*/
@@ -402,17 +402,17 @@
++pollIndex;
}
- final int blastulaPoolEventFDIndex = pollIndex;
+ final int usapPoolEventFDIndex = pollIndex;
- if (mBlastulaPoolEnabled) {
+ if (mUsapPoolEnabled) {
pollFDs[pollIndex] = new StructPollfd();
- pollFDs[pollIndex].fd = mBlastulaPoolEventFD;
+ pollFDs[pollIndex].fd = mUsapPoolEventFD;
pollFDs[pollIndex].events = (short) POLLIN;
++pollIndex;
- for (int blastulaPipeFD : blastulaPipeFDs) {
+ for (int usapPipeFD : usapPipeFDs) {
FileDescriptor managedFd = new FileDescriptor();
- managedFd.setInt$(blastulaPipeFD);
+ managedFd.setInt$(usapPipeFD);
pollFDs[pollIndex] = new StructPollfd();
pollFDs[pollIndex].fd = managedFd;
@@ -427,7 +427,7 @@
throw new RuntimeException("poll failed", ex);
}
- boolean blastulaPoolFDRead = false;
+ boolean usapPoolFDRead = false;
while (--pollIndex >= 0) {
if ((pollFDs[pollIndex].revents & POLLIN) == 0) {
@@ -441,7 +441,7 @@
peers.add(newPeer);
socketFDs.add(newPeer.getFileDescriptor());
- } else if (pollIndex < blastulaPoolEventFDIndex) {
+ } else if (pollIndex < usapPoolEventFDIndex) {
// Session socket accepted from the Zygote server socket
try {
@@ -502,56 +502,56 @@
mIsForkChild = false;
}
} else {
- // Either the blastula pool event FD or a blastula reporting pipe.
+ // Either the USAP pool event FD or a USAP reporting pipe.
- // If this is the event FD the payload will be the number of blastulas removed.
- // If this is a reporting pipe FD the payload will be the PID of the blastula
+ // If this is the event FD the payload will be the number of USAPs removed.
+ // If this is a reporting pipe FD the payload will be the PID of the USAP
// that was just specialized.
long messagePayload = -1;
try {
- byte[] buffer = new byte[Zygote.BLASTULA_MANAGEMENT_MESSAGE_BYTES];
+ byte[] buffer = new byte[Zygote.USAP_MANAGEMENT_MESSAGE_BYTES];
int readBytes = Os.read(pollFDs[pollIndex].fd, buffer, 0, buffer.length);
- if (readBytes == Zygote.BLASTULA_MANAGEMENT_MESSAGE_BYTES) {
+ if (readBytes == Zygote.USAP_MANAGEMENT_MESSAGE_BYTES) {
DataInputStream inputStream =
new DataInputStream(new ByteArrayInputStream(buffer));
messagePayload = inputStream.readLong();
} else {
- Log.e(TAG, "Incomplete read from blastula management FD of size "
+ Log.e(TAG, "Incomplete read from USAP management FD of size "
+ readBytes);
continue;
}
} catch (Exception ex) {
- if (pollIndex == blastulaPoolEventFDIndex) {
- Log.e(TAG, "Failed to read from blastula pool event FD: "
+ if (pollIndex == usapPoolEventFDIndex) {
+ Log.e(TAG, "Failed to read from USAP pool event FD: "
+ ex.getMessage());
} else {
- Log.e(TAG, "Failed to read from blastula reporting pipe: "
+ Log.e(TAG, "Failed to read from USAP reporting pipe: "
+ ex.getMessage());
}
continue;
}
- if (pollIndex > blastulaPoolEventFDIndex) {
- Zygote.removeBlastulaTableEntry((int) messagePayload);
+ if (pollIndex > usapPoolEventFDIndex) {
+ Zygote.removeUsapTableEntry((int) messagePayload);
}
- blastulaPoolFDRead = true;
+ usapPoolFDRead = true;
}
}
- // Check to see if the blastula pool needs to be refilled.
- if (blastulaPoolFDRead) {
+ // Check to see if the USAP pool needs to be refilled.
+ if (usapPoolFDRead) {
int[] sessionSocketRawFDs =
socketFDs.subList(1, socketFDs.size())
.stream()
.mapToInt(fd -> fd.getInt$())
.toArray();
- final Runnable command = fillBlastulaPool(sessionSocketRawFDs);
+ final Runnable command = fillUsapPool(sessionSocketRawFDs);
if (command != null) {
return command;
diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 2ccb01a..c6f62ca 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -138,32 +138,32 @@
static int gZygoteSocketFD = -1;
/**
- * The file descriptor for the Blastula pool socket opened by init.
+ * The file descriptor for the unspecialized app process (USAP) pool socket opened by init.
*/
-static int gBlastulaPoolSocketFD = -1;
+static int gUsapPoolSocketFD = -1;
/**
- * The number of Blastulas currently in this Zygote's pool.
+ * The number of USAPs currently in this Zygote's pool.
*/
-static std::atomic_uint32_t gBlastulaPoolCount = 0;
+static std::atomic_uint32_t gUsapPoolCount = 0;
/**
- * Event file descriptor used to communicate reaped blastulas to the
+ * Event file descriptor used to communicate reaped USAPs to the
* ZygoteServer.
*/
-static int gBlastulaPoolEventFD = -1;
+static int gUsapPoolEventFD = -1;
/**
- * The maximum value that the gBlastulaPoolSizeMax variable may take. This value
- * is a mirror of ZygoteServer.BLASTULA_POOL_SIZE_MAX_LIMIT
+ * The maximum value that the gUSAPPoolSizeMax variable may take. This value
+ * is a mirror of ZygoteServer.USAP_POOL_SIZE_MAX_LIMIT
*/
-static constexpr int BLASTULA_POOL_SIZE_MAX_LIMIT = 100;
+static constexpr int USAP_POOL_SIZE_MAX_LIMIT = 100;
/**
- * A helper class containing accounting information for Blastulas.
+ * A helper class containing accounting information for USAPs.
*/
-class BlastulaTableEntry {
+class UsapTableEntry {
public:
struct EntryStorage {
int32_t pid;
@@ -181,7 +181,7 @@
static_assert(decltype(mStorage)::is_always_lock_free);
public:
- constexpr BlastulaTableEntry() : mStorage(INVALID_ENTRY_VALUE) {}
+ constexpr UsapTableEntry() : mStorage(INVALID_ENTRY_VALUE) {}
/**
* If the provided PID matches the one stored in this entry, the entry will
@@ -246,7 +246,7 @@
* Sets the entry to the given values if it is currently invalid.
*
* @param pid The process ID for the new entry.
- * @param read_pipe_fd The read end of the blastula control pipe for this
+ * @param read_pipe_fd The read end of the USAP control pipe for this
* process.
* @return True if the entry was set; false otherwise.
*/
@@ -263,14 +263,14 @@
};
/**
- * A table containing information about the Blastulas currently in the pool.
+ * A table containing information about the USAPs currently in the pool.
*
* Multiple threads may be attempting to modify the table, either from the
* signal handler or from the ZygoteServer poll loop. Atomic loads/stores in
- * the BlastulaTableEntry class prevent data races during these concurrent
+ * the USAPTableEntry class prevent data races during these concurrent
* operations.
*/
-static std::array<BlastulaTableEntry, BLASTULA_POOL_SIZE_MAX_LIMIT> gBlastulaTable;
+static std::array<UsapTableEntry, USAP_POOL_SIZE_MAX_LIMIT> gUsapTable;
/**
* The list of open zygote file descriptors.
@@ -295,7 +295,7 @@
};
// Forward declaration so we don't have to move the signal handler.
-static bool RemoveBlastulaTableEntry(pid_t blastula_pid);
+static bool RemoveUsapTableEntry(pid_t usap_pid);
static void RuntimeAbort(JNIEnv* env, int line, const char* msg) {
std::ostringstream oss;
@@ -307,7 +307,7 @@
static void SigChldHandler(int /*signal_number*/) {
pid_t pid;
int status;
- int64_t blastulas_removed = 0;
+ int64_t usaps_removed = 0;
// It's necessary to save and restore the errno during this function.
// Since errno is stored per thread, changing it here modifies the errno
@@ -338,9 +338,9 @@
kill(getpid(), SIGKILL);
}
- // Check to see if the PID is in the blastula pool and remove it if it is.
- if (RemoveBlastulaTableEntry(pid)) {
- ++blastulas_removed;
+ // Check to see if the PID is in the USAP pool and remove it if it is.
+ if (RemoveUsapTableEntry(pid)) {
+ ++usaps_removed;
}
}
@@ -351,12 +351,12 @@
"Zygote SIGCHLD error in waitpid: %s", strerror(errno));
}
- if (blastulas_removed > 0) {
- if (write(gBlastulaPoolEventFD, &blastulas_removed, sizeof(blastulas_removed)) == -1) {
+ if (usaps_removed > 0) {
+ if (write(gUsapPoolEventFD, &usaps_removed, sizeof(usaps_removed)) == -1) {
// If this write fails something went terribly wrong. We will now kill
// the zygote and let the system bring it back up.
async_safe_format_log(ANDROID_LOG_ERROR, LOG_TAG,
- "Zygote failed to write to blastula pool event FD: %s",
+ "Zygote failed to write to USAP pool event FD: %s",
strerror(errno));
kill(getpid(), SIGKILL);
}
@@ -1181,12 +1181,12 @@
}
}
-static void ClearBlastulaTable() {
- for (BlastulaTableEntry& entry : gBlastulaTable) {
+static void ClearUsapTable() {
+ for (UsapTableEntry& entry : gUsapTable) {
entry.Clear();
}
- gBlastulaPoolCount = 0;
+ gUsapPoolCount = 0;
}
// Utility routine to fork a process from the zygote.
@@ -1231,8 +1231,8 @@
// Clean up any descriptors which must be closed immediately
DetachDescriptors(env, fds_to_close, fail_fn);
- // Invalidate the entries in the blastula table.
- ClearBlastulaTable();
+ // Invalidate the entries in the USAP table.
+ ClearUsapTable();
// Re-open all remaining open file descriptors so that they aren't shared
// with the zygote across a fork.
@@ -1525,47 +1525,47 @@
}
/**
- * Adds the given information about a newly created blastula to the Zygote's
- * blastula table.
+ * Adds the given information about a newly created unspecialized app
+ * processes to the Zygote's USAP table.
*
- * @param blastula_pid Process ID of the newly created blastula
- * @param read_pipe_fd File descriptor for the read end of the blastula
- * reporting pipe. Used in the ZygoteServer poll loop to track blastula
+ * @param usap_pid Process ID of the newly created USAP
+ * @param read_pipe_fd File descriptor for the read end of the USAP
+ * reporting pipe. Used in the ZygoteServer poll loop to track USAP
* specialization.
*/
-static void AddBlastulaTableEntry(pid_t blastula_pid, int read_pipe_fd) {
- static int sBlastulaTableInsertIndex = 0;
+static void AddUsapTableEntry(pid_t usap_pid, int read_pipe_fd) {
+ static int sUsapTableInsertIndex = 0;
- int search_index = sBlastulaTableInsertIndex;
+ int search_index = sUsapTableInsertIndex;
do {
- if (gBlastulaTable[search_index].SetIfInvalid(blastula_pid, read_pipe_fd)) {
+ if (gUsapTable[search_index].SetIfInvalid(usap_pid, read_pipe_fd)) {
// Start our next search right after where we finished this one.
- sBlastulaTableInsertIndex = (search_index + 1) % gBlastulaTable.size();
+ sUsapTableInsertIndex = (search_index + 1) % gUsapTable.size();
return;
}
- search_index = (search_index + 1) % gBlastulaTable.size();
- } while (search_index != sBlastulaTableInsertIndex);
+ search_index = (search_index + 1) % gUsapTable.size();
+ } while (search_index != sUsapTableInsertIndex);
// Much like money in the banana stand, there should always be an entry
- // in the blastula table.
+ // in the USAP table.
__builtin_unreachable();
}
/**
- * Invalidates the entry in the BlastulaTable corresponding to the provided
- * process ID if it is present. If an entry was removed the blastula pool
+ * Invalidates the entry in the USAPTable corresponding to the provided
+ * process ID if it is present. If an entry was removed the USAP pool
* count is decremented.
*
- * @param blastula_pid Process ID of the blastula entry to invalidate
+ * @param usap_pid Process ID of the USAP entry to invalidate
* @return True if an entry was invalidated; false otherwise
*/
-static bool RemoveBlastulaTableEntry(pid_t blastula_pid) {
- for (BlastulaTableEntry& entry : gBlastulaTable) {
- if (entry.ClearForPID(blastula_pid)) {
- --gBlastulaPoolCount;
+static bool RemoveUsapTableEntry(pid_t usap_pid) {
+ for (UsapTableEntry& entry : gUsapTable) {
+ if (entry.ClearForPID(usap_pid)) {
+ --gUsapPoolCount;
return true;
}
}
@@ -1574,13 +1574,13 @@
}
/**
- * @return A vector of the read pipe FDs for each of the active blastulas.
+ * @return A vector of the read pipe FDs for each of the active USAPs.
*/
-std::vector<int> MakeBlastulaPipeReadFDVector() {
+std::vector<int> MakeUsapPipeReadFDVector() {
std::vector<int> fd_vec;
- fd_vec.reserve(gBlastulaTable.size());
+ fd_vec.reserve(gUsapTable.size());
- for (BlastulaTableEntry& entry : gBlastulaTable) {
+ for (UsapTableEntry& entry : gUsapTable) {
auto entry_values = entry.GetValues();
if (entry_values.has_value()) {
@@ -1624,16 +1624,16 @@
ExtractJIntArray(env, "zygote", nice_name, managed_fds_to_ignore)
.value_or(std::vector<int>());
- std::vector<int> blastula_pipes = MakeBlastulaPipeReadFDVector();
+ std::vector<int> usap_pipes = MakeUsapPipeReadFDVector();
- fds_to_close.insert(fds_to_close.end(), blastula_pipes.begin(), blastula_pipes.end());
- fds_to_ignore.insert(fds_to_ignore.end(), blastula_pipes.begin(), blastula_pipes.end());
+ fds_to_close.insert(fds_to_close.end(), usap_pipes.begin(), usap_pipes.end());
+ fds_to_ignore.insert(fds_to_ignore.end(), usap_pipes.begin(), usap_pipes.end());
- fds_to_close.push_back(gBlastulaPoolSocketFD);
+ fds_to_close.push_back(gUsapPoolSocketFD);
- if (gBlastulaPoolEventFD != -1) {
- fds_to_close.push_back(gBlastulaPoolEventFD);
- fds_to_ignore.push_back(gBlastulaPoolEventFD);
+ if (gUsapPoolEventFD != -1) {
+ fds_to_close.push_back(gUsapPoolEventFD);
+ fds_to_ignore.push_back(gUsapPoolEventFD);
}
pid_t pid = ForkCommon(env, false, fds_to_close, fds_to_ignore);
@@ -1652,14 +1652,14 @@
JNIEnv* env, jclass, uid_t uid, gid_t gid, jintArray gids,
jint runtime_flags, jobjectArray rlimits, jlong permitted_capabilities,
jlong effective_capabilities) {
- std::vector<int> fds_to_close(MakeBlastulaPipeReadFDVector()),
+ std::vector<int> fds_to_close(MakeUsapPipeReadFDVector()),
fds_to_ignore(fds_to_close);
- fds_to_close.push_back(gBlastulaPoolSocketFD);
+ fds_to_close.push_back(gUsapPoolSocketFD);
- if (gBlastulaPoolEventFD != -1) {
- fds_to_close.push_back(gBlastulaPoolEventFD);
- fds_to_ignore.push_back(gBlastulaPoolEventFD);
+ if (gUsapPoolEventFD != -1) {
+ fds_to_close.push_back(gUsapPoolEventFD);
+ fds_to_ignore.push_back(gUsapPoolEventFD);
}
pid_t pid = ForkCommon(env, true,
@@ -1696,49 +1696,52 @@
}
/**
- * A JNI function that forks a blastula from the Zygote while ensuring proper
- * file descriptor hygiene.
+ * A JNI function that forks an unspecialized app process from the Zygote while
+ * ensuring proper file descriptor hygiene.
*
* @param env Managed runtime environment
- * @param read_pipe_fd The read FD for the blastula reporting pipe. Manually closed by blastlas
+ * @param read_pipe_fd The read FD for the USAP reporting pipe. Manually closed by blastlas
* in managed code.
- * @param write_pipe_fd The write FD for the blastula reporting pipe. Manually closed by the
+ * @param write_pipe_fd The write FD for the USAP reporting pipe. Manually closed by the
* zygote in managed code.
* @param managed_session_socket_fds A list of anonymous session sockets that must be ignored by
- * the FD hygiene code and automatically "closed" in the new blastula.
+ * the FD hygiene code and automatically "closed" in the new USAP.
* @return
*/
-static jint com_android_internal_os_Zygote_nativeForkBlastula(JNIEnv* env, jclass,
- jint read_pipe_fd, jint write_pipe_fd, jintArray managed_session_socket_fds) {
- std::vector<int> fds_to_close(MakeBlastulaPipeReadFDVector()),
+static jint com_android_internal_os_Zygote_nativeForkUsap(JNIEnv* env,
+ jclass,
+ jint read_pipe_fd,
+ jint write_pipe_fd,
+ jintArray managed_session_socket_fds) {
+ std::vector<int> fds_to_close(MakeUsapPipeReadFDVector()),
fds_to_ignore(fds_to_close);
std::vector<int> session_socket_fds =
- ExtractJIntArray(env, "blastula", nullptr, managed_session_socket_fds)
+ ExtractJIntArray(env, "USAP", nullptr, managed_session_socket_fds)
.value_or(std::vector<int>());
- // The Blastula Pool Event FD is created during the initialization of the
- // blastula pool and should always be valid here.
+ // The USAP Pool Event FD is created during the initialization of the
+ // USAP pool and should always be valid here.
fds_to_close.push_back(gZygoteSocketFD);
- fds_to_close.push_back(gBlastulaPoolEventFD);
+ fds_to_close.push_back(gUsapPoolEventFD);
fds_to_close.insert(fds_to_close.end(), session_socket_fds.begin(), session_socket_fds.end());
fds_to_ignore.push_back(gZygoteSocketFD);
- fds_to_ignore.push_back(gBlastulaPoolSocketFD);
- fds_to_ignore.push_back(gBlastulaPoolEventFD);
+ fds_to_ignore.push_back(gUsapPoolSocketFD);
+ fds_to_ignore.push_back(gUsapPoolEventFD);
fds_to_ignore.push_back(read_pipe_fd);
fds_to_ignore.push_back(write_pipe_fd);
fds_to_ignore.insert(fds_to_ignore.end(), session_socket_fds.begin(), session_socket_fds.end());
- pid_t blastula_pid = ForkCommon(env, /* is_system_server= */ false, fds_to_close, fds_to_ignore);
+ pid_t usap_pid = ForkCommon(env, /* is_system_server= */ false, fds_to_close, fds_to_ignore);
- if (blastula_pid != 0) {
- ++gBlastulaPoolCount;
- AddBlastulaTableEntry(blastula_pid, read_pipe_fd);
+ if (usap_pid != 0) {
+ ++gUsapPoolCount;
+ AddUsapTableEntry(usap_pid, read_pipe_fd);
}
- return blastula_pid;
+ return usap_pid;
}
static void com_android_internal_os_Zygote_nativeAllowFileAcrossFork(
@@ -1803,7 +1806,8 @@
}
/**
- * Called from a blastula to specialize the process for a specific application.
+ * Called from an unspecialized app process to specialize the process for a
+ * given application.
*
* @param env Managed runtime environment
* @param uid User ID of the new application
@@ -1818,7 +1822,7 @@
* @param instruction_set The instruction set expected/requested by the new application
* @param app_data_dir Path to the application's data directory
*/
-static void com_android_internal_os_Zygote_nativeSpecializeBlastula(
+static void com_android_internal_os_Zygote_nativeSpecializeAppProcess(
JNIEnv* env, jclass, jint uid, jint gid, jintArray gids,
jint runtime_flags, jobjectArray rlimits,
jint mount_external, jstring se_info, jstring nice_name,
@@ -1855,77 +1859,77 @@
ALOGE("Unable to fetch Zygote socket file descriptor");
}
- env_var_name = android_socket_prefix + (is_primary ? "blastula_pool" : "blastula_pool_secondary");
+ env_var_name = android_socket_prefix + (is_primary ? "usap_pool_primary" : "usap_pool_secondary");
env_var_val = getenv(env_var_name.c_str());
if (env_var_val != nullptr) {
- gBlastulaPoolSocketFD = atoi(env_var_val);
- ALOGV("Zygote:blastulaPoolSocketFD = %d", gBlastulaPoolSocketFD);
+ gUsapPoolSocketFD = atoi(env_var_val);
+ ALOGV("Zygote:usapPoolSocketFD = %d", gUsapPoolSocketFD);
} else {
- ALOGE("Unable to fetch Blastula pool socket file descriptor");
+ ALOGE("Unable to fetch USAP pool socket file descriptor");
}
}
/**
* @param env Managed runtime environment
- * @return A managed array of raw file descriptors for the read ends of the blastula reporting
+ * @return A managed array of raw file descriptors for the read ends of the USAP reporting
* pipes.
*/
-static jintArray com_android_internal_os_Zygote_nativeGetBlastulaPipeFDs(JNIEnv* env, jclass) {
- std::vector<int> blastula_fds = MakeBlastulaPipeReadFDVector();
+static jintArray com_android_internal_os_Zygote_nativeGetUsapPipeFDs(JNIEnv* env, jclass) {
+ std::vector<int> usap_fds = MakeUsapPipeReadFDVector();
- jintArray managed_blastula_fds = env->NewIntArray(blastula_fds.size());
- env->SetIntArrayRegion(managed_blastula_fds, 0, blastula_fds.size(), blastula_fds.data());
+ jintArray managed_usap_fds = env->NewIntArray(usap_fds.size());
+ env->SetIntArrayRegion(managed_usap_fds, 0, usap_fds.size(), usap_fds.data());
- return managed_blastula_fds;
+ return managed_usap_fds;
}
/**
- * A JNI wrapper around RemoveBlastulaTableEntry.
+ * A JNI wrapper around RemoveUsapTableEntry.
*
* @param env Managed runtime environment
- * @param blastula_pid Process ID of the blastula entry to invalidate
+ * @param usap_pid Process ID of the USAP entry to invalidate
* @return True if an entry was invalidated; false otherwise.
*/
-static jboolean com_android_internal_os_Zygote_nativeRemoveBlastulaTableEntry(JNIEnv* env, jclass,
- jint blastula_pid) {
- return RemoveBlastulaTableEntry(blastula_pid);
+static jboolean com_android_internal_os_Zygote_nativeRemoveUsapTableEntry(JNIEnv* env, jclass,
+ jint usap_pid) {
+ return RemoveUsapTableEntry(usap_pid);
}
/**
- * Creates the blastula pool event FD if it doesn't exist and returns it. This is used by the
- * ZygoteServer poll loop to know when to re-fill the blastula pool.
+ * Creates the USAP pool event FD if it doesn't exist and returns it. This is used by the
+ * ZygoteServer poll loop to know when to re-fill the USAP pool.
*
* @param env Managed runtime environment
* @return A raw event file descriptor used to communicate (from the signal handler) when the
- * Zygote receives a SIGCHLD for a blastula
+ * Zygote receives a SIGCHLD for a USAP
*/
-static jint com_android_internal_os_Zygote_nativeGetBlastulaPoolEventFD(JNIEnv* env, jclass) {
- if (gBlastulaPoolEventFD == -1) {
- if ((gBlastulaPoolEventFD = eventfd(0, 0)) == -1) {
+static jint com_android_internal_os_Zygote_nativeGetUsapPoolEventFD(JNIEnv* env, jclass) {
+ if (gUsapPoolEventFD == -1) {
+ if ((gUsapPoolEventFD = eventfd(0, 0)) == -1) {
ZygoteFailure(env, "zygote", nullptr, StringPrintf("Unable to create eventfd: %s", strerror(errno)));
}
}
- return gBlastulaPoolEventFD;
+ return gUsapPoolEventFD;
}
/**
* @param env Managed runtime environment
- * @return The number of blastulas currently in the blastula pool
+ * @return The number of USAPs currently in the USAP pool
*/
-static jint com_android_internal_os_Zygote_nativeGetBlastulaPoolCount(JNIEnv* env, jclass) {
- return gBlastulaPoolCount;
+static jint com_android_internal_os_Zygote_nativeGetUsapPoolCount(JNIEnv* env, jclass) {
+ return gUsapPoolCount;
}
/**
- * Kills all processes currently in the blastula pool.
+ * Kills all processes currently in the USAP pool and closes their read pipe
+ * FDs.
*
* @param env Managed runtime environment
- * @return The number of blastulas currently in the blastula pool
*/
-static void com_android_internal_os_Zygote_nativeEmptyBlastulaPool(JNIEnv* env, jclass) {
- for (auto& entry : gBlastulaTable) {
+static void com_android_internal_os_Zygote_nativeEmptyUsapPool(JNIEnv* env, jclass) {
+ for (auto& entry : gUsapTable) {
auto entry_storage = entry.GetValues();
if (entry_storage.has_value()) {
@@ -1934,7 +1938,7 @@
// Avoid a second atomic load by invalidating instead of clearing.
entry.Invalidate();
- --gBlastulaPoolCount;
+ --gUsapPoolCount;
}
}
}
@@ -1955,23 +1959,23 @@
(void *) com_android_internal_os_Zygote_nativePreApplicationInit },
{ "nativeInstallSeccompUidGidFilter", "(II)V",
(void *) com_android_internal_os_Zygote_nativeInstallSeccompUidGidFilter },
- { "nativeForkBlastula", "(II[I)I",
- (void *) com_android_internal_os_Zygote_nativeForkBlastula },
- { "nativeSpecializeBlastula",
+ { "nativeForkUsap", "(II[I)I",
+ (void *) com_android_internal_os_Zygote_nativeForkUsap },
+ { "nativeSpecializeAppProcess",
"(II[II[[IILjava/lang/String;Ljava/lang/String;ZLjava/lang/String;Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)V",
- (void *) com_android_internal_os_Zygote_nativeSpecializeBlastula },
+ (void *) com_android_internal_os_Zygote_nativeSpecializeAppProcess },
{ "nativeGetSocketFDs", "(Z)V",
(void *) com_android_internal_os_Zygote_nativeGetSocketFDs },
- { "nativeGetBlastulaPipeFDs", "()[I",
- (void *) com_android_internal_os_Zygote_nativeGetBlastulaPipeFDs },
- { "nativeRemoveBlastulaTableEntry", "(I)Z",
- (void *) com_android_internal_os_Zygote_nativeRemoveBlastulaTableEntry },
- { "nativeGetBlastulaPoolEventFD", "()I",
- (void *) com_android_internal_os_Zygote_nativeGetBlastulaPoolEventFD },
- { "nativeGetBlastulaPoolCount", "()I",
- (void *) com_android_internal_os_Zygote_nativeGetBlastulaPoolCount },
- { "nativeEmptyBlastulaPool", "()V",
- (void *) com_android_internal_os_Zygote_nativeEmptyBlastulaPool }
+ { "nativeGetUsapPipeFDs", "()[I",
+ (void *) com_android_internal_os_Zygote_nativeGetUsapPipeFDs },
+ { "nativeRemoveUsapTableEntry", "(I)Z",
+ (void *) com_android_internal_os_Zygote_nativeRemoveUsapTableEntry },
+ { "nativeGetUsapPoolEventFD", "()I",
+ (void *) com_android_internal_os_Zygote_nativeGetUsapPoolEventFD },
+ { "nativeGetUsapPoolCount", "()I",
+ (void *) com_android_internal_os_Zygote_nativeGetUsapPoolCount },
+ { "nativeEmptyUsapPool", "()V",
+ (void *) com_android_internal_os_Zygote_nativeEmptyUsapPool }
};
int register_com_android_internal_os_Zygote(JNIEnv* env) {
diff --git a/core/jni/fd_utils.cpp b/core/jni/fd_utils.cpp
index 4b37f13..d8d4656 100644
--- a/core/jni/fd_utils.cpp
+++ b/core/jni/fd_utils.cpp
@@ -38,8 +38,8 @@
"/dev/null",
"/dev/socket/zygote",
"/dev/socket/zygote_secondary",
- "/dev/socket/blastula_pool",
- "/dev/socket/blastula_pool_secondary",
+ "/dev/socket/usap_pool_primary",
+ "/dev/socket/usap_pool_secondary",
"/dev/socket/webview_zygote",
"/dev/socket/heapprofd",
"/sys/kernel/debug/tracing/trace_marker",
@@ -215,7 +215,7 @@
// S_ISDIR : Not supported. (We could if we wanted to, but it's unused).
// S_ISLINK : Not supported.
// S_ISBLK : Not supported.
- // S_ISFIFO : Not supported. Note that the Zygote and blastulas use pipes to
+ // S_ISFIFO : Not supported. Note that the Zygote and USAPs use pipes to
// communicate with the child processes across forks but those should have been
// added to the redirection exemption list.
if (!S_ISCHR(f_stat.st_mode) && !S_ISREG(f_stat.st_mode)) {
diff --git a/core/jni/runtime_native_boot-flags-test.sh b/core/jni/runtime_native_boot-flags-test.sh
index a5d7a5a..cdfeffc 100755
--- a/core/jni/runtime_native_boot-flags-test.sh
+++ b/core/jni/runtime_native_boot-flags-test.sh
@@ -139,35 +139,33 @@
adb logcat -d -s "$zygote" | grep -q -e "option\[[0-9]\+\]=$runtime_option"
}
-# check_zygote_gc_runtime_option CONTEXT VALUE
-# --------------------------------------------
-# Check that all zygote processes are passed device configuration flag VALUE as
-# GC runtime option. Use CONTEXT in logging.
-function check_zygote_gc_runtime_option {
+# check_zygote_runtime_option CONTEXT RUNTIME_OPTION
+# --------------------------------------------------
+# Check that all zygote processes are passed RUNTIME_OPTION as runtime option. Use
+# CONTEXT in logging.
+function check_zygote_runtime_option {
local context=$1
- local value=$2
+ local runtime_option=$2
say \
- "[$context] Check that all zygote processes are passed the flag value as a GC runtime option..."
- local runtime_option="-Xgc:$value"
+ "[$context] Check that all zygote processes are passed \`$runtime_option\` as runtime option..."
for zygote in $zygotes; do
- find_zygote_runtime_option "$zygote" "$runtime_option"\
+ find_zygote_runtime_option "$zygote" "$runtime_option" \
|| fail "Found no \`$runtime_option\` among runtime options passed to \`$zygote\`"
done
}
-# check_no_zygote_gc_runtime_option CONTEXT VALUE
-# -----------------------------------------------
-# Check that no zygote process is passed device configuration flag VALUE as GC
-# runtime option. Use CONTEXT in logging.
-function check_no_zygote_gc_runtime_option {
+# check_no_zygote_runtime_option CONTEXT RUNTIME_OPTION
+# -----------------------------------------------------
+# Check that no zygote process is passed RUNTIME_OPTION as runtime option. Use
+# CONTEXT in logging.
+function check_no_zygote_runtime_option {
local context=$1
- local value=$2
+ local runtime_option=$2
- say "[$context] Check no zygote process is passed the flag value as a GC runtime option..."
- local runtime_option="-Xgc:$value"
+ say "[$context] Check that no zygote process is passed \`$runtime_option\` as runtime option..."
for zygote in $zygotes; do
- find_zygote_runtime_option "$zygote" "$runtime_option"\
+ find_zygote_runtime_option "$zygote" "$runtime_option" \
&& fail "Found \`$runtime_option\` among runtime options passed to \`$zygote\`"
done
}
@@ -270,17 +268,17 @@
# ==========================================
function check_nogenerational_cc {
- check_zygote_gc_runtime_option "$1" nogenerational_cc
+ check_zygote_runtime_option "$1" "-Xgc:nogenerational_cc"
}
function check_no_nogenerational_cc {
- check_no_zygote_gc_runtime_option "$1" nogenerational_cc
+ check_no_zygote_runtime_option "$1" "-Xgc:nogenerational_cc"
}
function check_generational_cc {
- check_zygote_gc_runtime_option "$1" generational_cc
+ check_zygote_runtime_option "$1" "-Xgc:generational_cc"
}
function check_no_generational_cc {
- check_no_zygote_gc_runtime_option "$1" generational_cc
+ check_no_zygote_runtime_option "$1" "-Xgc:generational_cc"
}
test_android_runtime_flag \
@@ -299,11 +297,14 @@
check_no_android_runtime_message "$1" "$default_boot_image_message"
}
-apex_boot_image_message="Using Apex boot image: '-Ximage:/system/framework/apex.art'"
+apex_boot_image_option="-Ximage:/system/framework/apex.art"
+apex_boot_image_message="Using Apex boot image: '$apex_boot_image_option'"
function check_apex_boot_image {
+ check_zygote_runtime_option "$1" "$apex_boot_image_option"
check_android_runtime_message "$1" "$apex_boot_image_message"
}
function check_no_apex_boot_image {
+ check_no_zygote_runtime_option "$1" "$apex_boot_image_option"
check_no_android_runtime_message "$1" "$apex_boot_image_message"
}
diff --git a/core/res/res/drawable-nodpi/stat_sys_adb.xml b/core/res/res/drawable-nodpi/stat_sys_adb.xml
index 6839e39..08e9fad 100644
--- a/core/res/res/drawable-nodpi/stat_sys_adb.xml
+++ b/core/res/res/drawable-nodpi/stat_sys_adb.xml
@@ -1,11 +1,11 @@
<!--
Copyright (C) 2019 The Android Open Source Project
- Licensed under the Apache License, Version 2 (the "License");
+ 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
+ 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,
@@ -16,19 +16,15 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
- android:viewportWidth="24"
- android:viewportHeight="24">
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0">
<path
- android:pathData="M12,12m-7,0a7,7,0,1,1,14,0a7,7,0,1,1,-14,0"
- android:strokeColor="#FF0000"
- android:strokeWidth="4"/>
+ android:fillColor="#FF000000"
+ android:pathData="M16.28,16.19A6,6 0,1 0,6 12c0,0.1 0,0.19 0,0.29L9.2,9.11Z"/>
<path
- android:pathData="M19,19 L12,12"
- android:strokeLineCap="round"
- android:strokeColor="#FF0000"
- android:strokeWidth="4"
- android:strokeAlpha=".5"/>
+ android:fillColor="#FF000000"
+ android:pathData="M16,19.48a8.57,8.57 0,1 1,2 -1.52l1.77,1.77a11.07,11.07 0,1 0,-2 1.57Z"/>
<path
- android:pathData="M12,12m-2,0a2,2,0,1,1,4,0a2,2,0,1,1,-4,0"
- android:fillColor="#FF0000"/>
+ android:fillColor="#FF000000"
+ android:pathData="M12,18a5.77,5.77 0,0 0,2 -0.34l0.19,-0.07 -0.87,-0.87L9.2,12.64 6.82,15A6,6 0,0 0,12 18Z"/>
</vector>
diff --git a/location/java/android/location/Location.java b/location/java/android/location/Location.java
index 17e2509..ed74333 100644
--- a/location/java/android/location/Location.java
+++ b/location/java/android/location/Location.java
@@ -113,6 +113,10 @@
* Bit mask for mFieldsMask indicating the presence of mBearingAccuracy.
*/
private static final int HAS_BEARING_ACCURACY_MASK = 128;
+ /**
+ * Bit mask for mFieldsMask indicating the presence of mElapsedRealtimeUncertaintyNanos.
+ */
+ private static final int HAS_ELAPSED_REALTIME_UNCERTAINTY_MASK = 256;
// Cached data to make bearing/distance computations more efficient for the case
// where distanceTo and bearingTo are called in sequence. Assume this typically happens
@@ -130,6 +134,9 @@
private long mTime = 0;
@UnsupportedAppUsage
private long mElapsedRealtimeNanos = 0;
+ // Estimate of the relative precision of the alignment of this SystemClock
+ // timestamp, with the reported measurements in nanoseconds (68% confidence).
+ private long mElapsedRealtimeUncertaintyNanos = 0;
private double mLatitude = 0.0;
private double mLongitude = 0.0;
private double mAltitude = 0.0f;
@@ -171,6 +178,7 @@
mProvider = l.mProvider;
mTime = l.mTime;
mElapsedRealtimeNanos = l.mElapsedRealtimeNanos;
+ mElapsedRealtimeUncertaintyNanos = l.mElapsedRealtimeUncertaintyNanos;
mFieldsMask = l.mFieldsMask;
mLatitude = l.mLatitude;
mLongitude = l.mLongitude;
@@ -191,6 +199,7 @@
mProvider = null;
mTime = 0;
mElapsedRealtimeNanos = 0;
+ mElapsedRealtimeUncertaintyNanos = 0;
mFieldsMask = 0;
mLatitude = 0;
mLongitude = 0;
@@ -586,6 +595,37 @@
}
/**
+ * Get estimate of the relative precision of the alignment of the
+ * ElapsedRealtimeNanos timestamp, with the reported measurements in
+ * nanoseconds (68% confidence).
+ *
+ * @return uncertainty of elapsed real-time of fix, in nanoseconds.
+ */
+ public long getElapsedRealtimeUncertaintyNanos() {
+ return mElapsedRealtimeUncertaintyNanos;
+ }
+
+ /**
+ * Set estimate of the relative precision of the alignment of the
+ * ElapsedRealtimeNanos timestamp, with the reported measurements in
+ * nanoseconds (68% confidence).
+ *
+ * @param time uncertainty of the elapsed real-time of fix, in nanoseconds.
+ */
+ public void setElapsedRealtimeUncertaintyNanos(long time) {
+ mElapsedRealtimeUncertaintyNanos = time;
+ mFieldsMask |= HAS_ELAPSED_REALTIME_UNCERTAINTY_MASK;
+ }
+
+ /**
+ * True if this location has a elapsed realtime accuracy.
+ */
+ public boolean hasElapsedRealtimeUncertaintyNanos() {
+ return (mFieldsMask & HAS_ELAPSED_REALTIME_UNCERTAINTY_MASK) != 0;
+ }
+
+
+ /**
* Get the latitude, in degrees.
*
* <p>All locations generated by the {@link LocationManager}
@@ -1062,6 +1102,10 @@
s.append(" et=");
TimeUtils.formatDuration(mElapsedRealtimeNanos / 1000000L, s);
}
+ if (hasElapsedRealtimeUncertaintyNanos()) {
+ s.append(" etAcc=");
+ TimeUtils.formatDuration(mElapsedRealtimeUncertaintyNanos / 1000000L, s);
+ }
if (hasAltitude()) s.append(" alt=").append(mAltitude);
if (hasSpeed()) s.append(" vel=").append(mSpeed);
if (hasBearing()) s.append(" bear=").append(mBearing);
@@ -1092,6 +1136,7 @@
Location l = new Location(provider);
l.mTime = in.readLong();
l.mElapsedRealtimeNanos = in.readLong();
+ l.mElapsedRealtimeUncertaintyNanos = in.readLong();
l.mFieldsMask = in.readByte();
l.mLatitude = in.readDouble();
l.mLongitude = in.readDouble();
@@ -1122,6 +1167,7 @@
parcel.writeString(mProvider);
parcel.writeLong(mTime);
parcel.writeLong(mElapsedRealtimeNanos);
+ parcel.writeLong(mElapsedRealtimeUncertaintyNanos);
parcel.writeByte(mFieldsMask);
parcel.writeDouble(mLatitude);
parcel.writeDouble(mLongitude);
diff --git a/packages/SystemUI/Android.bp b/packages/SystemUI/Android.bp
index c2495b5..9425941 100644
--- a/packages/SystemUI/Android.bp
+++ b/packages/SystemUI/Android.bp
@@ -58,6 +58,7 @@
"androidx.arch.core_core-runtime",
"androidx.lifecycle_lifecycle-extensions",
"androidx.dynamicanimation_dynamicanimation",
+ "iconloader_base",
"SystemUI-tags",
"SystemUI-proto",
"dagger2-2.19",
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
index b0670fd..17546c5 100644
--- a/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
+++ b/packages/SystemUI/src/com/android/keyguard/KeyguardStatusView.java
@@ -27,7 +27,6 @@
import android.os.UserHandle;
import android.text.TextUtils;
import android.text.format.DateFormat;
-import android.util.ArraySet;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Slog;
@@ -42,8 +41,6 @@
import com.android.systemui.Dependency;
import com.android.systemui.statusbar.policy.ConfigurationController;
-import com.google.android.collect.Sets;
-
import java.util.Locale;
import java.util.TimeZone;
@@ -63,7 +60,6 @@
private Runnable mPendingMarqueeStart;
private Handler mHandler;
- private ArraySet<View> mVisibleInDoze;
private boolean mPulsing;
private float mDarkAmount = 0;
private int mTextColor;
@@ -175,7 +171,6 @@
}
mOwnerInfo = findViewById(R.id.owner_info);
mKeyguardSlice = findViewById(R.id.keyguard_status_area);
- mVisibleInDoze = Sets.newArraySet(mClockView, mKeyguardSlice);
mTextColor = mClockView.getCurrentTextColor();
mKeyguardSlice.setContentChangeListener(this::onSliceContentChanged);
@@ -348,7 +343,6 @@
}
final int blendedTextColor = ColorUtils.blendARGB(mTextColor, Color.WHITE, mDarkAmount);
- updateDozeVisibleViews();
mKeyguardSlice.setDarkAmount(mDarkAmount);
mClockView.setTextColor(blendedTextColor);
}
@@ -372,13 +366,6 @@
return;
}
mPulsing = pulsing;
- updateDozeVisibleViews();
- }
-
- private void updateDozeVisibleViews() {
- for (View child : mVisibleInDoze) {
- child.setAlpha(mDarkAmount == 1 && mPulsing ? 0.8f : 1);
- }
}
private boolean shouldShowLogout() {
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index 4d0c8c3..2495d22 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -1172,9 +1172,11 @@
}
protected void notifyBarPanelExpansionChanged() {
- mBar.panelExpansionChanged(mExpandedFraction, mExpandedFraction > 0f
- || mPeekAnimator != null || mInstantExpanding || isPanelVisibleBecauseOfHeadsUp()
- || mTracking || mHeightAnimator != null);
+ if (mBar != null) {
+ mBar.panelExpansionChanged(mExpandedFraction, mExpandedFraction > 0f
+ || mPeekAnimator != null || mInstantExpanding
+ || isPanelVisibleBecauseOfHeadsUp() || mTracking || mHeightAnimator != null);
+ }
if (mExpansionListener != null) {
mExpansionListener.accept(mExpandedFraction, mTracking);
}
diff --git a/proto/src/wifi.proto b/proto/src/wifi.proto
index 2214ac5..f106ced 100644
--- a/proto/src/wifi.proto
+++ b/proto/src/wifi.proto
@@ -660,6 +660,26 @@
HLF_UNWANTED = 4;
}
+ // Level 2 failure reason.
+ enum Level2FailureReason {
+
+ // Unknown default
+ FAILURE_REASON_UNKNOWN = 0;
+
+ // The reason code if there is no error during authentication. It could
+ // also imply that there no authentication in progress.
+ AUTH_FAILURE_NONE = 1;
+
+ // The reason code if there was a timeout authenticating.
+ AUTH_FAILURE_TIMEOUT = 2;
+
+ // The reason code if there was a wrong password while authenticating.
+ AUTH_FAILURE_WRONG_PSWD = 3;
+
+ // The reason code if there was EAP failure while authenticating.
+ AUTH_FAILURE_EAP_FAILURE = 4;
+ }
+
// Entity that recommended connecting to this network.
enum ConnectionNominator {
// Unknown nominator
@@ -728,6 +748,10 @@
// The currently running network selector when this connection event occurred.
optional int32 network_selector_experiment_id = 12;
+
+ // Breakdown of level_2_failure_code with more detailed reason.
+ optional Level2FailureReason level_2_failure_reason = 13
+ [default = FAILURE_REASON_UNKNOWN];
}
// Number of occurrences of a specific RSSI poll rssi value
diff --git a/services/core/java/com/android/server/am/ActiveServices.java b/services/core/java/com/android/server/am/ActiveServices.java
index 346492f..85ec2dd 100644
--- a/services/core/java/com/android/server/am/ActiveServices.java
+++ b/services/core/java/com/android/server/am/ActiveServices.java
@@ -2211,7 +2211,7 @@
return new ServiceLookupResult(null, r.permission);
} else if (r.permission != null && callingPackage != null) {
final int opCode = AppOpsManager.permissionToOpCode(r.permission);
- if (opCode != AppOpsManager.OP_NONE && mAm.mAppOpsService.noteOperation(
+ if (opCode != AppOpsManager.OP_NONE && mAm.mAppOpsService.checkOperation(
opCode, callingUid, callingPackage) != AppOpsManager.MODE_ALLOWED) {
Slog.w(TAG, "Appop Denial: Accessing service " + r.shortInstanceName
+ " from pid=" + callingPid
diff --git a/services/core/java/com/android/server/am/ProcessList.java b/services/core/java/com/android/server/am/ProcessList.java
index 30798a8..399b818 100644
--- a/services/core/java/com/android/server/am/ProcessList.java
+++ b/services/core/java/com/android/server/am/ProcessList.java
@@ -1783,7 +1783,7 @@
app.processName, uid, uid, gids, runtimeFlags, mountExternal,
app.info.targetSdkVersion, seInfo, requiredAbi, instructionSet,
app.info.dataDir, null, app.info.packageName,
- packageNames, sandboxId, /*useBlastulaPool=*/ false,
+ packageNames, sandboxId, /*useUnspecializedAppProcessPool=*/ false,
new String[] {PROC_START_SEQ_IDENT + app.startSeq});
} else {
startResult = Process.start(entryPoint,
diff --git a/services/core/java/com/android/server/location/GnssLocationProvider.java b/services/core/java/com/android/server/location/GnssLocationProvider.java
index ae91503..8e8477a 100644
--- a/services/core/java/com/android/server/location/GnssLocationProvider.java
+++ b/services/core/java/com/android/server/location/GnssLocationProvider.java
@@ -142,6 +142,7 @@
// these need to match ElapsedRealtimeFlags enum in types.hal
private static final int ELAPSED_REALTIME_HAS_TIMESTAMP_NS = 1;
+ private static final int ELAPSED_REALTIME_HAS_TIME_UNCERTAINTY_NS = 2;
// IMPORTANT - the GPS_DELETE_* symbols here must match GnssAidingData enum in IGnss.hal
private static final int GPS_DELETE_EPHEMERIS = 0x0001;
@@ -769,15 +770,18 @@
float bearingAccuracyDegrees = location.getBearingAccuracyDegrees();
long timestamp = location.getTime();
- int elapsedRealtimeFlags = ELAPSED_REALTIME_HAS_TIMESTAMP_NS;
+ int elapsedRealtimeFlags = ELAPSED_REALTIME_HAS_TIMESTAMP_NS
+ | (location.hasElapsedRealtimeUncertaintyNanos()
+ ? ELAPSED_REALTIME_HAS_TIME_UNCERTAINTY_NS : 0);
long elapsedRealtimeNanos = location.getElapsedRealtimeNanos();
+ long elapsedRealtimeUncertaintyNanos = location.getElapsedRealtimeUncertaintyNanos();
native_inject_best_location(
gnssLocationFlags, latitudeDegrees, longitudeDegrees,
altitudeMeters, speedMetersPerSec, bearingDegrees,
horizontalAccuracyMeters, verticalAccuracyMeters,
speedAccuracyMetersPerSecond, bearingAccuracyDegrees, timestamp,
- elapsedRealtimeFlags, elapsedRealtimeNanos);
+ elapsedRealtimeFlags, elapsedRealtimeNanos, elapsedRealtimeUncertaintyNanos);
}
/** Returns true if the location request is too frequent. */
@@ -2171,7 +2175,8 @@
double altitudeMeters, float speedMetersPerSec, float bearingDegrees,
float horizontalAccuracyMeters, float verticalAccuracyMeters,
float speedAccuracyMetersPerSecond, float bearingAccuracyDegrees,
- long timestamp, int elapsedRealtimeFlags, long elapsedRealtimeNanos);
+ long timestamp, int elapsedRealtimeFlags, long elapsedRealtimeNanos,
+ long elapsedRealtimeUncertaintyNanos);
private native void native_inject_location(double latitude, double longitude, float accuracy);
diff --git a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
index 447234e..1d6e581 100644
--- a/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
+++ b/services/core/java/com/android/server/pm/permission/DefaultPermissionGrantPolicy.java
@@ -1473,6 +1473,13 @@
if (packageExceptions == null) {
// The package must be on the system image
PackageInfo packageInfo = getSystemPackageInfo(packageName);
+
+ if (packageInfo == null) {
+ Log.w(TAG, "No such package:" + packageName);
+ XmlUtils.skipCurrentTag(parser);
+ continue;
+ }
+
if (!isSystemPackage(packageInfo)) {
Log.w(TAG, "Unknown system package:" + packageName);
XmlUtils.skipCurrentTag(parser);
diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java
index 46c9f73..5862d43 100644
--- a/services/core/java/com/android/server/wm/DisplayPolicy.java
+++ b/services/core/java/com/android/server/wm/DisplayPolicy.java
@@ -1945,10 +1945,6 @@
} else {
vf.set(cf);
}
-
- // EXPERIMENT TODO(b/113952590): Remove once experiment in bug is completed
- mExperiments.offsetWindowFramesForNavBar(mNavigationBarPosition, win);
- // EXPERIMENT END
}
} else if (layoutInScreen || (sysUiFl
& (View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
diff --git a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
index d39f20c..e8882ec 100644
--- a/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
+++ b/services/core/jni/com_android_server_location_GnssLocationProvider.cpp
@@ -491,6 +491,10 @@
SET(ElapsedRealtimeNanos, location.elapsedRealtime.timestampNs);
}
+ if (flags & ElapsedRealtimeFlags::HAS_TIME_UNCERTAINTY_NS) {
+ SET(ElapsedUncertaintyRealtimeNanos, location.elapsedRealtime.timeUncertaintyNs);
+ }
+
return object.get();
}
@@ -521,7 +525,8 @@
jdouble altitudeMeters, jfloat speedMetersPerSec, jfloat bearingDegrees,
jfloat horizontalAccuracyMeters, jfloat verticalAccuracyMeters,
jfloat speedAccuracyMetersPerSecond, jfloat bearingAccuracyDegrees,
- jlong timestamp, jint elapsedRealtimeFlags, jlong elapsedRealtimeNanos) {
+ jlong timestamp, jint elapsedRealtimeFlags, jlong elapsedRealtimeNanos,
+ jlong elapsedRealtimeUncertaintyNanos) {
GnssLocation_V2_0 location;
location.v1_0 = createGnssLocation_V1_0(
gnssLocationFlags, latitudeDegrees, longitudeDegrees, altitudeMeters,
@@ -531,6 +536,7 @@
location.elapsedRealtime.flags = static_cast<uint16_t>(elapsedRealtimeFlags);
location.elapsedRealtime.timestampNs = static_cast<uint64_t>(elapsedRealtimeNanos);
+ location.elapsedRealtime.timeUncertaintyNs = static_cast<uint64_t>(elapsedRealtimeUncertaintyNanos);
return location;
}
@@ -1887,7 +1893,8 @@
jfloat bearingAccuracyDegrees,
jlong timestamp,
jint elapsedRealtimeFlags,
- jlong elapsedRealtimeNanos) {
+ jlong elapsedRealtimeNanos,
+ jlong elapsedRealtimeUncertaintyNanos) {
if (gnssHal_V2_0 != nullptr) {
GnssLocation_V2_0 location = createGnssLocation_V2_0(
gnssLocationFlags,
@@ -1902,7 +1909,8 @@
bearingAccuracyDegrees,
timestamp,
elapsedRealtimeFlags,
- elapsedRealtimeNanos);
+ elapsedRealtimeNanos,
+ elapsedRealtimeUncertaintyNanos);
auto result = gnssHal_V2_0->injectBestLocation_2_0(location);
if (!result.isOk() || !result) {
@@ -2813,7 +2821,7 @@
android_location_GnssLocationProvider_read_nmea)},
{"native_inject_time", "(JJI)V", reinterpret_cast<void *>(
android_location_GnssLocationProvider_inject_time)},
- {"native_inject_best_location", "(IDDDFFFFFFJIJ)V", reinterpret_cast<void *>(
+ {"native_inject_best_location", "(IDDDFFFFFFJIJJ)V", reinterpret_cast<void *>(
android_location_GnssLocationProvider_inject_best_location)},
{"native_inject_location", "(DDF)V", reinterpret_cast<void *>(
android_location_GnssLocationProvider_inject_location)},
diff --git a/services/usage/java/com/android/server/usage/UsageStatsDatabase.java b/services/usage/java/com/android/server/usage/UsageStatsDatabase.java
index 4756fb4..485a79d 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsDatabase.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsDatabase.java
@@ -27,6 +27,7 @@
import android.util.TimeUtils;
import com.android.internal.annotations.VisibleForTesting;
+import com.android.internal.util.IndentingPrintWriter;
import libcore.io.IoUtils;
@@ -1246,4 +1247,36 @@
}
directory.delete();
}
+
+ /**
+ * print total number and list of stats files for each interval type.
+ * @param pw
+ */
+ public void dump(IndentingPrintWriter pw, boolean compact) {
+ synchronized (mLock) {
+ pw.println("UsageStatsDatabase:");
+ pw.increaseIndent();
+ for (int i = 0; i < mSortedStatFiles.length; i++) {
+ final TimeSparseArray<AtomicFile> files = mSortedStatFiles[i];
+ final int size = files.size();
+ pw.print(UserUsageStatsService.intervalToString(i));
+ pw.print(" stats files: ");
+ pw.print(size);
+ pw.println(", sorted list of files:");
+ pw.increaseIndent();
+ for (int f = 0; f < size; f++) {
+ final long fileName = files.keyAt(f);
+ if (compact) {
+ pw.print(UserUsageStatsService.formatDateTime(fileName, false));
+ } else {
+ pw.printPair(Long.toString(fileName),
+ UserUsageStatsService.formatDateTime(fileName, true));
+ }
+ pw.println();
+ }
+ pw.decreaseIndent();
+ }
+ pw.decreaseIndent();
+ }
+ }
}
diff --git a/services/usage/java/com/android/server/usage/UserUsageStatsService.java b/services/usage/java/com/android/server/usage/UserUsageStatsService.java
index ebd8e36..b9a5676 100644
--- a/services/usage/java/com/android/server/usage/UserUsageStatsService.java
+++ b/services/usage/java/com/android/server/usage/UserUsageStatsService.java
@@ -658,9 +658,10 @@
pw.println(" stats");
printIntervalStats(pw, mCurrentStats[interval], !compact, true, pkg);
}
+ mDatabase.dump(pw, compact);
}
- private String formatDateTime(long dateTime, boolean pretty) {
+ static String formatDateTime(long dateTime, boolean pretty) {
if (pretty) {
return "\"" + sDateFormat.format(dateTime)+ "\"";
}
@@ -888,7 +889,7 @@
pw.decreaseIndent();
}
- private static String intervalToString(int interval) {
+ public static String intervalToString(int interval) {
switch (interval) {
case INTERVAL_DAILY:
return "daily";
diff --git a/telecomm/java/android/telecom/PhoneAccountSuggestion.java b/telecomm/java/android/telecom/PhoneAccountSuggestion.java
index 05b2395..3799cf3 100644
--- a/telecomm/java/android/telecom/PhoneAccountSuggestion.java
+++ b/telecomm/java/android/telecom/PhoneAccountSuggestion.java
@@ -17,6 +17,7 @@
package android.telecom;
import android.annotation.IntDef;
+import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.os.Parcel;
@@ -72,7 +73,7 @@
*/
@SystemApi
@TestApi
- public PhoneAccountSuggestion(PhoneAccountHandle handle, @SuggestionReason int reason,
+ public PhoneAccountSuggestion(@NonNull PhoneAccountHandle handle, @SuggestionReason int reason,
boolean shouldAutoSelect) {
this.mHandle = handle;
this.mReason = reason;
@@ -101,7 +102,7 @@
/**
* @return The {@link PhoneAccountHandle} for this suggestion.
*/
- public PhoneAccountHandle getPhoneAccountHandle() {
+ @NonNull public PhoneAccountHandle getPhoneAccountHandle() {
return mHandle;
}
diff --git a/telephony/java/android/telephony/PhoneNumberRange.java b/telephony/java/android/telephony/PhoneNumberRange.java
index 2c66503..c35a485 100644
--- a/telephony/java/android/telephony/PhoneNumberRange.java
+++ b/telephony/java/android/telephony/PhoneNumberRange.java
@@ -149,7 +149,7 @@
* @param number A phone number, with or without separators or a country code.
* @return {@code true} if the number matches, {@code false} otherwise.
*/
- public boolean matches(String number) {
+ public boolean matches(@NonNull String number) {
// Check the prefix, make sure it matches either with or without the country code.
String normalizedNumber = number.replaceAll("[^0-9]", "");
String prefixWithCountryCode = mCountryCode + mPrefix;
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index e0b7fc4..d7a0e50 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -1270,7 +1270,7 @@
if (!userVisibleOnly || activeList == null) {
return activeList;
} else {
- return activeList.stream().filter(subInfo -> !shouldHideSubscription(subInfo))
+ return activeList.stream().filter(subInfo -> isSubscriptionVisible(subInfo))
.collect(Collectors.toList());
}
}
@@ -2867,32 +2867,27 @@
}
/**
- * Whether system UI should hide a subscription. If it's a bundled opportunistic
- * subscription, it shouldn't show up in anywhere in Settings app, dialer app,
- * or status bar. Exception is if caller is carrier app, in which case they will
+ * Whether a subscription is visible to API caller. If it's a bundled opportunistic
+ * subscription, it should be hidden anywhere in Settings, dialer, status bar etc.
+ * Exception is if caller owns carrier privilege, in which case they will
* want to see their own hidden subscriptions.
*
* @param info the subscriptionInfo to check against.
- * @return true if this subscription should be hidden.
+ * @return true if this subscription should be visible to the API caller.
*
- * @hide
*/
- public boolean shouldHideSubscription(SubscriptionInfo info) {
+ private boolean isSubscriptionVisible(SubscriptionInfo info) {
if (info == null) return false;
- // If hasCarrierPrivileges or canManageSubscription returns true, it means caller
- // has carrier privilege.
- boolean hasCarrierPrivilegePermission = (info.isEmbedded() && canManageSubscription(info))
- || TelephonyManager.from(mContext).hasCarrierPrivileges(info.getSubscriptionId());
+ // If subscription is NOT grouped opportunistic subscription, it's visible.
+ if (TextUtils.isEmpty(info.getGroupUuid()) || !info.isOpportunistic()) return true;
- return isInvisibleSubscription(info) && !hasCarrierPrivilegePermission;
- }
-
- /**
- * @hide
- */
- public static boolean isInvisibleSubscription(SubscriptionInfo info) {
- return info != null && !TextUtils.isEmpty(info.getGroupUuid()) && info.isOpportunistic();
+ // If the caller is the carrier app and owns the subscription, it should be visible
+ // to the caller.
+ boolean hasCarrierPrivilegePermission = TelephonyManager.from(mContext)
+ .hasCarrierPrivileges(info.getSubscriptionId())
+ || (info.isEmbedded() && canManageSubscription(info));
+ return hasCarrierPrivilegePermission;
}
/**
@@ -2920,7 +2915,7 @@
for (SubscriptionInfo info : availableList) {
// Opportunistic subscriptions are considered invisible
// to users so they should never be returned.
- if (isInvisibleSubscription(info)) continue;
+ if (!isSubscriptionVisible(info)) continue;
String groupUuid = info.getGroupUuid();
if (groupUuid == null) {
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index 31d8ddb..7b40293 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -1355,12 +1355,7 @@
*/
public static final String EXTRA_RECOVERY_ACTION = "recoveryAction";
- /**
- * The max value for the timeout passed in {@link #requestNumberVerification}.
- * @hide
- */
- @SystemApi
- public static final long MAX_NUMBER_VERIFICATION_TIMEOUT_MILLIS = 60000;
+ private static final long MAX_NUMBER_VERIFICATION_TIMEOUT_MILLIS = 60000;
/**
* Intent sent when an error occurs that debug tools should log and possibly take further
@@ -2027,6 +2022,15 @@
return cmdline;
}
+ /**
+ * @return The max value for the timeout passed in {@link #requestNumberVerification}.
+ * @hide
+ */
+ @SystemApi
+ public static long getMaxNumberVerificationTimeoutMillis() {
+ return MAX_NUMBER_VERIFICATION_TIMEOUT_MILLIS;
+ }
+
/** Kernel command line */
private static final String sKernelCmdLine = getProcCmdLine();
@@ -4495,6 +4499,7 @@
* {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE}
* @hide
*/
+ @Nullable
@SystemApi
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public String getIsimDomain() {
@@ -5743,8 +5748,8 @@
*
* @hide
* @param range The range of phone numbers the caller expects a phone call from.
- * @param timeoutMillis The amount of time to wait for such a call, or
- * {@link #MAX_NUMBER_VERIFICATION_TIMEOUT_MILLIS}, whichever is lesser.
+ * @param timeoutMillis The amount of time to wait for such a call, or the value of
+ * {@link #getMaxNumberVerificationTimeoutMillis()}, whichever is lesser.
* @param executor The {@link Executor} that callbacks should be executed on.
* @param callback The callback to use for delivering results.
*/
@@ -9071,6 +9076,7 @@
* @return Application ID for specified app type or {@code null} if no uicc or error.
* @hide
*/
+ @Nullable
@SystemApi
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public String getAidForAppType(@UiccAppType int appType) {
diff --git a/telephony/java/android/telephony/mbms/vendor/MbmsGroupCallServiceBase.java b/telephony/java/android/telephony/mbms/vendor/MbmsGroupCallServiceBase.java
index e86a47d..1335b52 100644
--- a/telephony/java/android/telephony/mbms/vendor/MbmsGroupCallServiceBase.java
+++ b/telephony/java/android/telephony/mbms/vendor/MbmsGroupCallServiceBase.java
@@ -16,6 +16,7 @@
package android.telephony.mbms.vendor;
+import android.annotation.NonNull;
import android.annotation.SystemApi;
import android.annotation.TestApi;
import android.app.Service;
@@ -187,7 +188,7 @@
*
* May throw an {@link IllegalArgumentException} or a {@link SecurityException}, which
* will be intercepted and passed to the app as
- * {@link MbmsErrors.InitializationErrors#ERROR_UNABLE_TO_INITIALIZE}
+ * {@link MbmsErrors.InitializationErrtrors#ERROR_UNABLE_TO_INITIALIZE}
*
* May return any value from {@link MbmsErrors.InitializationErrors}
* or {@link MbmsErrors#SUCCESS}. Non-successful error codes will be passed to the app via
@@ -196,7 +197,7 @@
* @param callback The callback to use to communicate with the app.
* @param subscriptionId The subscription ID to use.
*/
- public int initialize(MbmsGroupCallSessionCallback callback, int subscriptionId)
+ public int initialize(@NonNull MbmsGroupCallSessionCallback callback, int subscriptionId)
throws RemoteException {
throw new UnsupportedOperationException("Not implemented");
}
@@ -215,8 +216,8 @@
* @param callback The callback object on which the app wishes to receive updates.
* @return Any error in {@link MbmsErrors.GeneralErrors}
*/
- public int startGroupCall(int subscriptionId, long tmgi, List<Integer> saiList,
- List<Integer> frequencyList, GroupCallCallback callback) {
+ public int startGroupCall(int subscriptionId, long tmgi, @NonNull List<Integer> saiList,
+ @NonNull List<Integer> frequencyList, @NonNull GroupCallCallback callback) {
throw new UnsupportedOperationException("Not implemented");
}
@@ -241,8 +242,8 @@
* @param saiList New list of SAIs that the call is available on.
* @param frequencyList New list of frequencies that the call is available on.
*/
- public void updateGroupCall(int subscriptionId, long tmgi, List<Integer> saiList,
- List<Integer> frequencyList) {
+ public void updateGroupCall(int subscriptionId, long tmgi, @NonNull List<Integer> saiList,
+ @NonNull List<Integer> frequencyList) {
throw new UnsupportedOperationException("Not implemented");
}