Fix AppOps estimation call time out.
AppOps estimation call times out with likely reason being that when Pooled excutor runs this task when StatsPulAtomService is not active, mContext.getMainExecutor() provides executor which is not active. Test: atest testAppOps Bug: 143519689 Change-Id: Ie2d61b3304b8cc0beb7d4e0ad06ba58aeed1bb19
This commit is contained in:
@@ -3322,8 +3322,8 @@ public class StatsPullAtomService extends SystemService {
|
||||
public void run() {
|
||||
try {
|
||||
estimateAppOpsSamplingRate();
|
||||
} catch (Exception e) {
|
||||
Slog.e(TAG, "AppOps sampling ratio estimation failed");
|
||||
} catch (Throwable e) {
|
||||
Slog.e(TAG, "AppOps sampling ratio estimation failed: ", e);
|
||||
synchronized (mAppOpsSamplingRateLock) {
|
||||
mAppOpsSamplingRate = min(mAppOpsSamplingRate, 10);
|
||||
}
|
||||
@@ -3364,7 +3364,7 @@ public class StatsPullAtomService extends SystemService {
|
||||
Instant.now().minus(1, ChronoUnit.DAYS).toEpochMilli(),
|
||||
Long.MAX_VALUE).setFlags(
|
||||
OP_FLAGS_PULLED).build();
|
||||
appOps.getHistoricalOps(histOpsRequest, mContext.getMainExecutor(), ops::complete);
|
||||
appOps.getHistoricalOps(histOpsRequest, AsyncTask.THREAD_POOL_EXECUTOR, ops::complete);
|
||||
HistoricalOps histOps = ops.get(EXTERNAL_STATS_SYNC_TIMEOUT_MILLIS,
|
||||
TimeUnit.MILLISECONDS);
|
||||
List<AppOpEntry> opsList =
|
||||
|
||||
Reference in New Issue
Block a user