summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Hai Zhang <zhanghai@google.com> 2024-04-11 18:22:34 +0000
committer Hai Zhang <zhanghai@google.com> 2024-04-11 18:27:47 +0000
commita1b7d7afacdbcb2deda5eacbc404a7a2a5d458eb (patch)
tree2f556ce910876a2421145f31f4cd619f28f7ebb3
parent42650607fca960117731b0e81adb6f4c23100140 (diff)
Use IoThread instead of BackgroundThread for HistoricalRegistry.
BackgroundThread is a low priority thread but IoThread isn't, so it gets more CPU cycles. Fixes: 333345274 Test: presubmit Change-Id: I929d7a7283feec17e9d879e0815c94930985f1bc
-rw-r--r--services/core/java/com/android/server/appop/HistoricalRegistry.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/services/core/java/com/android/server/appop/HistoricalRegistry.java b/services/core/java/com/android/server/appop/HistoricalRegistry.java
index 6f3526fb07e9..dbd47d00718f 100644
--- a/services/core/java/com/android/server/appop/HistoricalRegistry.java
+++ b/services/core/java/com/android/server/appop/HistoricalRegistry.java
@@ -54,13 +54,13 @@ import android.util.Xml;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.os.AtomicDirectory;
-import com.android.internal.os.BackgroundThread;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.XmlUtils;
import com.android.internal.util.function.pooled.PooledLambda;
import com.android.modules.utils.TypedXmlPullParser;
import com.android.modules.utils.TypedXmlSerializer;
import com.android.server.FgThread;
+import com.android.server.IoThread;
import org.xmlpull.v1.XmlPullParserException;
@@ -669,7 +669,7 @@ final class HistoricalRegistry {
}
private void clearHistoryOnDiskDLocked() {
- BackgroundThread.getHandler().removeMessages(MSG_WRITE_PENDING_HISTORY);
+ IoThread.getHandler().removeMessages(MSG_WRITE_PENDING_HISTORY);
synchronized (mInMemoryLock) {
mCurrentHistoricalOps = null;
mNextPersistDueTimeMillis = System.currentTimeMillis();
@@ -745,7 +745,7 @@ final class HistoricalRegistry {
private void persistPendingHistory(@NonNull List<HistoricalOps> pendingWrites) {
synchronized (mOnDiskLock) {
- BackgroundThread.getHandler().removeMessages(MSG_WRITE_PENDING_HISTORY);
+ IoThread.getHandler().removeMessages(MSG_WRITE_PENDING_HISTORY);
if (pendingWrites.isEmpty()) {
return;
}
@@ -767,7 +767,7 @@ final class HistoricalRegistry {
final Message message = PooledLambda.obtainMessage(
HistoricalRegistry::persistPendingHistory, HistoricalRegistry.this);
message.what = MSG_WRITE_PENDING_HISTORY;
- BackgroundThread.getHandler().sendMessage(message);
+ IoThread.getHandler().sendMessage(message);
mPendingWrites.offerFirst(ops);
}