From d247de85bb7d36ff5d3d232d6d4d2d3d1eeedec2 Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Mon, 14 May 2018 17:51:58 -0700 Subject: [PATCH] Don't call setAutofillClient() on base Context if it's null. Test: atest CtsAutoFillServiceTestCases Test: changed activity on autofill sample to override attachBaseContext() by calling super.attachBaseContext(null) - the activity still crashes, but not on attachBaseContext(). Fixes: 79707861 Change-Id: Idfaa9c596cc338ab815441138ce06ba64cd3b4d2 --- core/java/android/app/Activity.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 3b62bd7cb0572..7b383d452dbdc 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -979,7 +979,9 @@ public class Activity extends ContextThemeWrapper @Override protected void attachBaseContext(Context newBase) { super.attachBaseContext(newBase); - newBase.setAutofillClient(this); + if (newBase != null) { + newBase.setAutofillClient(this); + } } /** @hide */