From 6009459405bbaa42054c9746c6339b48962c7753 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Thu, 21 Mar 2013 18:14:24 -0700 Subject: [PATCH] Round up periodic syncs with short frequencies. Bug: 7668972 Change-Id: I476ded1418a203621913098cf5d33a4e5dc533ee --- .../java/com/android/server/content/ContentService.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/services/java/com/android/server/content/ContentService.java b/services/java/com/android/server/content/ContentService.java index 3b92338c17524..545ec935c6485 100644 --- a/services/java/com/android/server/content/ContentService.java +++ b/services/java/com/android/server/content/ContentService.java @@ -37,7 +37,9 @@ import android.os.Parcel; import android.os.RemoteException; import android.os.ServiceManager; import android.os.UserHandle; +import android.text.format.DateUtils; import android.util.Log; +import android.util.Slog; import android.util.SparseIntArray; import java.io.FileDescriptor; @@ -406,6 +408,12 @@ public final class ContentService extends IContentService.Stub { "no permission to write the sync settings"); int userId = UserHandle.getCallingUserId(); + if (pollFrequency <= DateUtils.MINUTE_IN_MILLIS) { + Slog.w(TAG, "Requested poll frequency of " + pollFrequency + + "ms being rounded up to 60 seconds."); + pollFrequency = DateUtils.MINUTE_IN_MILLIS; + } + long identityToken = clearCallingIdentity(); try { getSyncManager().getSyncStorageEngine().addPeriodicSync(