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
diff --git a/services/core/java/com/android/server/appop/HistoricalRegistry.java b/services/core/java/com/android/server/appop/HistoricalRegistry.java
index 6f3526f..dbd47d0 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 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 @@
}
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 @@
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 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);
}