Loading services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +3 −2 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ import android.service.autofill.FillEventHistory; import android.service.autofill.FillEventHistory.Event; import android.service.autofill.FillResponse; import android.service.autofill.IAutoFillService; import android.service.autofill.SaveInfo; import android.service.autofill.UserData; import android.util.ArrayMap; import android.util.ArraySet; Loading Loading @@ -595,8 +596,8 @@ final class AutofillManagerServiceImpl ArrayList<Session> previousSessions = null; for (int i = 0; i < size; i++) { final Session previousSession = mSessions.valueAt(i); // TODO(b/113281366): only return sessions asked to be kept alive / add CTS test if (previousSession.taskId == session.taskId && previousSession.id != session.id) { if (previousSession.taskId == session.taskId && previousSession.id != session.id && (previousSession.getSaveInfoFlagsLocked() & SaveInfo.FLAG_DELAY_SAVE) != 0) { if (previousSessions == null) { previousSessions = new ArrayList<>(size); } Loading services/autofill/java/com/android/server/autofill/Session.java +28 −18 Original line number Diff line number Diff line Loading @@ -1203,9 +1203,12 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState @GuardedBy("mLock") @Nullable private FillResponse getLastResponseLocked(@Nullable String logPrefix) { private FillResponse getLastResponseLocked(@Nullable String logPrefixFmt) { final String logPrefix = sDebug && logPrefixFmt != null ? String.format(logPrefixFmt, this.id) : null; if (mContexts == null) { if (sDebug && logPrefix != null) Slog.d(TAG, logPrefix + ": no contexts"); if (logPrefix != null) Slog.d(TAG, logPrefix + ": no contexts"); return null; } if (mResponses == null) { Loading Loading @@ -1241,6 +1244,12 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState return response == null ? null : response.getSaveInfo(); } @GuardedBy("mLock") int getSaveInfoFlagsLocked() { final SaveInfo saveInfo = getSaveInfoLocked(); return saveInfo == null ? 0 : saveInfo.getFlags(); } /** * Generates a {@link android.service.autofill.FillEventHistory.Event#TYPE_CONTEXT_COMMITTED} * when necessary. Loading @@ -1252,7 +1261,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState private void handleLogContextCommitted() { final FillResponse lastResponse; synchronized (mLock) { lastResponse = getLastResponseLocked("logContextCommited()"); lastResponse = getLastResponseLocked("logContextCommited(%s)"); } if (lastResponse == null) { Loading Loading @@ -1295,7 +1304,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState @GuardedBy("mLock") private void logContextCommittedLocked(@Nullable ArrayList<AutofillId> detectedFieldIds, @Nullable ArrayList<FieldClassification> detectedFieldClassifications) { final FillResponse lastResponse = getLastResponseLocked("logContextCommited()"); final FillResponse lastResponse = getLastResponseLocked("logContextCommited(%s)"); if (lastResponse == null) return; final int flags = lastResponse.getFlags(); Loading Loading @@ -1610,7 +1619,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState + id + " destroyed"); return false; } final FillResponse response = getLastResponseLocked("showSaveLocked()"); final FillResponse response = getLastResponseLocked("showSaveLocked(%s)"); final SaveInfo saveInfo = response == null ? null : response.getSaveInfo(); /* Loading @@ -1624,13 +1633,13 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState * - server didn't ask to keep session alive */ if (saveInfo == null) { if (sVerbose) Slog.v(TAG, "showSaveLocked(): no saveInfo from service"); if (sVerbose) Slog.v(TAG, "showSaveLocked(" + this.id + "): no saveInfo from service"); return true; } if ((saveInfo.getFlags() & SaveInfo.FLAG_DELAY_SAVE) != 0) { // TODO(b/113281366): log metrics if (sDebug) Slog.v(TAG, "showSaveLocked(): service asked to delay save"); if (sDebug) Slog.v(TAG, "showSaveLocked(" + this.id + "): service asked to delay save"); return false; } Loading Loading @@ -1962,7 +1971,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState if (node != null) { final AutofillValue value = node.getAutofillValue(); if (sDebug) { Slog.d(TAG, "getValueFromContexts(" + autofillId + ") at " + i + ": " + value); Slog.d(TAG, "getValueFromContexts(" + this.id + "/" + autofillId + ") at " + i + ": " + value); } if (value != null && !value.isEmpty()) { return value; Loading Loading @@ -2066,7 +2076,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState return; } if (sVerbose) Slog.v(TAG, "callSaveLocked(): mViewStates=" + mViewStates); if (sVerbose) Slog.v(TAG, "callSaveLocked(" + this.id + "): mViewStates=" + mViewStates); if (mContexts == null) { Slog.w(TAG, "callSaveLocked(): no contexts"); Loading Loading @@ -2109,15 +2119,15 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState final ArrayList<FillContext> contexts; if (previousSessions != null) { if (sDebug) { Slog.d(TAG, "mergeSessions(): Merging the content of " + previousSessions.size() + " sessions for task " + taskId); Slog.d(TAG, "mergeSessions(" + this.id + "): Merging the content of " + previousSessions.size() + " sessions for task " + taskId); } contexts = new ArrayList<>(); for (int i = 0; i < previousSessions.size(); i++) { final Session previousSession = previousSessions.get(i); final ArrayList<FillContext> previousContexts = previousSession.mContexts; if (previousContexts == null) { Slog.w(TAG, "mergeSessions(): Not merging null contexts from " Slog.w(TAG, "mergeSessions(" + this.id + "): Not merging null contexts from " + previousSession.id); continue; } Loading @@ -2125,14 +2135,14 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState previousSession.updateValuesForSaveLocked(); } if (sDebug) { Slog.d(TAG, "mergeSessions(): adding " + previousContexts.size() Slog.d(TAG, "mergeSessions(" + this.id + "): adding " + previousContexts.size() + " context from previous session #" + previousSession.id); } contexts.addAll(previousContexts); if (mClientState == null && previousSession.mClientState != null) { if (sDebug) { Slog.d(TAG, "mergeSessions(): setting client state from previous session" + previousSession.id); Slog.d(TAG, "mergeSessions(" + this.id + "): setting client state from " + "previous session" + previousSession.id); } mClientState = previousSession.mClientState; } Loading Loading @@ -2250,8 +2260,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState return; } if (sVerbose) { Slog.v(TAG, "updateLocked(): id=" + id + ", action=" + actionAsString(action) + ", flags=" + flags); Slog.v(TAG, "updateLocked(" + this.id + "): id=" + id + ", action=" + actionAsString(action) + ", flags=" + flags); } ViewState viewState = mViewStates.get(id); Loading Loading @@ -3291,7 +3301,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState */ @GuardedBy("mLock") void removeSelfLocked() { if (sVerbose) Slog.v(TAG, "removeSelfLocked(): " + mPendingSaveUi); if (sVerbose) Slog.v(TAG, "removeSelfLocked(" + this.id + "): " + mPendingSaveUi); if (mDestroyed) { Slog.w(TAG, "Call to Session#removeSelfLocked() rejected - session: " + id + " destroyed"); Loading services/autofill/java/com/android/server/autofill/ViewState.java +1 −1 Original line number Diff line number Diff line Loading @@ -214,7 +214,7 @@ final class ViewState { if (mDatasetId != null) { builder.append(", datasetId:" ).append(mDatasetId); } builder.append("state:" ).append(getStateAsString()); builder.append(", state:").append(getStateAsString()); if (mCurrentValue != null) { builder.append(", currentValue:" ).append(mCurrentValue); } Loading Loading
services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +3 −2 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ import android.service.autofill.FillEventHistory; import android.service.autofill.FillEventHistory.Event; import android.service.autofill.FillResponse; import android.service.autofill.IAutoFillService; import android.service.autofill.SaveInfo; import android.service.autofill.UserData; import android.util.ArrayMap; import android.util.ArraySet; Loading Loading @@ -595,8 +596,8 @@ final class AutofillManagerServiceImpl ArrayList<Session> previousSessions = null; for (int i = 0; i < size; i++) { final Session previousSession = mSessions.valueAt(i); // TODO(b/113281366): only return sessions asked to be kept alive / add CTS test if (previousSession.taskId == session.taskId && previousSession.id != session.id) { if (previousSession.taskId == session.taskId && previousSession.id != session.id && (previousSession.getSaveInfoFlagsLocked() & SaveInfo.FLAG_DELAY_SAVE) != 0) { if (previousSessions == null) { previousSessions = new ArrayList<>(size); } Loading
services/autofill/java/com/android/server/autofill/Session.java +28 −18 Original line number Diff line number Diff line Loading @@ -1203,9 +1203,12 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState @GuardedBy("mLock") @Nullable private FillResponse getLastResponseLocked(@Nullable String logPrefix) { private FillResponse getLastResponseLocked(@Nullable String logPrefixFmt) { final String logPrefix = sDebug && logPrefixFmt != null ? String.format(logPrefixFmt, this.id) : null; if (mContexts == null) { if (sDebug && logPrefix != null) Slog.d(TAG, logPrefix + ": no contexts"); if (logPrefix != null) Slog.d(TAG, logPrefix + ": no contexts"); return null; } if (mResponses == null) { Loading Loading @@ -1241,6 +1244,12 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState return response == null ? null : response.getSaveInfo(); } @GuardedBy("mLock") int getSaveInfoFlagsLocked() { final SaveInfo saveInfo = getSaveInfoLocked(); return saveInfo == null ? 0 : saveInfo.getFlags(); } /** * Generates a {@link android.service.autofill.FillEventHistory.Event#TYPE_CONTEXT_COMMITTED} * when necessary. Loading @@ -1252,7 +1261,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState private void handleLogContextCommitted() { final FillResponse lastResponse; synchronized (mLock) { lastResponse = getLastResponseLocked("logContextCommited()"); lastResponse = getLastResponseLocked("logContextCommited(%s)"); } if (lastResponse == null) { Loading Loading @@ -1295,7 +1304,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState @GuardedBy("mLock") private void logContextCommittedLocked(@Nullable ArrayList<AutofillId> detectedFieldIds, @Nullable ArrayList<FieldClassification> detectedFieldClassifications) { final FillResponse lastResponse = getLastResponseLocked("logContextCommited()"); final FillResponse lastResponse = getLastResponseLocked("logContextCommited(%s)"); if (lastResponse == null) return; final int flags = lastResponse.getFlags(); Loading Loading @@ -1610,7 +1619,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState + id + " destroyed"); return false; } final FillResponse response = getLastResponseLocked("showSaveLocked()"); final FillResponse response = getLastResponseLocked("showSaveLocked(%s)"); final SaveInfo saveInfo = response == null ? null : response.getSaveInfo(); /* Loading @@ -1624,13 +1633,13 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState * - server didn't ask to keep session alive */ if (saveInfo == null) { if (sVerbose) Slog.v(TAG, "showSaveLocked(): no saveInfo from service"); if (sVerbose) Slog.v(TAG, "showSaveLocked(" + this.id + "): no saveInfo from service"); return true; } if ((saveInfo.getFlags() & SaveInfo.FLAG_DELAY_SAVE) != 0) { // TODO(b/113281366): log metrics if (sDebug) Slog.v(TAG, "showSaveLocked(): service asked to delay save"); if (sDebug) Slog.v(TAG, "showSaveLocked(" + this.id + "): service asked to delay save"); return false; } Loading Loading @@ -1962,7 +1971,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState if (node != null) { final AutofillValue value = node.getAutofillValue(); if (sDebug) { Slog.d(TAG, "getValueFromContexts(" + autofillId + ") at " + i + ": " + value); Slog.d(TAG, "getValueFromContexts(" + this.id + "/" + autofillId + ") at " + i + ": " + value); } if (value != null && !value.isEmpty()) { return value; Loading Loading @@ -2066,7 +2076,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState return; } if (sVerbose) Slog.v(TAG, "callSaveLocked(): mViewStates=" + mViewStates); if (sVerbose) Slog.v(TAG, "callSaveLocked(" + this.id + "): mViewStates=" + mViewStates); if (mContexts == null) { Slog.w(TAG, "callSaveLocked(): no contexts"); Loading Loading @@ -2109,15 +2119,15 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState final ArrayList<FillContext> contexts; if (previousSessions != null) { if (sDebug) { Slog.d(TAG, "mergeSessions(): Merging the content of " + previousSessions.size() + " sessions for task " + taskId); Slog.d(TAG, "mergeSessions(" + this.id + "): Merging the content of " + previousSessions.size() + " sessions for task " + taskId); } contexts = new ArrayList<>(); for (int i = 0; i < previousSessions.size(); i++) { final Session previousSession = previousSessions.get(i); final ArrayList<FillContext> previousContexts = previousSession.mContexts; if (previousContexts == null) { Slog.w(TAG, "mergeSessions(): Not merging null contexts from " Slog.w(TAG, "mergeSessions(" + this.id + "): Not merging null contexts from " + previousSession.id); continue; } Loading @@ -2125,14 +2135,14 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState previousSession.updateValuesForSaveLocked(); } if (sDebug) { Slog.d(TAG, "mergeSessions(): adding " + previousContexts.size() Slog.d(TAG, "mergeSessions(" + this.id + "): adding " + previousContexts.size() + " context from previous session #" + previousSession.id); } contexts.addAll(previousContexts); if (mClientState == null && previousSession.mClientState != null) { if (sDebug) { Slog.d(TAG, "mergeSessions(): setting client state from previous session" + previousSession.id); Slog.d(TAG, "mergeSessions(" + this.id + "): setting client state from " + "previous session" + previousSession.id); } mClientState = previousSession.mClientState; } Loading Loading @@ -2250,8 +2260,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState return; } if (sVerbose) { Slog.v(TAG, "updateLocked(): id=" + id + ", action=" + actionAsString(action) + ", flags=" + flags); Slog.v(TAG, "updateLocked(" + this.id + "): id=" + id + ", action=" + actionAsString(action) + ", flags=" + flags); } ViewState viewState = mViewStates.get(id); Loading Loading @@ -3291,7 +3301,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState */ @GuardedBy("mLock") void removeSelfLocked() { if (sVerbose) Slog.v(TAG, "removeSelfLocked(): " + mPendingSaveUi); if (sVerbose) Slog.v(TAG, "removeSelfLocked(" + this.id + "): " + mPendingSaveUi); if (mDestroyed) { Slog.w(TAG, "Call to Session#removeSelfLocked() rejected - session: " + id + " destroyed"); Loading
services/autofill/java/com/android/server/autofill/ViewState.java +1 −1 Original line number Diff line number Diff line Loading @@ -214,7 +214,7 @@ final class ViewState { if (mDatasetId != null) { builder.append(", datasetId:" ).append(mDatasetId); } builder.append("state:" ).append(getStateAsString()); builder.append(", state:").append(getStateAsString()); if (mCurrentValue != null) { builder.append(", currentValue:" ).append(mCurrentValue); } Loading