diff options
author | Kristian Monsen <kristianm@google.com> | 2013-01-18 14:50:07 -0800 |
---|---|---|
committer | Kristian Monsen <kristianm@google.com> | 2013-01-18 14:50:07 -0800 |
commit | 0a30328c10367f57834d7e8597832b6af00f5240 (patch) | |
tree | 14c96a7ebd9f7d21abbfadb106a51ab90fa63bb6 /tests/BrowserPowerTest | |
parent | ebf7c74361baefb826591bd90cdacd9244a2eb59 (diff) | |
download | frameworks_base-0a30328c10367f57834d7e8597832b6af00f5240.zip frameworks_base-0a30328c10367f57834d7e8597832b6af00f5240.tar.gz frameworks_base-0a30328c10367f57834d7e8597832b6af00f5240.tar.bz2 |
Better detecting if current threasd is main thread
Old approach got broken after:
https://googleplex-android-review.googlesource.com/#/c/266421/2
Change-Id: I12ae23efdbaebd8ba24acb1b7eff75c912d24f1d
Diffstat (limited to 'tests/BrowserPowerTest')
-rw-r--r-- | tests/BrowserPowerTest/src/com/android/browserpowertest/PowerTestActivity.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerTestActivity.java b/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerTestActivity.java index 1b72486..ab60f21 100644 --- a/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerTestActivity.java +++ b/tests/BrowserPowerTest/src/com/android/browserpowertest/PowerTestActivity.java @@ -21,6 +21,7 @@ import android.app.ActivityThread; import android.graphics.Bitmap; import android.os.Bundle; import android.os.Handler; +import android.os.Looper; import android.os.Message; import android.util.Log; import android.view.ViewGroup; @@ -180,7 +181,7 @@ public class PowerTestActivity extends Activity { } private final void validateNotAppThread() { - if (ActivityThread.currentActivityThread() != null) { + if (Looper.myLooper() == Looper.getMainLooper()) { throw new RuntimeException( "This method can not be called from the main application thread"); } |