From 0527d9129d889a1947ab6a18ad6c5b9d5adce2da Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Wed, 16 May 2018 17:23:48 -0700 Subject: [PATCH] Adde back check to make sure Activity.recreate() is called on main thread. Change-Id: Id8fa7e1c17ee3d42a19c82dc8cc1fec2de1757d1 Fixes: 79703568 Test: Existing test pass. --- core/java/android/app/Activity.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 3b62bd7cb0572..057e796a099ef 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -5578,6 +5578,9 @@ public class Activity extends ContextThemeWrapper if (mParent != null) { throw new IllegalStateException("Can only be called on top-level activity"); } + if (Looper.myLooper() != mMainThread.getLooper()) { + throw new IllegalStateException("Must be called from main thread"); + } mMainThread.scheduleRelaunchActivity(mToken); }