diff options
6 files changed, 28 insertions, 23 deletions
diff --git a/api/system-current.txt b/api/system-current.txt index e539e6cc60f6..6656c07f658a 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -8992,6 +8992,7 @@ package android.telephony { method @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) public void updateTestOtaEmergencyNumberDbFilePath(@NonNull String); field @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public static final String ACTION_ANOMALY_REPORTED = "android.telephony.action.ANOMALY_REPORTED"; field public static final String ACTION_EMERGENCY_ASSISTANCE = "android.telephony.action.EMERGENCY_ASSISTANCE"; + field public static final String ACTION_NETWORK_SET_TIME = "android.telephony.action.NETWORK_SET_TIME"; field public static final String ACTION_SIM_APPLICATION_STATE_CHANGED = "android.telephony.action.SIM_APPLICATION_STATE_CHANGED"; field public static final String ACTION_SIM_CARD_STATE_CHANGED = "android.telephony.action.SIM_CARD_STATE_CHANGED"; field public static final String ACTION_SIM_SLOT_STATUS_CHANGED = "android.telephony.action.SIM_SLOT_STATUS_CHANGED"; diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 082424fa4a4f..9ce29e35752e 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -635,7 +635,7 @@ <!-- NETWORK_SET_TIME moved from com.android.phone to system server. It should ultimately be removed. --> - <protected-broadcast android:name="android.intent.action.NETWORK_SET_TIME" /> + <protected-broadcast android:name="android.telephony.action.NETWORK_SET_TIME" /> <!-- For tether entitlement recheck--> <protected-broadcast diff --git a/services/core/java/com/android/server/NetworkTimeUpdateServiceImpl.java b/services/core/java/com/android/server/NetworkTimeUpdateServiceImpl.java index b0b45f411d34..39be311e902d 100644 --- a/services/core/java/com/android/server/NetworkTimeUpdateServiceImpl.java +++ b/services/core/java/com/android/server/NetworkTimeUpdateServiceImpl.java @@ -35,11 +35,11 @@ import android.os.Message; import android.os.PowerManager; import android.os.SystemClock; import android.provider.Settings; +import android.telephony.TelephonyManager; import android.util.Log; import android.util.NtpTrustedTime; import android.util.TimeUtils; -import com.android.internal.telephony.TelephonyIntents; import com.android.internal.util.DumpUtils; import java.io.FileDescriptor; @@ -137,7 +137,7 @@ public class NetworkTimeUpdateServiceImpl extends Binder implements NetworkTimeU private void registerForTelephonyIntents() { IntentFilter intentFilter = new IntentFilter(); - intentFilter.addAction(TelephonyIntents.ACTION_NETWORK_SET_TIME); + intentFilter.addAction(TelephonyManager.ACTION_NETWORK_SET_TIME); mContext.registerReceiver(mNitzReceiver, intentFilter); } @@ -247,7 +247,7 @@ public class NetworkTimeUpdateServiceImpl extends Binder implements NetworkTimeU public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (DBG) Log.d(TAG, "Received " + action); - if (TelephonyIntents.ACTION_NETWORK_SET_TIME.equals(action)) { + if (TelephonyManager.ACTION_NETWORK_SET_TIME.equals(action)) { mNitzTimeSetTime = SystemClock.elapsedRealtime(); } } diff --git a/services/core/java/com/android/server/timedetector/TimeDetectorStrategyImpl.java b/services/core/java/com/android/server/timedetector/TimeDetectorStrategyImpl.java index 1b1ac6d3ed07..d99e03b091a3 100644 --- a/services/core/java/com/android/server/timedetector/TimeDetectorStrategyImpl.java +++ b/services/core/java/com/android/server/timedetector/TimeDetectorStrategyImpl.java @@ -23,6 +23,7 @@ import android.app.AlarmManager; import android.app.timedetector.ManualTimeSuggestion; import android.app.timedetector.PhoneTimeSuggestion; import android.content.Intent; +import android.telephony.TelephonyManager; import android.util.ArrayMap; import android.util.LocalLog; import android.util.Slog; @@ -30,7 +31,6 @@ import android.util.TimestampedValue; import com.android.internal.annotations.GuardedBy; import com.android.internal.annotations.VisibleForTesting; -import com.android.internal.telephony.TelephonyIntents; import com.android.internal.util.IndentingPrintWriter; import java.io.PrintWriter; @@ -512,12 +512,12 @@ public final class TimeDetectorStrategyImpl implements TimeDetectorStrategy { mLastAutoSystemClockTimeSet = null; } - // Historically, Android has sent a TelephonyIntents.ACTION_NETWORK_SET_TIME broadcast only + // Historically, Android has sent a TelephonyManager.ACTION_NETWORK_SET_TIME broadcast only // when setting the time using NITZ. if (origin == ORIGIN_PHONE) { // Send a broadcast that telephony code used to send after setting the clock. // TODO Remove this broadcast as soon as there are no remaining listeners. - Intent intent = new Intent(TelephonyIntents.ACTION_NETWORK_SET_TIME); + Intent intent = new Intent(TelephonyManager.ACTION_NETWORK_SET_TIME); intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING); intent.putExtra("time", newSystemClockMillis); mCallback.sendStickyBroadcast(intent); diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index c190486f292e..c67ebfe78ef6 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -1462,6 +1462,26 @@ public class TelephonyManager { */ public static final String EXTRA_SIM_COMBINATION_NAMES = "android.telephony.extra.SIM_COMBINATION_NAMES"; + + /** + * Broadcast Action: The time was set by the carrier (typically by the NITZ string). + * This is a sticky broadcast. + * The intent will have the following extra values:</p> + * <ul> + * <li><em>time</em> - The time as a long in UTC milliseconds.</li> + * </ul> + * + * <p class="note"> + * Requires the READ_PHONE_STATE permission. + * + * <p class="note">This is a protected intent that can only be sent + * by the system. + * + * @hide + */ + @SystemApi + public static final String ACTION_NETWORK_SET_TIME = "android.telephony.action.NETWORK_SET_TIME"; + // // // Device Info diff --git a/telephony/java/com/android/internal/telephony/TelephonyIntents.java b/telephony/java/com/android/internal/telephony/TelephonyIntents.java index b2c3fc79025b..8e1a78c56e0a 100644 --- a/telephony/java/com/android/internal/telephony/TelephonyIntents.java +++ b/telephony/java/com/android/internal/telephony/TelephonyIntents.java @@ -225,22 +225,6 @@ public class TelephonyIntents { public static final String EXTRA_REBROADCAST_ON_UNLOCK= "rebroadcastOnUnlock"; /** - * Broadcast Action: The time was set by the carrier (typically by the NITZ string). - * This is a sticky broadcast. - * The intent will have the following extra values:</p> - * <ul> - * <li><em>time</em> - The time as a long in UTC milliseconds.</li> - * </ul> - * - * <p class="note"> - * Requires the READ_PHONE_STATE permission. - * - * <p class="note">This is a protected intent that can only be sent - * by the system. - */ - public static final String ACTION_NETWORK_SET_TIME = "android.intent.action.NETWORK_SET_TIME"; - - /** * <p>Broadcast Action: It indicates the Emergency callback mode blocks datacall/sms * <p class="note">. * This is to pop up a notice to show user that the phone is in emergency callback mode |