summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author TreeHugger Robot <treehugger-gerrit@google.com> 2017-10-30 15:56:38 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2017-10-30 15:56:38 +0000
commitfb7da9442886594e79088e7f395f47da8d6982b8 (patch)
treed65cc5e0fbfca794316d01526861ff541b8a8a33
parent34d4130fd492e5b8f42d9a9e5e7574f6f951b9b3 (diff)
parent51e29da65e1872745a185284556f4947463ec07d (diff)
Merge "Improvements on autofill debugging."
-rw-r--r--core/java/android/view/autofill/AutofillManager.java29
-rw-r--r--core/java/android/view/autofill/IAutoFillManagerClient.aidl2
-rw-r--r--services/autofill/java/com/android/server/autofill/AutofillManagerService.java1
-rw-r--r--services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java18
4 files changed, 41 insertions, 9 deletions
diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java
index e79d201be2c5..6a0669b022f7 100644
--- a/core/java/android/view/autofill/AutofillManager.java
+++ b/core/java/android/view/autofill/AutofillManager.java
@@ -1272,18 +1272,32 @@ public final class AutofillManager {
}
}
- private void setState(boolean enabled, boolean resetSession, boolean resetClient) {
+ /** @hide */
+ public static final int SET_STATE_FLAG_ENABLED = 0x01;
+ /** @hide */
+ public static final int SET_STATE_FLAG_RESET_SESSION = 0x02;
+ /** @hide */
+ public static final int SET_STATE_FLAG_RESET_CLIENT = 0x04;
+ /** @hide */
+ public static final int SET_STATE_FLAG_DEBUG = 0x08;
+ /** @hide */
+ public static final int SET_STATE_FLAG_VERBOSE = 0x10;
+
+ private void setState(int flags) {
+ if (sVerbose) Log.v(TAG, "setState(" + flags + ")");
synchronized (mLock) {
- mEnabled = enabled;
- if (!mEnabled || resetSession) {
+ mEnabled = (flags & SET_STATE_FLAG_ENABLED) != 0;
+ if (!mEnabled || (flags & SET_STATE_FLAG_RESET_SESSION) != 0) {
// Reset the session state
resetSessionLocked();
}
- if (resetClient) {
+ if ((flags & SET_STATE_FLAG_RESET_CLIENT) != 0) {
// Reset connection to system
mServiceClient = null;
}
}
+ sDebug = (flags & SET_STATE_FLAG_DEBUG) != 0;
+ sVerbose = (flags & SET_STATE_FLAG_VERBOSE) != 0;
}
/**
@@ -1609,6 +1623,7 @@ public final class AutofillManager {
pw.print(pfx); pw.print("sessionId: "); pw.println(mSessionId);
pw.print(pfx); pw.print("state: "); pw.println(getStateAsStringLocked());
pw.print(pfx); pw.print("context: "); pw.println(mContext);
+ pw.print(pfx); pw.print("client: "); pw.println(getClientLocked());
pw.print(pfx); pw.print("enabled: "); pw.println(mEnabled);
pw.print(pfx); pw.print("hasService: "); pw.println(mService != null);
pw.print(pfx); pw.print("hasCallback: "); pw.println(mCallback != null);
@@ -1625,6 +1640,8 @@ public final class AutofillManager {
pw.print(pfx); pw.print("fillable ids: "); pw.println(mFillableIds);
pw.print(pfx); pw.print("save trigger id: "); pw.println(mSaveTriggerId);
pw.print(pfx); pw.print("save on finish(): "); pw.println(mSaveOnFinish);
+ pw.print(pfx); pw.print("debug: "); pw.print(sDebug);
+ pw.print(" verbose: "); pw.println(sVerbose);
}
private String getStateAsStringLocked() {
@@ -1940,10 +1957,10 @@ public final class AutofillManager {
}
@Override
- public void setState(boolean enabled, boolean resetSession, boolean resetClient) {
+ public void setState(int flags) {
final AutofillManager afm = mAfm.get();
if (afm != null) {
- afm.post(() -> afm.setState(enabled, resetSession, resetClient));
+ afm.post(() -> afm.setState(flags));
}
}
diff --git a/core/java/android/view/autofill/IAutoFillManagerClient.aidl b/core/java/android/view/autofill/IAutoFillManagerClient.aidl
index 368c02907bf3..254c8a5ac20c 100644
--- a/core/java/android/view/autofill/IAutoFillManagerClient.aidl
+++ b/core/java/android/view/autofill/IAutoFillManagerClient.aidl
@@ -35,7 +35,7 @@ oneway interface IAutoFillManagerClient {
/**
* Notifies the client when the autofill enabled state changed.
*/
- void setState(boolean enabled, boolean resetSession, boolean resetClient);
+ void setState(int flags);
/**
* Autofills the activity with the contents of a dataset.
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
index 6c3eb200ef3d..caff0ba9bea2 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
@@ -447,7 +447,6 @@ public final class AutofillManagerService extends SystemService {
android.view.autofill.Helper.sDebug = debug;
}
-
private void setVerboseLocked(boolean verbose) {
com.android.server.autofill.Helper.sVerbose = verbose;
android.view.autofill.Helper.sVerbose = verbose;
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
index 2ed5eeee89dd..d8eaccc13532 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
@@ -813,7 +813,23 @@ final class AutofillManagerServiceImpl {
synchronized (mLock) {
resetSession = resetClient || isClientSessionDestroyedLocked(client);
}
- client.setState(isEnabled(), resetSession, resetClient);
+ int flags = 0;
+ if (isEnabled()) {
+ flags |= AutofillManager.SET_STATE_FLAG_ENABLED;
+ }
+ if (resetSession) {
+ flags |= AutofillManager.SET_STATE_FLAG_RESET_SESSION;
+ }
+ if (resetClient) {
+ flags |= AutofillManager.SET_STATE_FLAG_RESET_CLIENT;
+ }
+ if (sDebug) {
+ flags |= AutofillManager.SET_STATE_FLAG_DEBUG;
+ }
+ if (sVerbose) {
+ flags |= AutofillManager.SET_STATE_FLAG_VERBOSE;
+ }
+ client.setState(flags);
} catch (RemoteException re) {
/* ignore */
}