diff options
| author | 2019-08-13 21:17:53 +0800 | |
|---|---|---|
| committer | 2019-08-16 06:07:36 +0000 | |
| commit | abdf48509ae74fa9e16e9e8f9c525b10c282b3ea (patch) | |
| tree | a631a39e5613873c73dc70b8509b0796fd8f927d | |
| parent | 163976025250dc8a546ba19347bfcedd7b0b8ae2 (diff) | |
Protected the null pointer causes cts failed
The current view id is set upon entering and reset to null upon exiting.
The mAssistReceiver may callback after the view exit which caused NPE. To
prevent the symptom, the callback should do nothing when the current view
id is null.
Fixes: 139314597
Fixes: 139349645
Fixes: 139355625
Fixes: 139360077
Test: atest CtsAutoFillServiceTestCases
Test: atest CtsAccessibilityServiceTestCases
Test: atest CtsInputMethodTestCases
Test: atest CtsWidgetTestCases:ToolbarTest
Change-Id: Idbf3c4a24de5547169f905529970e5af795807c2
| -rw-r--r-- | services/autofill/java/com/android/server/autofill/Session.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index 46c2a85d0691..6e8d199d593f 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -301,6 +301,11 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState + "mForAugmentedAutofillOnly: %s", mForAugmentedAutofillOnly); return; } + if (mCurrentViewId == null) { + Slog.w(TAG, "No current view id - session might have finished"); + return; + } + final AssistStructure structure = resultData.getParcelable(ASSIST_KEY_STRUCTURE); if (structure == null) { Slog.e(TAG, "No assist structure - app might have crashed providing it"); |