Loading core/java/android/app/Application.java +15 −5 Original line number Diff line number Diff line Loading @@ -616,9 +616,8 @@ public class Application extends ContextWrapper implements ComponentCallbacks2 { Log.v(TAG, "getAutofillClient(): null on super, trying to find activity thread"); } // Okay, ppl use the application context when they should not. This breaks // autofill among other things. We pick the focused activity since autofill // interacts only with the currently focused activity and we need the fill // client only if a call comes from the focused activity. Sigh... // autofill among other things. Below is a mitigation to find the top resumed // activity. final ActivityThread activityThread = ActivityThread.currentActivityThread(); if (activityThread == null) { return null; Loading @@ -634,16 +633,27 @@ public class Application extends ContextWrapper implements ComponentCallbacks2 { if (activity == null) { continue; } if (record.isTopResumedActivity) { if (android.view.autofill.Helper.sVerbose) { Log.v(TAG, "getAutofillClient(): found top resumed activity for " + this + ": " + activity); } return activity.getAutofillClient(); } // As a back up option, we pick the focused activity since autofill interacts only // with the currently focused activity and we need the fill client only if a call // comes from the focused activity. if (activity.getWindow().getDecorView().hasFocus()) { if (android.view.autofill.Helper.sVerbose) { Log.v(TAG, "getAutofillClient(): found activity for " + this + ": " + activity); Log.v(TAG, "getAutofillClient(): found focused activity for " + this + ": " + activity); } return activity.getAutofillClient(); } } if (android.view.autofill.Helper.sVerbose) { Log.v(TAG, "getAutofillClient(): none of the " + activityCount + " activities on " + this + " have focus"); + this + " are top resumed nor have focus"); } return null; } Loading Loading
core/java/android/app/Application.java +15 −5 Original line number Diff line number Diff line Loading @@ -616,9 +616,8 @@ public class Application extends ContextWrapper implements ComponentCallbacks2 { Log.v(TAG, "getAutofillClient(): null on super, trying to find activity thread"); } // Okay, ppl use the application context when they should not. This breaks // autofill among other things. We pick the focused activity since autofill // interacts only with the currently focused activity and we need the fill // client only if a call comes from the focused activity. Sigh... // autofill among other things. Below is a mitigation to find the top resumed // activity. final ActivityThread activityThread = ActivityThread.currentActivityThread(); if (activityThread == null) { return null; Loading @@ -634,16 +633,27 @@ public class Application extends ContextWrapper implements ComponentCallbacks2 { if (activity == null) { continue; } if (record.isTopResumedActivity) { if (android.view.autofill.Helper.sVerbose) { Log.v(TAG, "getAutofillClient(): found top resumed activity for " + this + ": " + activity); } return activity.getAutofillClient(); } // As a back up option, we pick the focused activity since autofill interacts only // with the currently focused activity and we need the fill client only if a call // comes from the focused activity. if (activity.getWindow().getDecorView().hasFocus()) { if (android.view.autofill.Helper.sVerbose) { Log.v(TAG, "getAutofillClient(): found activity for " + this + ": " + activity); Log.v(TAG, "getAutofillClient(): found focused activity for " + this + ": " + activity); } return activity.getAutofillClient(); } } if (android.view.autofill.Helper.sVerbose) { Log.v(TAG, "getAutofillClient(): none of the " + activityCount + " activities on " + this + " have focus"); + this + " are top resumed nor have focus"); } return null; } Loading