diff options
| author | Eugene Susla <eugenesusla@google.com> | 2017-08-07 17:25:30 -0700 |
|---|---|---|
| committer | Eugene Susla <eugenesusla@google.com> | 2017-08-31 13:03:23 -0700 |
| commit | 4f8680bb778d35b7440f927f03c1c372d0770e88 (patch) | |
| tree | 7bccaa4604e3cbf1bbd20ed6f81e513c83fd96dc /core/java/android/util/ExceptionUtils.java | |
| parent | 44bc284d96eb551117564ca004a6f2f7bc6aeddd (diff) | |
MagnificationGestureHandler refactoring and unit test
This is aimed at making MagnificationGestureHandler easier to understand
and reason about
Test: provided unit test + manual magnification test
Change-Id: I958ef0bdd2e6f857a2fab24962b1a06480685732
Diffstat (limited to 'core/java/android/util/ExceptionUtils.java')
| -rw-r--r-- | core/java/android/util/ExceptionUtils.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/java/android/util/ExceptionUtils.java b/core/java/android/util/ExceptionUtils.java index 44019c32560d..da7387fcae70 100644 --- a/core/java/android/util/ExceptionUtils.java +++ b/core/java/android/util/ExceptionUtils.java @@ -78,4 +78,12 @@ public class ExceptionUtils { propagateIfInstanceOf(t, RuntimeException.class); throw new RuntimeException(t); } + + /** + * Gets the root {@link Throwable#getCause() cause} of {@code t} + */ + public static @NonNull Throwable getRootCause(@NonNull Throwable t) { + while (t.getCause() != null) t = t.getCause(); + return t; + } } |
