Cached NTP time for system services.
Uses NTP server and timeout from secure settings, or fallback to defaults in resources. Update various system services to use cached NTP time when fresh enough, or force updates as needed. Bug: 4517273 Change-Id: Ie1c4c4883836013d02ca0bbd850cf8949f93b34b
This commit is contained in:
@@ -27,7 +27,6 @@ import static android.net.NetworkStats.IFACE_ALL;
|
|||||||
import static android.net.NetworkStats.TAG_NONE;
|
import static android.net.NetworkStats.TAG_NONE;
|
||||||
import static android.net.NetworkStats.UID_ALL;
|
import static android.net.NetworkStats.UID_ALL;
|
||||||
import static android.net.TrafficStats.UID_REMOVED;
|
import static android.net.TrafficStats.UID_REMOVED;
|
||||||
import static android.provider.Settings.Secure.NETSTATS_ENABLED;
|
|
||||||
import static android.provider.Settings.Secure.NETSTATS_NETWORK_BUCKET_DURATION;
|
import static android.provider.Settings.Secure.NETSTATS_NETWORK_BUCKET_DURATION;
|
||||||
import static android.provider.Settings.Secure.NETSTATS_NETWORK_MAX_HISTORY;
|
import static android.provider.Settings.Secure.NETSTATS_NETWORK_MAX_HISTORY;
|
||||||
import static android.provider.Settings.Secure.NETSTATS_PERSIST_THRESHOLD;
|
import static android.provider.Settings.Secure.NETSTATS_PERSIST_THRESHOLD;
|
||||||
@@ -71,7 +70,6 @@ import android.util.Slog;
|
|||||||
import android.util.TrustedTime;
|
import android.util.TrustedTime;
|
||||||
|
|
||||||
import com.android.internal.os.AtomicFile;
|
import com.android.internal.os.AtomicFile;
|
||||||
import com.android.server.NativeDaemonConnectorException;
|
|
||||||
import com.google.android.collect.Maps;
|
import com.google.android.collect.Maps;
|
||||||
import com.google.android.collect.Sets;
|
import com.google.android.collect.Sets;
|
||||||
|
|
||||||
@@ -175,9 +173,8 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
|||||||
|
|
||||||
public NetworkStatsService(
|
public NetworkStatsService(
|
||||||
Context context, INetworkManagementService networkManager, IAlarmManager alarmManager) {
|
Context context, INetworkManagementService networkManager, IAlarmManager alarmManager) {
|
||||||
// TODO: move to using cached NtpTrustedTime
|
this(context, networkManager, alarmManager, NtpTrustedTime.getInstance(context),
|
||||||
this(context, networkManager, alarmManager, new NtpTrustedTime(), getSystemDir(),
|
getSystemDir(), new DefaultNetworkStatsSettings(context));
|
||||||
new DefaultNetworkStatsSettings(context));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static File getSystemDir() {
|
private static File getSystemDir() {
|
||||||
|
|||||||
Reference in New Issue
Block a user