summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Joanne <joannechung@google.com> 2022-08-13 00:07:06 +0800
committer Joanne <joannechung@google.com> 2022-08-18 22:00:14 +0800
commitd21d3ddfef460635d10c6f7678b48f6920c34cd9 (patch)
tree19cf5b66d9b18e3c635dca018326de7cdc1a15c5
parentbcdc02173eb62685206dff32dc92011eeda1e3cf (diff)
Fix InlineSuggestionRenderService service connection leakage
The system reset the remote InlineRenderService and binds service when updateLocked() is called but the system doesn’t unbind it. The updatedLocked() will be called in many conditions like service change, autofill device config change, etc. These behaviors will occur during the test that causes the connection to increase more and more. To fix the issue, we don't reset the remote InlineRenderService and only bind the service if it doesn't be set yet and unbind it after per user service implementation destroyed. Bug: 242097472 Test: run cts and run command “dumpsys activity services com.google.android.ext.services”. The connection is the same after CTS is done. Test: atest android.autofillservice.cts.inline Test: atest android.autofillservice.cts.dropdown Test: manul. Test some top apps, the inline still works. Test: manual. Test with test app, the dropdown still works. Change-Id: Ia51ef58b1cc1926385c501c34bd756f7c223b313
-rw-r--r--services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java20
1 files changed, 6 insertions, 14 deletions
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
index fe85db286fa8..5a35474207f7 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
@@ -231,7 +231,7 @@ final class AutofillManagerServiceImpl
sendStateToClients(/* resetClient= */ false);
}
updateRemoteAugmentedAutofillService();
- updateRemoteInlineSuggestionRenderServiceLocked();
+ getRemoteInlineSuggestionRenderServiceLocked();
return enabledChanged;
}
@@ -685,8 +685,12 @@ final class AutofillManagerServiceImpl
@GuardedBy("mLock")
void resetExtServiceLocked() {
- if (sVerbose) Slog.v(TAG, "reset autofill service.");
+ if (sVerbose) Slog.v(TAG, "reset autofill service in ExtServices.");
mFieldClassificationStrategy.reset();
+ if (mRemoteInlineSuggestionRenderService != null) {
+ mRemoteInlineSuggestionRenderService.destroy();
+ mRemoteInlineSuggestionRenderService = null;
+ }
}
@GuardedBy("mLock")
@@ -1583,18 +1587,6 @@ final class AutofillManagerServiceImpl
return mFieldClassificationStrategy.getDefaultAlgorithm();
}
- private void updateRemoteInlineSuggestionRenderServiceLocked() {
- if (mRemoteInlineSuggestionRenderService != null) {
- if (sVerbose) {
- Slog.v(TAG, "updateRemoteInlineSuggestionRenderService(): "
- + "destroying old remote service");
- }
- mRemoteInlineSuggestionRenderService = null;
- }
-
- mRemoteInlineSuggestionRenderService = getRemoteInlineSuggestionRenderServiceLocked();
- }
-
@Nullable RemoteInlineSuggestionRenderService getRemoteInlineSuggestionRenderServiceLocked() {
if (mRemoteInlineSuggestionRenderService == null) {
final ComponentName componentName = RemoteInlineSuggestionRenderService