Fix a few view ctors to not call Looper.myLooper
Bug: 25116730
Change-Id: I4e394c281feef6f7987433298d66f2df11352416
diff --git a/core/java/android/widget/Chronometer.java b/core/java/android/widget/Chronometer.java
index ebb54ff..4d707e3 100644
--- a/core/java/android/widget/Chronometer.java
+++ b/core/java/android/widget/Chronometer.java
@@ -73,8 +73,6 @@
private OnChronometerTickListener mOnChronometerTickListener;
private StringBuilder mRecycle = new StringBuilder(8);
- private static final int TICK_WHAT = 2;
-
/**
* Initialize this Chronometer object.
* Sets the base to the current time.
@@ -259,20 +257,21 @@
if (running) {
updateText(SystemClock.elapsedRealtime());
dispatchChronometerTick();
- mHandler.sendMessageDelayed(Message.obtain(mHandler, TICK_WHAT), 1000);
+ postDelayed(mTickRunnable, 1000);
} else {
- mHandler.removeMessages(TICK_WHAT);
+ removeCallbacks(mTickRunnable);
}
mRunning = running;
}
}
-
- private Handler mHandler = new Handler() {
- public void handleMessage(Message m) {
+
+ private final Runnable mTickRunnable = new Runnable() {
+ @Override
+ public void run() {
if (mRunning) {
updateText(SystemClock.elapsedRealtime());
dispatchChronometerTick();
- sendMessageDelayed(Message.obtain(this, TICK_WHAT), 1000);
+ postDelayed(mTickRunnable, 1000);
}
}
};