summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Felipe Leme <felipeal@google.com> 2017-10-09 17:59:41 -0700
committer Felipe Leme <felipeal@google.com> 2017-10-09 18:18:11 -0700
commit40a1db725f2cf9fac2a2d9248bfd1c46198cea40 (patch)
tree45f949458b3ac2bfb78005ebf62dd7097251bc41
parent9eb155567d911516ed23bad643b47486d6cc6fcd (diff)
Disable autofill service when new service from Settings is invalid.
Test: cts-tradefed run commandAndExit cts-dev -m CtsAutoFillServiceTestCases -t android.autofillservice.cts.LoginActivityTest#testServiceIsDisabledWhenNewServiceInfoIsInvalid Test: cts-tradefed run commandAndExit cts-dev -m CtsAutoFillServiceTestCases -t android.autofillservice.cts.LoginActivityTest#testServiceIsDisabledWhenNewServiceNameIsInvalid Test: cts-tradefed run commandAndExit cts-dev -m CtsAutoFillServiceTestCases Bug: 67496182 Change-Id: I2ee2b0ff125434feb18e539a07b64b83d390291f
-rw-r--r--services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java34
1 files changed, 20 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 862070adbeee..880f236cbe76 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
@@ -216,9 +216,12 @@ final class AutofillManagerServiceImpl {
serviceComponent = ComponentName.unflattenFromString(componentName);
serviceInfo = AppGlobals.getPackageManager().getServiceInfo(serviceComponent,
0, mUserId);
+ if (serviceInfo == null) {
+ Slog.e(TAG, "Bad AutofillService name: " + componentName);
+ }
} catch (RuntimeException | RemoteException e) {
- Slog.e(TAG, "Bad autofill service name " + componentName + ": " + e);
- return;
+ Slog.e(TAG, "Error getting service info for '" + componentName + "': " + e);
+ serviceInfo = null;
}
}
try {
@@ -228,21 +231,24 @@ final class AutofillManagerServiceImpl {
if (sDebug) Slog.d(TAG, "Set component for user " + mUserId + " as " + mInfo);
} else {
mInfo = null;
- if (sDebug) Slog.d(TAG, "Reset component for user " + mUserId);
- }
- final boolean isEnabled = isEnabled();
- if (wasEnabled != isEnabled) {
- if (!isEnabled) {
- final int sessionCount = mSessions.size();
- for (int i = sessionCount - 1; i >= 0; i--) {
- final Session session = mSessions.valueAt(i);
- session.removeSelfLocked();
- }
+ if (sDebug) {
+ Slog.d(TAG, "Reset component for user " + mUserId + " (" + componentName + ")");
}
- sendStateToClients(false);
}
} catch (Exception e) {
- Slog.e(TAG, "Bad AutofillService '" + componentName + "': " + e);
+ Slog.e(TAG, "Bad AutofillServiceInfo for '" + componentName + "': " + e);
+ mInfo = null;
+ }
+ final boolean isEnabled = isEnabled();
+ if (wasEnabled != isEnabled) {
+ if (!isEnabled) {
+ final int sessionCount = mSessions.size();
+ for (int i = sessionCount - 1; i >= 0; i--) {
+ final Session session = mSessions.valueAt(i);
+ session.removeSelfLocked();
+ }
+ }
+ sendStateToClients(false);
}
}