diff options
author | Henry Fang <quxiangfang@google.com> | 2023-07-19 17:22:48 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2023-07-19 17:22:48 +0000 |
commit | 6b0378d616c2c4d55169523e330d66d726274666 (patch) | |
tree | 862007579650a8dbac3709ef4b1103cdd7ae248f | |
parent | 9d59ea811c80969c725e6899ce2075d654323435 (diff) | |
parent | a371c105f687aea8a05c8e2f391ec0e2bcbe36b1 (diff) | |
download | TvProvider-6b0378d616c2c4d55169523e330d66d726274666.tar.gz |
Merge "TvProvider: Reduce synchronized block" into main
-rw-r--r-- | src/com/android/providers/tv/TransientRowHelper.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/com/android/providers/tv/TransientRowHelper.java b/src/com/android/providers/tv/TransientRowHelper.java index 7054a0c..c289633 100644 --- a/src/com/android/providers/tv/TransientRowHelper.java +++ b/src/com/android/providers/tv/TransientRowHelper.java @@ -71,11 +71,13 @@ public class TransientRowHelper { /** * Ensures that transient rows, inserted previously before current boot, are deleted. */ - public synchronized void ensureOldTransientRowsDeleted() { - if (mTransientRowsDeleted) { - return; + public void ensureOldTransientRowsDeleted() { + synchronized (this) { + if (mTransientRowsDeleted) { + return; + } + mTransientRowsDeleted = true; } - mTransientRowsDeleted = true; if (getLastDeletionBootCount() >= getBootCount()) { // This can be the second execution of TvProvider after boot since system kills // TvProvider in low memory conditions. If this is the case, we shouldn't delete |