Merge "Fix pipe fds leak in copyInternalSpliceSocket" into main
diff --git a/AconfigFlags.bp b/AconfigFlags.bp
index 54baae5..86bcdea 100644
--- a/AconfigFlags.bp
+++ b/AconfigFlags.bp
@@ -258,6 +258,11 @@
defaults: ["framework-minus-apex-aconfig-java-defaults"],
}
+cc_aconfig_library {
+ name: "android_security_flags_aconfig_c_lib",
+ aconfig_declarations: "android.security.flags-aconfig",
+}
+
// UsageStats
aconfig_declarations {
name: "android.app.usage.flags-aconfig",
diff --git a/DREAM_MANAGER_OWNERS b/DREAM_MANAGER_OWNERS
deleted file mode 100644
index 48bde60..0000000
--- a/DREAM_MANAGER_OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-brycelee@google.com
diff --git a/apct-tests/perftests/OWNERS b/apct-tests/perftests/OWNERS
index 8ff3f9b..f4346b1 100644
--- a/apct-tests/perftests/OWNERS
+++ b/apct-tests/perftests/OWNERS
@@ -8,4 +8,3 @@
shayba@google.com
shombert@google.com
timmurray@google.com
-wessam@google.com
diff --git a/cmds/bootanimation/BootAnimation.cpp b/cmds/bootanimation/BootAnimation.cpp
index 5adcd93..7eb9d0f 100644
--- a/cmds/bootanimation/BootAnimation.cpp
+++ b/cmds/bootanimation/BootAnimation.cpp
@@ -1335,7 +1335,8 @@
if (path.string() == animation.parts[j].path.c_str()) {
uint16_t method;
// supports only stored png files
- if (zip->getEntryInfo(entry, &method, nullptr, nullptr, nullptr, nullptr, nullptr)) {
+ if (zip->getEntryInfo(entry, &method, nullptr, nullptr, nullptr, nullptr,
+ nullptr, nullptr)) {
if (method == ZipFileRO::kCompressStored) {
FileMap* map = zip->createEntryFileMap(entry);
if (map) {
diff --git a/core/java/android/animation/OWNERS b/core/java/android/animation/OWNERS
index 822a35c..f3b330a 100644
--- a/core/java/android/animation/OWNERS
+++ b/core/java/android/animation/OWNERS
@@ -2,5 +2,4 @@
romainguy@google.com
tianliu@google.com
-alanv@google.com
adamp@google.com
diff --git a/core/java/android/app/OWNERS b/core/java/android/app/OWNERS
index 02f00ba..cb490da 100644
--- a/core/java/android/app/OWNERS
+++ b/core/java/android/app/OWNERS
@@ -61,7 +61,7 @@
per-file ComponentCaller.java = file:COMPONENT_CALLER_OWNERS
# DreamManager
-per-file DreamManager.java = file:/DREAM_MANAGER_OWNERS
+per-file DreamManager.java = file:/core/java/android/service/dreams/OWNERS
# GrammaticalInflectionManager
per-file *GrammaticalInflection* = file:/services/core/java/com/android/server/grammaticalinflection/OWNERS
diff --git a/core/java/android/app/pinner/OWNERS b/core/java/android/app/pinner/OWNERS
index 3e3fa66..fe5da9f 100644
--- a/core/java/android/app/pinner/OWNERS
+++ b/core/java/android/app/pinner/OWNERS
@@ -5,6 +5,5 @@
philipcuadra@google.com
shombert@google.com
timmurray@google.com
-wessam@google.com
jdduke@google.com
-shayba@google.com
\ No newline at end of file
+shayba@google.com
diff --git a/core/java/android/gesture/OWNERS b/core/java/android/gesture/OWNERS
index b3b8775..168630a 100644
--- a/core/java/android/gesture/OWNERS
+++ b/core/java/android/gesture/OWNERS
@@ -1,7 +1,6 @@
# Bug component: 25700
romainguy@google.com
-alanv@google.com
adamp@google.com
aurimas@google.com
nduca@google.com
diff --git a/core/java/android/service/dreams/OWNERS b/core/java/android/service/dreams/OWNERS
index 77bcee8..119ca55 100644
--- a/core/java/android/service/dreams/OWNERS
+++ b/core/java/android/service/dreams/OWNERS
@@ -1,10 +1,11 @@
-# Bug component: 78010
+# Bug component: 66910
brycelee@google.com
-dsandler@google.com
-galinap@google.com
-jjaggi@google.com
lusilva@google.com
-michaelwr@google.com
-santoscordon@google.com
wxyz@google.com
+justinkoh@google.com
+
+rgl@google.com
+santoscordon@google.com
+
+dsandler@google.com
diff --git a/core/java/android/transition/OWNERS b/core/java/android/transition/OWNERS
index eb5a581..2a8d940 100644
--- a/core/java/android/transition/OWNERS
+++ b/core/java/android/transition/OWNERS
@@ -2,5 +2,4 @@
romainguy@google.com
mount@google.com
-alanv@google.com
adamp@google.com
diff --git a/core/java/android/view/OWNERS b/core/java/android/view/OWNERS
index 07d05a4..31a8dfa 100644
--- a/core/java/android/view/OWNERS
+++ b/core/java/android/view/OWNERS
@@ -1,7 +1,6 @@
# Bug component: 25700
romainguy@google.com
-alanv@google.com
adamp@google.com
aurimas@google.com
nduca@google.com
diff --git a/core/java/android/view/accessibility/OWNERS b/core/java/android/view/accessibility/OWNERS
index b0943e9..f62b33f 100644
--- a/core/java/android/view/accessibility/OWNERS
+++ b/core/java/android/view/accessibility/OWNERS
@@ -5,7 +5,6 @@
# Android members outside of Accessibility
adamp@google.com #{LAST_RESORT_SUGGESTION}
-alanv@google.com #{LAST_RESORT_SUGGESTION}
aurimas@google.com #{LAST_RESORT_SUGGESTION}
jjaggi@google.com #{LAST_RESORT_SUGGESTION}
ogunwale@google.com #{LAST_RESORT_SUGGESTION}
diff --git a/core/java/android/view/animation/OWNERS b/core/java/android/view/animation/OWNERS
index 9b8f4d9..2fa01c3 100644
--- a/core/java/android/view/animation/OWNERS
+++ b/core/java/android/view/animation/OWNERS
@@ -2,5 +2,4 @@
romainguy@google.com
tianliu@google.com
-alanv@google.com
adamp@google.com
diff --git a/core/java/android/view/textclassifier/intent/OWNERS b/core/java/android/view/textclassifier/intent/OWNERS
index ac80d9f..3465fe6 100644
--- a/core/java/android/view/textclassifier/intent/OWNERS
+++ b/core/java/android/view/textclassifier/intent/OWNERS
@@ -4,5 +4,4 @@
toki@google.com
svetoslavganov@android.com
svetoslavganov@google.com
-augale@google.com
joannechung@google.com
diff --git a/core/java/android/widget/OWNERS b/core/java/android/widget/OWNERS
index 1dc90ed..8b8090b 100644
--- a/core/java/android/widget/OWNERS
+++ b/core/java/android/widget/OWNERS
@@ -1,7 +1,6 @@
# Bug component: 25700
romainguy@google.com
-alanv@google.com
adamp@google.com
aurimas@google.com
siyamed@google.com
diff --git a/core/jni/com_android_internal_content_NativeLibraryHelper.cpp b/core/jni/com_android_internal_content_NativeLibraryHelper.cpp
index 9b8dab7..fba0d81 100644
--- a/core/jni/com_android_internal_content_NativeLibraryHelper.cpp
+++ b/core/jni/com_android_internal_content_NativeLibraryHelper.cpp
@@ -115,7 +115,8 @@
size_t* total = (size_t*) arg;
uint32_t uncompLen;
- if (!zipFile->getEntryInfo(zipEntry, nullptr, &uncompLen, nullptr, nullptr, nullptr, nullptr)) {
+ if (!zipFile->getEntryInfo(zipEntry, nullptr, &uncompLen, nullptr, nullptr, nullptr, nullptr,
+ nullptr)) {
return INSTALL_FAILED_INVALID_APK;
}
diff --git a/core/res/OWNERS b/core/res/OWNERS
index dce578a..22ea9da 100644
--- a/core/res/OWNERS
+++ b/core/res/OWNERS
@@ -66,6 +66,11 @@
per-file res/xml/power_profile.xml = file:/BATTERY_STATS_OWNERS
per-file res/xml/power_profile_test.xml = file:/BATTERY_STATS_OWNERS
+# RemoteView color resources
+per-file remote_color_resources_res/symbols.xml = pbdr@google.com
+per-file remote_color_resources_res/values/public.xml = pbdr@google.com
+per-file remote_color_resources_res/values/colors.xml = pbdr@google.com
+
# Telephony
per-file res/values/config_telephony.xml = file:/platform/frameworks/opt/telephony:/OWNERS
per-file res/xml/sms_short_codes.xml = file:/platform/frameworks/opt/telephony:/OWNERS
@@ -79,4 +84,4 @@
per-file res/values/styles.xml = arteiro@google.com
per-file res/values/symbols.xml = arteiro@google.com
per-file res/values/themes_device_defaults.xml = arteiro@google.com
-per-file res/values/styles_material.xml = arteiro@google.com
\ No newline at end of file
+per-file res/values/styles_material.xml = arteiro@google.com
diff --git a/keystore/OWNERS b/keystore/OWNERS
index 913f655..6891777 100644
--- a/keystore/OWNERS
+++ b/keystore/OWNERS
@@ -1,4 +1,5 @@
# Bug component: 189335
+drysdale@google.com
eranm@google.com
jbires@google.com
swillden@google.com
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/protolog/OWNERS b/libs/WindowManager/Shell/src/com/android/wm/shell/protolog/OWNERS
new file mode 100644
index 0000000..3f3308c
--- /dev/null
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/protolog/OWNERS
@@ -0,0 +1 @@
+include platform/development:/tools/winscope/OWNERS
diff --git a/libs/androidfw/AssetManager.cpp b/libs/androidfw/AssetManager.cpp
index 68befff..e618245 100644
--- a/libs/androidfw/AssetManager.cpp
+++ b/libs/androidfw/AssetManager.cpp
@@ -926,8 +926,8 @@
//printf("USING Zip '%s'\n", pEntry->getFileName());
- if (!pZipFile->getEntryInfo(entry, &method, &uncompressedLen, NULL, NULL,
- NULL, NULL))
+ if (!pZipFile->getEntryInfo(entry, &method, &uncompressedLen, nullptr, nullptr,
+ nullptr, nullptr, nullptr))
{
ALOGW("getEntryInfo failed\n");
return NULL;
diff --git a/libs/androidfw/ZipFileRO.cpp b/libs/androidfw/ZipFileRO.cpp
index 839c7b6..10651cd 100644
--- a/libs/androidfw/ZipFileRO.cpp
+++ b/libs/androidfw/ZipFileRO.cpp
@@ -119,14 +119,6 @@
* appear to be bogus.
*/
bool ZipFileRO::getEntryInfo(ZipEntryRO entry, uint16_t* pMethod,
- uint32_t* pUncompLen, uint32_t* pCompLen, off64_t* pOffset,
- uint32_t* pModWhen, uint32_t* pCrc32) const
-{
- return getEntryInfo(entry, pMethod, pUncompLen, pCompLen, pOffset, pModWhen,
- pCrc32, nullptr);
-}
-
-bool ZipFileRO::getEntryInfo(ZipEntryRO entry, uint16_t* pMethod,
uint32_t* pUncompLen, uint32_t* pCompLen, off64_t* pOffset,
uint32_t* pModWhen, uint32_t* pCrc32, uint16_t* pExtraFieldSize) const
{
diff --git a/libs/androidfw/include/androidfw/ZipFileRO.h b/libs/androidfw/include/androidfw/ZipFileRO.h
index f7c5007..0f3f19c 100644
--- a/libs/androidfw/include/androidfw/ZipFileRO.h
+++ b/libs/androidfw/include/androidfw/ZipFileRO.h
@@ -147,10 +147,6 @@
* Returns "false" if "entry" is bogus or if the data in the Zip file
* appears to be bad.
*/
- bool getEntryInfo(ZipEntryRO entry, uint16_t* pMethod, uint32_t* pUncompLen,
- uint32_t* pCompLen, off64_t* pOffset, uint32_t* pModWhen,
- uint32_t* pCrc32) const;
-
bool getEntryInfo(ZipEntryRO entry, uint16_t* pMethod,
uint32_t* pUncompLen, uint32_t* pCompLen, off64_t* pOffset,
uint32_t* pModWhen, uint32_t* pCrc32, uint16_t* pExtraFieldSize) const;
diff --git a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
index 635dc42..5a530c4 100644
--- a/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
+++ b/packages/DynamicSystemInstallationService/src/com/android/dynsystem/DynamicSystemInstallationService.java
@@ -60,7 +60,6 @@
import android.os.image.DynamicSystemClient;
import android.os.image.DynamicSystemManager;
import android.text.TextUtils;
-import android.util.EventLog;
import android.util.Log;
import android.widget.Toast;
@@ -104,14 +103,6 @@
private static final String NOTIFICATION_CHANNEL_ID = "com.android.dynsystem";
private static final int NOTIFICATION_ID = 1;
- /*
- * Event log tags
- */
- private static final int EVENT_DSU_PROGRESS_UPDATE = 120000;
- private static final int EVENT_DSU_INSTALL_COMPLETE = 120001;
- private static final int EVENT_DSU_INSTALL_FAILED = 120002;
- private static final int EVENT_DSU_INSTALL_INSUFFICIENT_SPACE = 120003;
-
protected static void logEventProgressUpdate(
String partitionName,
long installedBytes,
@@ -119,8 +110,7 @@
int partitionNumber,
int totalPartitionNumber,
int totalProgressPercentage) {
- EventLog.writeEvent(
- EVENT_DSU_PROGRESS_UPDATE,
+ EventLogTags.writeDsuProgressUpdate(
partitionName,
installedBytes,
totalBytes,
@@ -130,15 +120,15 @@
}
protected static void logEventComplete() {
- EventLog.writeEvent(EVENT_DSU_INSTALL_COMPLETE);
+ EventLogTags.writeDsuInstallComplete();
}
protected static void logEventFailed(String cause) {
- EventLog.writeEvent(EVENT_DSU_INSTALL_FAILED, cause);
+ EventLogTags.writeDsuInstallFailed(cause);
}
protected static void logEventInsufficientSpace() {
- EventLog.writeEvent(EVENT_DSU_INSTALL_INSUFFICIENT_SPACE);
+ EventLogTags.writeDsuInstallInsufficientSpace();
}
/*
diff --git a/packages/SystemUI/OWNERS b/packages/SystemUI/OWNERS
index 796e391..3a5ec92 100644
--- a/packages/SystemUI/OWNERS
+++ b/packages/SystemUI/OWNERS
@@ -4,7 +4,6 @@
dsandler@android.com
-aaronjli@google.com
achalke@google.com
acul@google.com
adamcohen@google.com
diff --git a/services/core/java/com/android/server/BootReceiver.java b/services/core/java/com/android/server/BootReceiver.java
index f69a521..23cee9d 100644
--- a/services/core/java/com/android/server/BootReceiver.java
+++ b/services/core/java/com/android/server/BootReceiver.java
@@ -141,6 +141,10 @@
private static final int MAX_ERROR_REPORTS = 8;
private static int sSentReports = 0;
+ // Max tombstone file size to add to dropbox.
+ private static final long MAX_TOMBSTONE_SIZE_BYTES =
+ DropBoxManagerService.DEFAULT_QUOTA_KB * 1024;
+
@Override
public void onReceive(final Context context, Intent intent) {
// Log boot events in the background to avoid blocking the main thread with I/O
@@ -390,6 +394,12 @@
private static void addAugmentedProtoToDropbox(
File tombstone, DropBoxManager db,
DropboxRateLimiter.RateLimitResult rateLimitResult) throws IOException {
+ // Do not add proto files larger than 20Mb to DropBox as they can cause OOMs when
+ // processing large tombstones. The text tombstone is still added to DropBox.
+ if (tombstone.length() > MAX_TOMBSTONE_SIZE_BYTES) {
+ Slog.w(TAG, "Tombstone too large to add to DropBox: " + tombstone.toPath());
+ return;
+ }
// Read the proto tombstone file as bytes.
final byte[] tombstoneBytes = Files.readAllBytes(tombstone.toPath());
diff --git a/services/core/java/com/android/server/DropBoxManagerService.java b/services/core/java/com/android/server/DropBoxManagerService.java
index 748253f..70b3bde 100644
--- a/services/core/java/com/android/server/DropBoxManagerService.java
+++ b/services/core/java/com/android/server/DropBoxManagerService.java
@@ -106,7 +106,7 @@
private static final int DEFAULT_AGE_SECONDS = 3 * 86400;
private static final int DEFAULT_MAX_FILES = 1000;
private static final int DEFAULT_MAX_FILES_LOWRAM = 300;
- private static final int DEFAULT_QUOTA_KB = Build.IS_USERDEBUG ? 20 * 1024 : 10 * 1024;
+ public static final int DEFAULT_QUOTA_KB = Build.IS_USERDEBUG ? 20 * 1024 : 10 * 1024;
private static final int DEFAULT_QUOTA_PERCENT = 10;
private static final int DEFAULT_RESERVE_PERCENT = 0;
private static final int QUOTA_RESCAN_MILLIS = 5000;
diff --git a/services/core/java/com/android/server/PackageWatchdog.java b/services/core/java/com/android/server/PackageWatchdog.java
index a619257..966478e 100644
--- a/services/core/java/com/android/server/PackageWatchdog.java
+++ b/services/core/java/com/android/server/PackageWatchdog.java
@@ -138,6 +138,12 @@
static final long DEFAULT_BOOT_LOOP_TRIGGER_WINDOW_MS = TimeUnit.MINUTES.toMillis(10);
+ // Time needed to apply mitigation
+ private static final String MITIGATION_WINDOW_MS =
+ "persist.device_config.configuration.mitigation_window_ms";
+ @VisibleForTesting
+ static final long DEFAULT_MITIGATION_WINDOW_MS = TimeUnit.SECONDS.toMillis(5);
+
// Threshold level at which or above user might experience significant disruption.
private static final String MAJOR_USER_IMPACT_LEVEL_THRESHOLD =
"persist.device_config.configuration.major_user_impact_level_threshold";
@@ -210,6 +216,9 @@
@GuardedBy("mLock")
private boolean mSyncRequired = false;
+ @GuardedBy("mLock")
+ private long mLastMitigation = -1000000;
+
@FunctionalInterface
@VisibleForTesting
interface SystemClock {
@@ -400,6 +409,16 @@
Slog.w(TAG, "Could not resolve a list of failing packages");
return;
}
+ synchronized (mLock) {
+ final long now = mSystemClock.uptimeMillis();
+ if (Flags.recoverabilityDetection()) {
+ if (now >= mLastMitigation
+ && (now - mLastMitigation) < getMitigationWindowMs()) {
+ Slog.i(TAG, "Skipping onPackageFailure mitigation");
+ return;
+ }
+ }
+ }
mLongTaskHandler.post(() -> {
synchronized (mLock) {
if (mAllObservers.isEmpty()) {
@@ -500,10 +519,17 @@
int currentObserverImpact,
int mitigationCount) {
if (currentObserverImpact < getUserImpactLevelLimit()) {
+ synchronized (mLock) {
+ mLastMitigation = mSystemClock.uptimeMillis();
+ }
currentObserverToNotify.execute(versionedPackage, failureReason, mitigationCount);
}
}
+ private long getMitigationWindowMs() {
+ return SystemProperties.getLong(MITIGATION_WINDOW_MS, DEFAULT_MITIGATION_WINDOW_MS);
+ }
+
/**
* Called when the system server boots. If the system server is detected to be in a boot loop,
diff --git a/services/core/java/com/android/server/dreams/OWNERS b/services/core/java/com/android/server/dreams/OWNERS
index 7302f6e..b9286f8 100644
--- a/services/core/java/com/android/server/dreams/OWNERS
+++ b/services/core/java/com/android/server/dreams/OWNERS
@@ -1,4 +1,3 @@
-brycelee@google.com
-dsandler@android.com
-michaelwr@google.com
-roosa@google.com
+# Bug component: 66910
+include /core/java/android/service/dreams/OWNERS
+
diff --git a/services/core/java/com/android/server/locales/OWNERS b/services/core/java/com/android/server/locales/OWNERS
index e1e946b..7e35dac 100644
--- a/services/core/java/com/android/server/locales/OWNERS
+++ b/services/core/java/com/android/server/locales/OWNERS
@@ -1,5 +1,4 @@
roosa@google.com
-pratyushmore@google.com
goldmanj@google.com
ankitavyas@google.com
allenwtsu@google.com
diff --git a/services/core/java/com/android/server/notification/NotificationManagerService.java b/services/core/java/com/android/server/notification/NotificationManagerService.java
index 4d05c36..4e029fd 100755
--- a/services/core/java/com/android/server/notification/NotificationManagerService.java
+++ b/services/core/java/com/android/server/notification/NotificationManagerService.java
@@ -2291,7 +2291,7 @@
@VisibleForTesting
void clearNotifications() {
- synchronized (mNotificationList) {
+ synchronized (mNotificationLock) {
mEnqueuedNotifications.clear();
mNotificationList.clear();
mNotificationsByKey.clear();
@@ -2301,21 +2301,27 @@
@VisibleForTesting
void addNotification(NotificationRecord r) {
- mNotificationList.add(r);
- mNotificationsByKey.put(r.getSbn().getKey(), r);
- if (r.getSbn().isGroup()) {
- mSummaryByGroupKey.put(r.getGroupKey(), r);
+ synchronized (mNotificationLock) {
+ mNotificationList.add(r);
+ mNotificationsByKey.put(r.getSbn().getKey(), r);
+ if (r.getSbn().isGroup()) {
+ mSummaryByGroupKey.put(r.getGroupKey(), r);
+ }
}
}
@VisibleForTesting
void addEnqueuedNotification(NotificationRecord r) {
- mEnqueuedNotifications.add(r);
+ synchronized (mNotificationLock) {
+ mEnqueuedNotifications.add(r);
+ }
}
@VisibleForTesting
NotificationRecord getNotificationRecord(String key) {
- return mNotificationsByKey.get(key);
+ synchronized (mNotificationLock) {
+ return mNotificationsByKey.get(key);
+ }
}
diff --git a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
index 9f97648..c025913 100644
--- a/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
+++ b/services/profcollect/src/com/android/server/profcollect/ProfcollectForwardingService.java
@@ -25,6 +25,7 @@
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.hardware.camera2.CameraManager;
import android.os.Handler;
import android.os.IBinder.DeathRecipient;
import android.os.Looper;
@@ -58,7 +59,6 @@
public final class ProfcollectForwardingService extends SystemService {
public static final String LOG_TAG = "ProfcollectForwardingService";
- private static final boolean DEBUG = Log.isLoggable(LOG_TAG, Log.DEBUG);
private static final String INTENT_UPLOAD_PROFILES =
"com.android.server.profcollect.UPLOAD_PROFILES";
private static final long BG_PROCESS_INTERVAL = TimeUnit.HOURS.toMillis(4); // every 4 hours.
@@ -120,9 +120,6 @@
@Override
public void onStart() {
- if (DEBUG) {
- Log.d(LOG_TAG, "Profcollect forwarding service start");
- }
connectNativeService();
}
@@ -245,9 +242,6 @@
@Override
public boolean onStartJob(JobParameters params) {
- if (DEBUG) {
- Log.d(LOG_TAG, "Starting background process job");
- }
createAndUploadReport(sSelfService);
jobFinished(params, false);
return true;
@@ -265,6 +259,7 @@
BackgroundThread.get().getThreadHandler().post(
() -> {
registerAppLaunchObserver();
+ registerCameraOpenObserver();
registerDex2oatObserver();
registerOTAObserver();
});
@@ -289,9 +284,6 @@
"applaunch_trace_freq", 2);
int randomNum = ThreadLocalRandom.current().nextInt(100);
if (randomNum < traceFrequency) {
- if (DEBUG) {
- Log.d(LOG_TAG, "Tracing on app launch event: " + packageName);
- }
BackgroundThread.get().getThreadHandler().post(() -> {
try {
mIProfcollect.trace_once("applaunch");
@@ -331,9 +323,6 @@
"dex2oat_trace_freq", 25);
int randomNum = ThreadLocalRandom.current().nextInt(100);
if (randomNum < traceFrequency) {
- if (DEBUG) {
- Log.d(LOG_TAG, "Tracing on dex2oat event");
- }
BackgroundThread.get().getThreadHandler().post(() -> {
try {
// Dex2oat could take a while before it starts. Add a short delay before start
@@ -352,11 +341,6 @@
updateEngine.bind(new UpdateEngineCallback() {
@Override
public void onStatusUpdate(int status, float percent) {
- if (DEBUG) {
- Log.d(LOG_TAG, "Received OTA status update, status: " + status + ", percent: "
- + percent);
- }
-
if (status == UpdateEngine.UpdateStatusConstants.UPDATED_NEED_REBOOT) {
createAndUploadReport(sSelfService);
}
@@ -388,8 +372,38 @@
.putExtra("filename", reportName);
pfs.getContext().sendBroadcast(intent);
});
- if (DEBUG) {
- Log.d(LOG_TAG, "Sent report for upload.");
- }
+ }
+
+ private void registerCameraOpenObserver() {
+ CameraManager cm = getContext().getSystemService(CameraManager.class);
+ cm.registerAvailabilityCallback(new CameraManager.AvailabilityCallback() {
+ @Override
+ public void onCameraOpened(String cameraId, String packageId) {
+ Log.d(LOG_TAG, "Received camera open event from: " + packageId);
+ // Skip face auth and Android System Intelligence, since they trigger way too
+ // often.
+ if (packageId.startsWith("client.pid")
+ || packageId.equals("com.google.android.as")) {
+ return;
+ }
+ // Sample for a fraction of camera events.
+ final int traceFrequency =
+ DeviceConfig.getInt(DeviceConfig.NAMESPACE_PROFCOLLECT_NATIVE_BOOT,
+ "camera_trace_freq", 10);
+ int randomNum = ThreadLocalRandom.current().nextInt(100);
+ if (randomNum >= traceFrequency) {
+ return;
+ }
+ BackgroundThread.get().getThreadHandler().post(() -> {
+ try {
+ // Wait for a short time before starting tracing.
+ Thread.sleep(1000);
+ mIProfcollect.trace_once("camera");
+ } catch (RemoteException | InterruptedException e) {
+ Log.e(LOG_TAG, "Failed to initiate trace: " + e.getMessage());
+ }
+ });
+ }
+ }, null);
}
}
diff --git a/tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java b/tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java
index 093923f..a8b383c 100644
--- a/tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java
+++ b/tests/PackageWatchdog/src/com/android/server/PackageWatchdogTest.java
@@ -101,8 +101,8 @@
private static final String OBSERVER_NAME_2 = "observer2";
private static final String OBSERVER_NAME_3 = "observer3";
private static final String OBSERVER_NAME_4 = "observer4";
- private static final long SHORT_DURATION = TimeUnit.SECONDS.toMillis(1);
- private static final long LONG_DURATION = TimeUnit.SECONDS.toMillis(5);
+ private static final long SHORT_DURATION = TimeUnit.SECONDS.toMillis(10);
+ private static final long LONG_DURATION = TimeUnit.SECONDS.toMillis(50);
@Rule
public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
@@ -1453,7 +1453,8 @@
raiseFatalFailureAndDispatch(watchdog, Arrays.asList(new VersionedPackage(APP_A,
VERSION_CODE)), PackageWatchdog.FAILURE_REASON_UNKNOWN);
- moveTimeForwardAndDispatch(PackageWatchdog.DEFAULT_DEESCALATION_WINDOW_MS);
+ moveTimeForwardAndDispatch(PackageWatchdog.DEFAULT_DEESCALATION_WINDOW_MS
+ - TimeUnit.MINUTES.toMillis(1));
// The first failure will be outside the threshold.
raiseFatalFailureAndDispatch(watchdog, Arrays.asList(new VersionedPackage(APP_A,
@@ -1712,6 +1713,9 @@
watchdog.onPackageFailure(packages, failureReason);
}
mTestLooper.dispatchAll();
+ if (Flags.recoverabilityDetection()) {
+ moveTimeForwardAndDispatch(watchdog.DEFAULT_MITIGATION_WINDOW_MS);
+ }
}
private PackageWatchdog createWatchdog() {