DivestOS/Patches/LineageOS-20.0/android_frameworks_base/0034-Allow_Disabling_NTP.patch
Tad b08bf0356f
Small additions + churn
- 18.1+: Disable NTP fully when automatic time is off, credit GrapheneOS
- 20.0: Handle Tor-over-Orbot when killswitch enabled, credit CalyxOS, BROKEN

Signed-off-by: Tad <tad@spotco.us>
2023-02-18 13:52:46 -05:00

31 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Renlord <me@renlord.com>
Date: Tue, 30 Jun 2020 11:52:43 +1000
Subject: [PATCH] dont ping server when nitz time update is toggled off
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
---
core/java/android/util/NtpTrustedTime.java | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/core/java/android/util/NtpTrustedTime.java b/core/java/android/util/NtpTrustedTime.java
index 4e7b3a51d758..06a8322fe5de 100644
--- a/core/java/android/util/NtpTrustedTime.java
+++ b/core/java/android/util/NtpTrustedTime.java
@@ -179,6 +179,15 @@ public class NtpTrustedTime implements TrustedTime {
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
public boolean forceRefresh() {
synchronized (this) {
+ final ContentResolver resolver = mContext.getContentResolver();
+
+ final boolean networkPollTime = Settings.Global.getInt(resolver,
+ Settings.Global.AUTO_TIME, 1) != 0;
+ if (!networkPollTime) {
+ Log.d(TAG, "forceRefresh: nitzTimeUpdate disabled bailing early");
+ return false;
+ }
+
NtpConnectionInfo connectionInfo = getNtpConnectionInfo();
if (connectionInfo == null) {
// missing server config, so no NTP time available