method public boolean isPopupShowing();
}
+ public class TextClock extends android.widget.TextView {
+ method public void disableClockTick();
+ }
+
public class TimePicker extends android.widget.FrameLayout {
method public android.view.View getAmView();
method public android.view.View getHourView();
import static android.widget.RemoteViews.RemoteView;
import android.annotation.NonNull;
+import android.annotation.TestApi;
import android.app.ActivityManager;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
private boolean mShowCurrentUserTime;
private ContentObserver mFormatChangeObserver;
+ // Used by tests to stop time change events from triggering the text update
+ private boolean mStopTicking;
+
private class FormatChangeObserver extends ContentObserver {
public FormatChangeObserver(Handler handler) {
private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
+ if (mStopTicking) {
+ return; // Test disabled the clock ticks
+ }
if (mTimeZone == null && Intent.ACTION_TIMEZONE_CHANGED.equals(intent.getAction())) {
final String timeZone = intent.getStringExtra("time-zone");
createTime(timeZone);
private final Runnable mTicker = new Runnable() {
public void run() {
+ if (mStopTicking) {
+ return; // Test disabled the clock ticks
+ }
onTimeChanged();
long now = SystemClock.uptimeMillis();
}
}
+ /**
+ * Used by tests to stop the clock tick from updating the text.
+ * @hide
+ */
+ @TestApi
+ public void disableClockTick() {
+ mStopTicking = true;
+ }
+
private void registerReceiver() {
final IntentFilter filter = new IntentFilter();