Merge "Expose ACTION_NETWORK_SET_TIME as system API"
This commit is contained in:
committed by
Gerrit Code Review
commit
d3adef0662
@@ -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";
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -224,22 +224,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">.
|
||||
|
||||
Reference in New Issue
Block a user