Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d0bf0f9 authored by Hai Zhang's avatar Hai Zhang
Browse files

Ensure beginTimeMillis is non-negative.

It might become negative if system time is set to (near) epoch.

Test: presubmit
Fixes: 155853357
Change-Id: I9175f755861797f5a20704d7f685063438be3bef
parent 06174db5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6052,7 +6052,7 @@ public class AppOpsService extends IAppOpsService.Stub {
        List<String> runtimeAppOpsList = getRuntimeAppOpsList();
        AppOpsManager.HistoricalOpsRequest histOpsRequest =
                new AppOpsManager.HistoricalOpsRequest.Builder(
                        Instant.now().minus(7, ChronoUnit.DAYS).toEpochMilli(),
                        Math.max(Instant.now().minus(7, ChronoUnit.DAYS).toEpochMilli(), 0),
                        Long.MAX_VALUE).setOpNames(runtimeAppOpsList).setFlags(
                        OP_FLAG_SELF | OP_FLAG_TRUSTED_PROXIED).build();
        appOps.getHistoricalOps(histOpsRequest, AsyncTask.THREAD_POOL_EXECUTOR,
+1 −1
Original line number Diff line number Diff line
@@ -3358,7 +3358,7 @@ public class StatsPullAtomService extends SystemService {
        CompletableFuture<HistoricalOps> ops = new CompletableFuture<>();
        HistoricalOpsRequest histOpsRequest =
                new HistoricalOpsRequest.Builder(
                        Instant.now().minus(1, ChronoUnit.DAYS).toEpochMilli(),
                        Math.max(Instant.now().minus(1, ChronoUnit.DAYS).toEpochMilli(), 0),
                        Long.MAX_VALUE).setFlags(
                        OP_FLAGS_PULLED).build();
        appOps.getHistoricalOps(histOpsRequest, AsyncTask.THREAD_POOL_EXECUTOR, ops::complete);