diff options
author | Liefu Liu <liefuliu@google.com> | 2021-04-26 22:04:48 +0000 |
---|---|---|
committer | Liefu Liu <liefuliu@google.com> | 2021-04-26 22:44:11 +0000 |
commit | 5945232ae2490f681ceb08b5c11f6da4f5cbcc51 (patch) | |
tree | dab704c71bca29c7d483f5e4e3ab19cf34847556 | |
parent | 4a016e563ecb0aeed6b05abf625e7e5b6233913f (diff) | |
download | ContactsProvider-5945232ae2490f681ceb08b5c11f6da4f5cbcc51.tar.gz |
Minor name convention and comment update, for better readability.
Changes to be committed:
modified: src/com/android/providers/contacts/ContactsProvider2.java
Test: text update. no test
Bug: 185855005
Change-Id: Ib6a3a9dd209a1dac42209dcd2329e688f281b693
-rw-r--r-- | src/com/android/providers/contacts/ContactsProvider2.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/com/android/providers/contacts/ContactsProvider2.java b/src/com/android/providers/contacts/ContactsProvider2.java index e29b0fb2..4128e0dc 100644 --- a/src/com/android/providers/contacts/ContactsProvider2.java +++ b/src/com/android/providers/contacts/ContactsProvider2.java @@ -2597,16 +2597,22 @@ public class ContactsProvider2 extends AbstractContactsProvider syncToNetwork); } else { // Rate limit the changes which are not to sync to network. - long uptimeMillis = System.currentTimeMillis(); + long currentTimeMillis = System.currentTimeMillis(); mHandler.removeCallbacks(mChangeNotifier); - if (uptimeMillis > mLastNotifyChange + NOTIFY_CHANGE_RATE_LIMIT) { + if (currentTimeMillis > mLastNotifyChange + NOTIFY_CHANGE_RATE_LIMIT) { // Notify change immediately, since it has been a while since last notify. - mLastNotifyChange = uptimeMillis; + mLastNotifyChange = currentTimeMillis; getContext().getContentResolver().notifyChange(ContactsContract.AUTHORITY_URI, null, false); } else { - // Schedule a deleyed notify, to ensure the very last notifyChange will be executed. + // Schedule a delayed notification, to ensure the very last notifyChange will be + // executed. + // Delay is set to two-fold of rate limit, and the subsequent notifyChange called + // (if ever) between the (NOTIFY_CHANGE_RATE_LIMIT, 2 * NOTIFY_CHANGE_RATE_LIMIT) + // time window, will cancel this delayed notification. + // The delayed notification is only expected to run if notifyChange is not invoked + // between the above time window. mHandler.postDelayed(mChangeNotifier, NOTIFY_CHANGE_RATE_LIMIT * 2); } } |