Merge "Remove android.telephony.action.NETWORK_SET_TIME"
This commit is contained in:
@@ -9232,7 +9232,6 @@ package android.telephony {
|
|||||||
method @RequiresPermission(android.Manifest.permission.READ_ACTIVE_EMERGENCY_SESSION) public void updateTestOtaEmergencyNumberDbFilePath(@NonNull String);
|
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 @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_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_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_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";
|
field public static final String ACTION_SIM_SLOT_STATUS_CHANGED = "android.telephony.action.SIM_SLOT_STATUS_CHANGED";
|
||||||
|
|||||||
@@ -633,10 +633,6 @@
|
|||||||
|
|
||||||
<protected-broadcast android:name="android.intent.action.DEVICE_CUSTOMIZATION_READY" />
|
<protected-broadcast android:name="android.intent.action.DEVICE_CUSTOMIZATION_READY" />
|
||||||
|
|
||||||
<!-- NETWORK_SET_TIME moved from com.android.phone to system server. It should ultimately be
|
|
||||||
removed. -->
|
|
||||||
<protected-broadcast android:name="android.telephony.action.NETWORK_SET_TIME" />
|
|
||||||
|
|
||||||
<!-- For tether entitlement recheck-->
|
<!-- For tether entitlement recheck-->
|
||||||
<protected-broadcast
|
<protected-broadcast
|
||||||
android:name="com.android.server.connectivity.tethering.PROVISIONING_RECHECK_ALARM" />
|
android:name="com.android.server.connectivity.tethering.PROVISIONING_RECHECK_ALARM" />
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import android.annotation.Nullable;
|
|||||||
import android.app.timedetector.ManualTimeSuggestion;
|
import android.app.timedetector.ManualTimeSuggestion;
|
||||||
import android.app.timedetector.NetworkTimeSuggestion;
|
import android.app.timedetector.NetworkTimeSuggestion;
|
||||||
import android.app.timedetector.PhoneTimeSuggestion;
|
import android.app.timedetector.PhoneTimeSuggestion;
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.TimestampedValue;
|
import android.os.TimestampedValue;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
@@ -73,9 +72,6 @@ public interface TimeDetectorStrategy {
|
|||||||
|
|
||||||
/** Release the wake lock acquired by a call to {@link #acquireWakeLock()}. */
|
/** Release the wake lock acquired by a call to {@link #acquireWakeLock()}. */
|
||||||
void releaseWakeLock();
|
void releaseWakeLock();
|
||||||
|
|
||||||
/** Send the supplied intent as a stick broadcast. */
|
|
||||||
void sendStickyBroadcast(@NonNull Intent intent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Initialize the strategy. */
|
/** Initialize the strategy. */
|
||||||
|
|||||||
@@ -20,11 +20,9 @@ import android.annotation.NonNull;
|
|||||||
import android.app.AlarmManager;
|
import android.app.AlarmManager;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
import android.os.UserHandle;
|
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
|
||||||
@@ -112,11 +110,6 @@ public final class TimeDetectorStrategyCallbackImpl implements TimeDetectorStrat
|
|||||||
mWakeLock.release();
|
mWakeLock.release();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendStickyBroadcast(@NonNull Intent intent) {
|
|
||||||
mContext.sendStickyBroadcastAsUser(intent, UserHandle.ALL);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkWakeLockHeld() {
|
private void checkWakeLockHeld() {
|
||||||
if (!mWakeLock.isHeld()) {
|
if (!mWakeLock.isHeld()) {
|
||||||
Slog.wtf(TAG, "WakeLock " + mWakeLock + " not held");
|
Slog.wtf(TAG, "WakeLock " + mWakeLock + " not held");
|
||||||
|
|||||||
@@ -23,9 +23,7 @@ import android.app.AlarmManager;
|
|||||||
import android.app.timedetector.ManualTimeSuggestion;
|
import android.app.timedetector.ManualTimeSuggestion;
|
||||||
import android.app.timedetector.NetworkTimeSuggestion;
|
import android.app.timedetector.NetworkTimeSuggestion;
|
||||||
import android.app.timedetector.PhoneTimeSuggestion;
|
import android.app.timedetector.PhoneTimeSuggestion;
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.TimestampedValue;
|
import android.os.TimestampedValue;
|
||||||
import android.telephony.TelephonyManager;
|
|
||||||
import android.util.LocalLog;
|
import android.util.LocalLog;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
|
||||||
@@ -535,17 +533,6 @@ public final class TimeDetectorStrategyImpl implements TimeDetectorStrategy {
|
|||||||
} else {
|
} else {
|
||||||
mLastAutoSystemClockTimeSet = null;
|
mLastAutoSystemClockTimeSet = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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(TelephonyManager.ACTION_NETWORK_SET_TIME);
|
|
||||||
intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING);
|
|
||||||
intent.putExtra("time", newSystemClockMillis);
|
|
||||||
mCallback.sendStickyBroadcast(intent);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ package com.android.server.timedetector;
|
|||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.assertFalse;
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
import static org.junit.Assert.assertNull;
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
@@ -26,7 +25,6 @@ import static org.junit.Assert.fail;
|
|||||||
import android.app.timedetector.ManualTimeSuggestion;
|
import android.app.timedetector.ManualTimeSuggestion;
|
||||||
import android.app.timedetector.NetworkTimeSuggestion;
|
import android.app.timedetector.NetworkTimeSuggestion;
|
||||||
import android.app.timedetector.PhoneTimeSuggestion;
|
import android.app.timedetector.PhoneTimeSuggestion;
|
||||||
import android.content.Intent;
|
|
||||||
import android.icu.util.Calendar;
|
import android.icu.util.Calendar;
|
||||||
import android.icu.util.GregorianCalendar;
|
import android.icu.util.GregorianCalendar;
|
||||||
import android.icu.util.TimeZone;
|
import android.icu.util.TimeZone;
|
||||||
@@ -78,8 +76,7 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
|
|
||||||
long expectedSystemClockMillis =
|
long expectedSystemClockMillis =
|
||||||
mScript.calculateTimeInMillisForNow(timeSuggestion.getUtcTime());
|
mScript.calculateTimeInMillisForNow(timeSuggestion.getUtcTime());
|
||||||
mScript.verifySystemClockWasSetAndResetCallTracking(
|
mScript.verifySystemClockWasSetAndResetCallTracking(expectedSystemClockMillis)
|
||||||
expectedSystemClockMillis, true /* expectNetworkBroadcast */)
|
|
||||||
.assertLatestPhoneSuggestion(phoneId, timeSuggestion);
|
.assertLatestPhoneSuggestion(phoneId, timeSuggestion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,8 +115,7 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
mScript.calculateTimeInMillisForNow(timeSuggestion1.getUtcTime());
|
mScript.calculateTimeInMillisForNow(timeSuggestion1.getUtcTime());
|
||||||
|
|
||||||
mScript.simulatePhoneTimeSuggestion(timeSuggestion1)
|
mScript.simulatePhoneTimeSuggestion(timeSuggestion1)
|
||||||
.verifySystemClockWasSetAndResetCallTracking(
|
.verifySystemClockWasSetAndResetCallTracking(expectedSystemClockMillis1)
|
||||||
expectedSystemClockMillis1, true /* expectNetworkBroadcast */)
|
|
||||||
.assertLatestPhoneSuggestion(phoneId, timeSuggestion1);
|
.assertLatestPhoneSuggestion(phoneId, timeSuggestion1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,8 +142,7 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
mScript.calculateTimeInMillisForNow(timeSuggestion3.getUtcTime());
|
mScript.calculateTimeInMillisForNow(timeSuggestion3.getUtcTime());
|
||||||
|
|
||||||
mScript.simulatePhoneTimeSuggestion(timeSuggestion3)
|
mScript.simulatePhoneTimeSuggestion(timeSuggestion3)
|
||||||
.verifySystemClockWasSetAndResetCallTracking(
|
.verifySystemClockWasSetAndResetCallTracking(expectedSystemClockMillis3)
|
||||||
expectedSystemClockMillis3, true /* expectNetworkBroadcast */)
|
|
||||||
.assertLatestPhoneSuggestion(phoneId, timeSuggestion3);
|
.assertLatestPhoneSuggestion(phoneId, timeSuggestion3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,8 +170,7 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
mScript.calculateTimeInMillisForNow(phone2TimeSuggestion.getUtcTime());
|
mScript.calculateTimeInMillisForNow(phone2TimeSuggestion.getUtcTime());
|
||||||
|
|
||||||
mScript.simulatePhoneTimeSuggestion(phone2TimeSuggestion)
|
mScript.simulatePhoneTimeSuggestion(phone2TimeSuggestion)
|
||||||
.verifySystemClockWasSetAndResetCallTracking(
|
.verifySystemClockWasSetAndResetCallTracking(expectedSystemClockMillis)
|
||||||
expectedSystemClockMillis, true /* expectNetworkBroadcast */)
|
|
||||||
.assertLatestPhoneSuggestion(phone1Id, null)
|
.assertLatestPhoneSuggestion(phone1Id, null)
|
||||||
.assertLatestPhoneSuggestion(phone2Id, phone2TimeSuggestion);
|
.assertLatestPhoneSuggestion(phone2Id, phone2TimeSuggestion);
|
||||||
}
|
}
|
||||||
@@ -193,8 +187,7 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
mScript.calculateTimeInMillisForNow(phone1TimeSuggestion.getUtcTime());
|
mScript.calculateTimeInMillisForNow(phone1TimeSuggestion.getUtcTime());
|
||||||
|
|
||||||
mScript.simulatePhoneTimeSuggestion(phone1TimeSuggestion)
|
mScript.simulatePhoneTimeSuggestion(phone1TimeSuggestion)
|
||||||
.verifySystemClockWasSetAndResetCallTracking(
|
.verifySystemClockWasSetAndResetCallTracking(expectedSystemClockMillis)
|
||||||
expectedSystemClockMillis, true /* expectNetworkBroadcast */)
|
|
||||||
.assertLatestPhoneSuggestion(phone1Id, phone1TimeSuggestion);
|
.assertLatestPhoneSuggestion(phone1Id, phone1TimeSuggestion);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -227,8 +220,7 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
mScript.calculateTimeInMillisForNow(phone2TimeSuggestion.getUtcTime());
|
mScript.calculateTimeInMillisForNow(phone2TimeSuggestion.getUtcTime());
|
||||||
|
|
||||||
mScript.simulatePhoneTimeSuggestion(phone2TimeSuggestion)
|
mScript.simulatePhoneTimeSuggestion(phone2TimeSuggestion)
|
||||||
.verifySystemClockWasSetAndResetCallTracking(
|
.verifySystemClockWasSetAndResetCallTracking(expectedSystemClockMillis)
|
||||||
expectedSystemClockMillis, true /* expectNetworkBroadcast */)
|
|
||||||
.assertLatestPhoneSuggestion(phone2Id, phone2TimeSuggestion);
|
.assertLatestPhoneSuggestion(phone2Id, phone2TimeSuggestion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -265,8 +257,7 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
mScript.simulateTimePassing();
|
mScript.simulateTimePassing();
|
||||||
long expectedSystemClockMillis1 = mScript.calculateTimeInMillisForNow(utcTime1);
|
long expectedSystemClockMillis1 = mScript.calculateTimeInMillisForNow(utcTime1);
|
||||||
mScript.simulatePhoneTimeSuggestion(timeSuggestion1)
|
mScript.simulatePhoneTimeSuggestion(timeSuggestion1)
|
||||||
.verifySystemClockWasSetAndResetCallTracking(
|
.verifySystemClockWasSetAndResetCallTracking(expectedSystemClockMillis1)
|
||||||
expectedSystemClockMillis1, true /* expectNetworkBroadcast */)
|
|
||||||
.assertLatestPhoneSuggestion(phoneId, timeSuggestion1);
|
.assertLatestPhoneSuggestion(phoneId, timeSuggestion1);
|
||||||
|
|
||||||
// The UTC time increment should be larger than the system clock update threshold so we
|
// The UTC time increment should be larger than the system clock update threshold so we
|
||||||
@@ -304,8 +295,7 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
PhoneTimeSuggestion timeSuggestion4 =
|
PhoneTimeSuggestion timeSuggestion4 =
|
||||||
createPhoneTimeSuggestion(phoneId, utcTime4);
|
createPhoneTimeSuggestion(phoneId, utcTime4);
|
||||||
mScript.simulatePhoneTimeSuggestion(timeSuggestion4)
|
mScript.simulatePhoneTimeSuggestion(timeSuggestion4)
|
||||||
.verifySystemClockWasSetAndResetCallTracking(
|
.verifySystemClockWasSetAndResetCallTracking(expectedSystemClockMillis4)
|
||||||
expectedSystemClockMillis4, true /* expectNetworkBroadcast */)
|
|
||||||
.assertLatestPhoneSuggestion(phoneId, timeSuggestion4);
|
.assertLatestPhoneSuggestion(phoneId, timeSuggestion4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,8 +329,7 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
|
|
||||||
// Turn on auto time detection.
|
// Turn on auto time detection.
|
||||||
mScript.simulateAutoTimeDetectionToggle()
|
mScript.simulateAutoTimeDetectionToggle()
|
||||||
.verifySystemClockWasSetAndResetCallTracking(
|
.verifySystemClockWasSetAndResetCallTracking(expectedSystemClockMillis1)
|
||||||
expectedSystemClockMillis1, true /* expectNetworkBroadcast */)
|
|
||||||
.assertLatestPhoneSuggestion(phoneId, timeSuggestion1);
|
.assertLatestPhoneSuggestion(phoneId, timeSuggestion1);
|
||||||
|
|
||||||
// Turn off auto time detection.
|
// Turn off auto time detection.
|
||||||
@@ -367,8 +356,7 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
|
|
||||||
// Turn on auto time detection.
|
// Turn on auto time detection.
|
||||||
mScript.simulateAutoTimeDetectionToggle()
|
mScript.simulateAutoTimeDetectionToggle()
|
||||||
.verifySystemClockWasSetAndResetCallTracking(
|
.verifySystemClockWasSetAndResetCallTracking(expectedSystemClockMillis2)
|
||||||
expectedSystemClockMillis2, true /* expectNetworkBroadcast */)
|
|
||||||
.assertLatestPhoneSuggestion(phoneId, timeSuggestion2);
|
.assertLatestPhoneSuggestion(phoneId, timeSuggestion2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -388,7 +376,7 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
mScript.calculateTimeInMillisForNow(phoneSuggestion.getUtcTime());
|
mScript.calculateTimeInMillisForNow(phoneSuggestion.getUtcTime());
|
||||||
mScript.simulatePhoneTimeSuggestion(phoneSuggestion)
|
mScript.simulatePhoneTimeSuggestion(phoneSuggestion)
|
||||||
.verifySystemClockWasSetAndResetCallTracking(
|
.verifySystemClockWasSetAndResetCallTracking(
|
||||||
expectedSystemClockMillis, true /* expectedNetworkBroadcast */)
|
expectedSystemClockMillis /* expectedNetworkBroadcast */)
|
||||||
.assertLatestPhoneSuggestion(phoneId, phoneSuggestion);
|
.assertLatestPhoneSuggestion(phoneId, phoneSuggestion);
|
||||||
|
|
||||||
// Look inside and check what the strategy considers the current best phone suggestion.
|
// Look inside and check what the strategy considers the current best phone suggestion.
|
||||||
@@ -416,8 +404,7 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
long expectedSystemClockMillis =
|
long expectedSystemClockMillis =
|
||||||
mScript.calculateTimeInMillisForNow(timeSuggestion.getUtcTime());
|
mScript.calculateTimeInMillisForNow(timeSuggestion.getUtcTime());
|
||||||
mScript.simulateManualTimeSuggestion(timeSuggestion)
|
mScript.simulateManualTimeSuggestion(timeSuggestion)
|
||||||
.verifySystemClockWasSetAndResetCallTracking(
|
.verifySystemClockWasSetAndResetCallTracking(expectedSystemClockMillis);
|
||||||
expectedSystemClockMillis, false /* expectNetworkBroadcast */);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -439,8 +426,7 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
long expectedAutoClockMillis =
|
long expectedAutoClockMillis =
|
||||||
mScript.calculateTimeInMillisForNow(phoneTimeSuggestion.getUtcTime());
|
mScript.calculateTimeInMillisForNow(phoneTimeSuggestion.getUtcTime());
|
||||||
mScript.simulatePhoneTimeSuggestion(phoneTimeSuggestion)
|
mScript.simulatePhoneTimeSuggestion(phoneTimeSuggestion)
|
||||||
.verifySystemClockWasSetAndResetCallTracking(
|
.verifySystemClockWasSetAndResetCallTracking(expectedAutoClockMillis)
|
||||||
expectedAutoClockMillis, true /* expectNetworkBroadcast */)
|
|
||||||
.assertLatestPhoneSuggestion(phoneId, phoneTimeSuggestion);
|
.assertLatestPhoneSuggestion(phoneId, phoneTimeSuggestion);
|
||||||
|
|
||||||
// Simulate the passage of time.
|
// Simulate the passage of time.
|
||||||
@@ -463,8 +449,7 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
long expectedManualClockMillis =
|
long expectedManualClockMillis =
|
||||||
mScript.calculateTimeInMillisForNow(manualTimeSuggestion.getUtcTime());
|
mScript.calculateTimeInMillisForNow(manualTimeSuggestion.getUtcTime());
|
||||||
mScript.simulateManualTimeSuggestion(manualTimeSuggestion)
|
mScript.simulateManualTimeSuggestion(manualTimeSuggestion)
|
||||||
.verifySystemClockWasSetAndResetCallTracking(
|
.verifySystemClockWasSetAndResetCallTracking(expectedManualClockMillis)
|
||||||
expectedManualClockMillis, false /* expectNetworkBroadcast */)
|
|
||||||
.assertLatestPhoneSuggestion(phoneId, phoneTimeSuggestion);
|
.assertLatestPhoneSuggestion(phoneId, phoneTimeSuggestion);
|
||||||
|
|
||||||
// Simulate the passage of time.
|
// Simulate the passage of time.
|
||||||
@@ -475,8 +460,7 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
|
|
||||||
expectedAutoClockMillis =
|
expectedAutoClockMillis =
|
||||||
mScript.calculateTimeInMillisForNow(phoneTimeSuggestion.getUtcTime());
|
mScript.calculateTimeInMillisForNow(phoneTimeSuggestion.getUtcTime());
|
||||||
mScript.verifySystemClockWasSetAndResetCallTracking(
|
mScript.verifySystemClockWasSetAndResetCallTracking(expectedAutoClockMillis)
|
||||||
expectedAutoClockMillis, true /* expectNetworkBroadcast */)
|
|
||||||
.assertLatestPhoneSuggestion(phoneId, phoneTimeSuggestion);
|
.assertLatestPhoneSuggestion(phoneId, phoneTimeSuggestion);
|
||||||
|
|
||||||
// Switch back to manual - nothing should happen to the clock.
|
// Switch back to manual - nothing should happen to the clock.
|
||||||
@@ -514,8 +498,7 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
long expectedSystemClockMillis =
|
long expectedSystemClockMillis =
|
||||||
mScript.calculateTimeInMillisForNow(timeSuggestion.getUtcTime());
|
mScript.calculateTimeInMillisForNow(timeSuggestion.getUtcTime());
|
||||||
mScript.simulateNetworkTimeSuggestion(timeSuggestion)
|
mScript.simulateNetworkTimeSuggestion(timeSuggestion)
|
||||||
.verifySystemClockWasSetAndResetCallTracking(
|
.verifySystemClockWasSetAndResetCallTracking(expectedSystemClockMillis);
|
||||||
expectedSystemClockMillis, false /* expectNetworkBroadcast */);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -550,8 +533,7 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
mScript.simulateTimePassing(smallTimeIncrementMillis)
|
mScript.simulateTimePassing(smallTimeIncrementMillis)
|
||||||
.simulateNetworkTimeSuggestion(networkTimeSuggestion1)
|
.simulateNetworkTimeSuggestion(networkTimeSuggestion1)
|
||||||
.verifySystemClockWasSetAndResetCallTracking(
|
.verifySystemClockWasSetAndResetCallTracking(
|
||||||
mScript.calculateTimeInMillisForNow(networkTimeSuggestion1.getUtcTime()),
|
mScript.calculateTimeInMillisForNow(networkTimeSuggestion1.getUtcTime()));
|
||||||
false /* expectNetworkBroadcast */);
|
|
||||||
|
|
||||||
// Check internal state.
|
// Check internal state.
|
||||||
mScript.assertLatestPhoneSuggestion(ARBITRARY_PHONE_ID, null)
|
mScript.assertLatestPhoneSuggestion(ARBITRARY_PHONE_ID, null)
|
||||||
@@ -570,8 +552,7 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
mScript.simulateTimePassing(smallTimeIncrementMillis)
|
mScript.simulateTimePassing(smallTimeIncrementMillis)
|
||||||
.simulatePhoneTimeSuggestion(phoneTimeSuggestion)
|
.simulatePhoneTimeSuggestion(phoneTimeSuggestion)
|
||||||
.verifySystemClockWasSetAndResetCallTracking(
|
.verifySystemClockWasSetAndResetCallTracking(
|
||||||
mScript.calculateTimeInMillisForNow(phoneTimeSuggestion.getUtcTime()),
|
mScript.calculateTimeInMillisForNow(phoneTimeSuggestion.getUtcTime()));
|
||||||
true /* expectNetworkBroadcast */);
|
|
||||||
|
|
||||||
// Check internal state.
|
// Check internal state.
|
||||||
mScript.assertLatestPhoneSuggestion(ARBITRARY_PHONE_ID, phoneTimeSuggestion)
|
mScript.assertLatestPhoneSuggestion(ARBITRARY_PHONE_ID, phoneTimeSuggestion)
|
||||||
@@ -622,8 +603,7 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
|
|
||||||
// Verify the latest network time now wins.
|
// Verify the latest network time now wins.
|
||||||
mScript.verifySystemClockWasSetAndResetCallTracking(
|
mScript.verifySystemClockWasSetAndResetCallTracking(
|
||||||
mScript.calculateTimeInMillisForNow(networkTimeSuggestion2.getUtcTime()),
|
mScript.calculateTimeInMillisForNow(networkTimeSuggestion2.getUtcTime()));
|
||||||
false /* expectNetworkTimeBroadcast */);
|
|
||||||
|
|
||||||
// Check internal state.
|
// Check internal state.
|
||||||
mScript.assertLatestPhoneSuggestion(ARBITRARY_PHONE_ID, phoneTimeSuggestion)
|
mScript.assertLatestPhoneSuggestion(ARBITRARY_PHONE_ID, phoneTimeSuggestion)
|
||||||
@@ -645,7 +625,6 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
|
|
||||||
// Tracking operations.
|
// Tracking operations.
|
||||||
private boolean mSystemClockWasSet;
|
private boolean mSystemClockWasSet;
|
||||||
private Intent mBroadcastSent;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int systemClockUpdateThresholdMillis() {
|
public int systemClockUpdateThresholdMillis() {
|
||||||
@@ -689,12 +668,6 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
mWakeLockAcquired = false;
|
mWakeLockAcquired = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendStickyBroadcast(Intent intent) {
|
|
||||||
assertNotNull(intent);
|
|
||||||
mBroadcastSent = intent;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Methods below are for managing the fake's behavior.
|
// Methods below are for managing the fake's behavior.
|
||||||
|
|
||||||
void pokeSystemClockUpdateThreshold(int thresholdMillis) {
|
void pokeSystemClockUpdateThreshold(int thresholdMillis) {
|
||||||
@@ -739,17 +712,8 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
assertEquals(expectedSystemClockMillis, mSystemClockMillis);
|
assertEquals(expectedSystemClockMillis, mSystemClockMillis);
|
||||||
}
|
}
|
||||||
|
|
||||||
void verifyIntentWasBroadcast() {
|
|
||||||
assertTrue(mBroadcastSent != null);
|
|
||||||
}
|
|
||||||
|
|
||||||
void verifyIntentWasNotBroadcast() {
|
|
||||||
assertNull(mBroadcastSent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void resetCallTracking() {
|
void resetCallTracking() {
|
||||||
mSystemClockWasSet = false;
|
mSystemClockWasSet = false;
|
||||||
mBroadcastSent = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertWakeLockAcquired() {
|
private void assertWakeLockAcquired() {
|
||||||
@@ -832,17 +796,12 @@ public class TimeDetectorStrategyImplTest {
|
|||||||
|
|
||||||
Script verifySystemClockWasNotSetAndResetCallTracking() {
|
Script verifySystemClockWasNotSetAndResetCallTracking() {
|
||||||
mFakeCallback.verifySystemClockNotSet();
|
mFakeCallback.verifySystemClockNotSet();
|
||||||
mFakeCallback.verifyIntentWasNotBroadcast();
|
|
||||||
mFakeCallback.resetCallTracking();
|
mFakeCallback.resetCallTracking();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Script verifySystemClockWasSetAndResetCallTracking(
|
Script verifySystemClockWasSetAndResetCallTracking(long expectedSystemClockMillis) {
|
||||||
long expectedSystemClockMillis, boolean expectNetworkBroadcast) {
|
|
||||||
mFakeCallback.verifySystemClockWasSet(expectedSystemClockMillis);
|
mFakeCallback.verifySystemClockWasSet(expectedSystemClockMillis);
|
||||||
if (expectNetworkBroadcast) {
|
|
||||||
mFakeCallback.verifyIntentWasBroadcast();
|
|
||||||
}
|
|
||||||
mFakeCallback.resetCallTracking();
|
mFakeCallback.resetCallTracking();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1436,25 +1436,6 @@ public class TelephonyManager {
|
|||||||
public static final String EXTRA_SIM_COMBINATION_NAMES =
|
public static final String EXTRA_SIM_COMBINATION_NAMES =
|
||||||
"android.telephony.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
|
// Device Info
|
||||||
|
|||||||
Reference in New Issue
Block a user