summaryrefslogtreecommitdiff
path: root/libartservice/service/java/com/android/server/art/PreRebootDexoptJob.java
diff options
context:
space:
mode:
Diffstat (limited to 'libartservice/service/java/com/android/server/art/PreRebootDexoptJob.java')
-rw-r--r--libartservice/service/java/com/android/server/art/PreRebootDexoptJob.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/libartservice/service/java/com/android/server/art/PreRebootDexoptJob.java b/libartservice/service/java/com/android/server/art/PreRebootDexoptJob.java
index 08ff12c0b2..099be02b13 100644
--- a/libartservice/service/java/com/android/server/art/PreRebootDexoptJob.java
+++ b/libartservice/service/java/com/android/server/art/PreRebootDexoptJob.java
@@ -71,6 +71,16 @@ public class PreRebootDexoptJob implements ArtServiceJobInterface {
/** The slot that contains the OTA update, "_a" or "_b", or null for a Mainline update. */
@GuardedBy("this") @Nullable private String mOtaSlot = null;
+ /**
+ * Whether the job has started at least once, meaning the device is expected to have staged
+ * files, no matter it succeed, failed, or cancelled.
+ *
+ * Note that this flag is not persisted across system server restarts. It's possible that the
+ * value is lost due to a system server restart caused by a crash, but this is a minor case, so
+ * we don't handle it here for simplicity.
+ */
+ @GuardedBy("this") private boolean mHasStarted = false;
+
public PreRebootDexoptJob(@NonNull Context context) {
this(new Injector(context));
}
@@ -164,6 +174,7 @@ public class PreRebootDexoptJob implements ArtServiceJobInterface {
String otaSlot = mOtaSlot;
var cancellationSignal = mCancellationSignal = new CancellationSignal();
+ mHasStarted = true;
mRunningJob = new CompletableFuture().runAsync(() -> {
try {
// TODO(b/336239721): Consume the result and report metrics.
@@ -213,6 +224,10 @@ public class PreRebootDexoptJob implements ArtServiceJobInterface {
}
}
+ public synchronized boolean hasStarted() {
+ return mHasStarted;
+ }
+
/**
* Injector pattern for testing purpose.
*