Loading core/java/android/service/autofill/augmented/AugmentedAutofillService.java +36 −11 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import android.os.IBinder; import android.os.Looper; import android.os.RemoteException; import android.os.SystemClock; import android.service.autofill.augmented.AugmentedAutofillService.AutofillProxy; import android.service.autofill.augmented.PresentationParams.SystemPopupPresentationParams; import android.util.Log; import android.util.Pair; Loading Loading @@ -172,7 +171,9 @@ public abstract class AugmentedAutofillService extends Service { mAutofillProxies.put(sessionId, proxy); } else { // TODO(b/111330312): figure out if it's ok to reuse the proxy; add logging // TODO(b/111330312): also make sure to cover scenario on CTS test if (DEBUG) Log.d(TAG, "Reusing proxy for session " + sessionId); proxy.update(focusedId, focusedValue); } // TODO(b/111330312): set cancellation signal final CancellationSignal cancellationSignal = null; Loading Loading @@ -248,8 +249,10 @@ public abstract class AugmentedAutofillService extends Service { private final IFillCallback mCallback; public final int taskId; public final ComponentName componentName; public final AutofillId focusedId; public final AutofillValue focusedValue; @GuardedBy("mLock") private AutofillId mFocusedId; @GuardedBy("mLock") private AutofillValue mFocusedValue; // Objects used to log metrics private final long mRequestTime; Loading @@ -272,8 +275,8 @@ public abstract class AugmentedAutofillService extends Service { mCallback = callback; this.taskId = taskId; this.componentName = componentName; this.focusedId = focusedId; this.focusedValue = focusedValue; this.mFocusedId = focusedId; this.mFocusedValue = focusedValue; this.mRequestTime = requestTime; // TODO(b/111330312): linkToDeath } Loading @@ -286,13 +289,13 @@ public abstract class AugmentedAutofillService extends Service { } Rect rect; try { rect = mClient.getViewCoordinates(focusedId); rect = mClient.getViewCoordinates(mFocusedId); } catch (RemoteException e) { Log.w(TAG, "Could not get coordinates for " + focusedId); Log.w(TAG, "Could not get coordinates for " + mFocusedId); return null; } if (rect == null) { if (DEBUG) Log.d(TAG, "getViewCoordinates(" + focusedId + ") returned null"); if (DEBUG) Log.d(TAG, "getViewCoordinates(" + mFocusedId + ") returned null"); return null; } mSmartSuggestion = new SystemPopupPresentationParams(this, rect); Loading Loading @@ -325,6 +328,28 @@ public abstract class AugmentedAutofillService extends Service { } } private void update(@NonNull AutofillId focusedId, @NonNull AutofillValue focusedValue) { synchronized (mLock) { // TODO(b/111330312): should we close the popupwindow if the focused id changed? mFocusedId = focusedId; mFocusedValue = focusedValue; } } @NonNull public AutofillId getFocusedId() { synchronized (mLock) { return mFocusedId; } } @NonNull public AutofillValue getFocusedValue() { synchronized (mLock) { return mFocusedValue; } } // Used (mostly) for metrics. public void report(@ReportEvent int event) { switch (event) { Loading Loading @@ -372,9 +397,9 @@ public abstract class AugmentedAutofillService extends Service { pw.print(prefix); pw.print("taskId: "); pw.println(taskId); pw.print(prefix); pw.print("component: "); pw.println(componentName.flattenToShortString()); pw.print(prefix); pw.print("focusedId: "); pw.println(focusedId); if (focusedValue != null) { pw.print(prefix); pw.print("focusedValue: "); pw.println(focusedValue); pw.print(prefix); pw.print("focusedId: "); pw.println(mFocusedId); if (mFocusedValue != null) { pw.print(prefix); pw.print("focusedValue: "); pw.println(mFocusedValue); } pw.print(prefix); pw.print("client: "); pw.println(mClient); final String prefix2 = prefix + " "; Loading core/java/android/service/autofill/augmented/FillCallback.java +10 −0 Original line number Diff line number Diff line Loading @@ -15,10 +15,13 @@ */ package android.service.autofill.augmented; import static android.service.autofill.augmented.AugmentedAutofillService.DEBUG; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.service.autofill.augmented.AugmentedAutofillService.AutofillProxy; import android.util.Log; /** * Callback used to indicate at {@link FillRequest} has been fulfilled. Loading @@ -27,6 +30,9 @@ import android.service.autofill.augmented.AugmentedAutofillService.AutofillProxy */ @SystemApi public final class FillCallback { private static final String TAG = FillCallback.class.getSimpleName(); private final AutofillProxy mProxy; FillCallback(@NonNull AutofillProxy proxy) { Loading @@ -40,7 +46,11 @@ public final class FillCallback { * could not provide autofill for the request. */ public void onSuccess(@Nullable FillResponse response) { if (DEBUG) Log.d(TAG, "onSuccess(): " + response); mProxy.report(AutofillProxy.REPORT_EVENT_ON_SUCCESS); if (response == null) return; final FillWindow fillWindow = response.getFillWindow(); if (fillWindow != null) { fillWindow.show(); Loading core/java/android/service/autofill/augmented/FillRequest.java +3 −3 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ public final class FillRequest { */ @NonNull public AutofillId getFocusedId() { return mProxy.focusedId; return mProxy.getFocusedId(); } /** Loading @@ -66,7 +66,7 @@ public final class FillRequest { */ @NonNull public AutofillValue getFocusedValue() { return mProxy.focusedValue; return mProxy.getFocusedValue(); } /** Loading @@ -82,6 +82,6 @@ public final class FillRequest { @Override public String toString() { return "FillRequest[act=" + getActivityComponent().flattenToShortString() + ", id=" + mProxy.focusedId + "]"; + ", id=" + mProxy.getFocusedId() + "]"; } } core/java/android/service/autofill/augmented/FillResponse.java +2 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,8 @@ public final class FillResponse implements Parcelable { // TODO(b/111330312): add methods to disable app / activity, either here or on manager } // TODO(b/111330312): implement to String @Override public int describeContents() { return 0; Loading Loading
core/java/android/service/autofill/augmented/AugmentedAutofillService.java +36 −11 Original line number Diff line number Diff line Loading @@ -32,7 +32,6 @@ import android.os.IBinder; import android.os.Looper; import android.os.RemoteException; import android.os.SystemClock; import android.service.autofill.augmented.AugmentedAutofillService.AutofillProxy; import android.service.autofill.augmented.PresentationParams.SystemPopupPresentationParams; import android.util.Log; import android.util.Pair; Loading Loading @@ -172,7 +171,9 @@ public abstract class AugmentedAutofillService extends Service { mAutofillProxies.put(sessionId, proxy); } else { // TODO(b/111330312): figure out if it's ok to reuse the proxy; add logging // TODO(b/111330312): also make sure to cover scenario on CTS test if (DEBUG) Log.d(TAG, "Reusing proxy for session " + sessionId); proxy.update(focusedId, focusedValue); } // TODO(b/111330312): set cancellation signal final CancellationSignal cancellationSignal = null; Loading Loading @@ -248,8 +249,10 @@ public abstract class AugmentedAutofillService extends Service { private final IFillCallback mCallback; public final int taskId; public final ComponentName componentName; public final AutofillId focusedId; public final AutofillValue focusedValue; @GuardedBy("mLock") private AutofillId mFocusedId; @GuardedBy("mLock") private AutofillValue mFocusedValue; // Objects used to log metrics private final long mRequestTime; Loading @@ -272,8 +275,8 @@ public abstract class AugmentedAutofillService extends Service { mCallback = callback; this.taskId = taskId; this.componentName = componentName; this.focusedId = focusedId; this.focusedValue = focusedValue; this.mFocusedId = focusedId; this.mFocusedValue = focusedValue; this.mRequestTime = requestTime; // TODO(b/111330312): linkToDeath } Loading @@ -286,13 +289,13 @@ public abstract class AugmentedAutofillService extends Service { } Rect rect; try { rect = mClient.getViewCoordinates(focusedId); rect = mClient.getViewCoordinates(mFocusedId); } catch (RemoteException e) { Log.w(TAG, "Could not get coordinates for " + focusedId); Log.w(TAG, "Could not get coordinates for " + mFocusedId); return null; } if (rect == null) { if (DEBUG) Log.d(TAG, "getViewCoordinates(" + focusedId + ") returned null"); if (DEBUG) Log.d(TAG, "getViewCoordinates(" + mFocusedId + ") returned null"); return null; } mSmartSuggestion = new SystemPopupPresentationParams(this, rect); Loading Loading @@ -325,6 +328,28 @@ public abstract class AugmentedAutofillService extends Service { } } private void update(@NonNull AutofillId focusedId, @NonNull AutofillValue focusedValue) { synchronized (mLock) { // TODO(b/111330312): should we close the popupwindow if the focused id changed? mFocusedId = focusedId; mFocusedValue = focusedValue; } } @NonNull public AutofillId getFocusedId() { synchronized (mLock) { return mFocusedId; } } @NonNull public AutofillValue getFocusedValue() { synchronized (mLock) { return mFocusedValue; } } // Used (mostly) for metrics. public void report(@ReportEvent int event) { switch (event) { Loading Loading @@ -372,9 +397,9 @@ public abstract class AugmentedAutofillService extends Service { pw.print(prefix); pw.print("taskId: "); pw.println(taskId); pw.print(prefix); pw.print("component: "); pw.println(componentName.flattenToShortString()); pw.print(prefix); pw.print("focusedId: "); pw.println(focusedId); if (focusedValue != null) { pw.print(prefix); pw.print("focusedValue: "); pw.println(focusedValue); pw.print(prefix); pw.print("focusedId: "); pw.println(mFocusedId); if (mFocusedValue != null) { pw.print(prefix); pw.print("focusedValue: "); pw.println(mFocusedValue); } pw.print(prefix); pw.print("client: "); pw.println(mClient); final String prefix2 = prefix + " "; Loading
core/java/android/service/autofill/augmented/FillCallback.java +10 −0 Original line number Diff line number Diff line Loading @@ -15,10 +15,13 @@ */ package android.service.autofill.augmented; import static android.service.autofill.augmented.AugmentedAutofillService.DEBUG; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.service.autofill.augmented.AugmentedAutofillService.AutofillProxy; import android.util.Log; /** * Callback used to indicate at {@link FillRequest} has been fulfilled. Loading @@ -27,6 +30,9 @@ import android.service.autofill.augmented.AugmentedAutofillService.AutofillProxy */ @SystemApi public final class FillCallback { private static final String TAG = FillCallback.class.getSimpleName(); private final AutofillProxy mProxy; FillCallback(@NonNull AutofillProxy proxy) { Loading @@ -40,7 +46,11 @@ public final class FillCallback { * could not provide autofill for the request. */ public void onSuccess(@Nullable FillResponse response) { if (DEBUG) Log.d(TAG, "onSuccess(): " + response); mProxy.report(AutofillProxy.REPORT_EVENT_ON_SUCCESS); if (response == null) return; final FillWindow fillWindow = response.getFillWindow(); if (fillWindow != null) { fillWindow.show(); Loading
core/java/android/service/autofill/augmented/FillRequest.java +3 −3 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ public final class FillRequest { */ @NonNull public AutofillId getFocusedId() { return mProxy.focusedId; return mProxy.getFocusedId(); } /** Loading @@ -66,7 +66,7 @@ public final class FillRequest { */ @NonNull public AutofillValue getFocusedValue() { return mProxy.focusedValue; return mProxy.getFocusedValue(); } /** Loading @@ -82,6 +82,6 @@ public final class FillRequest { @Override public String toString() { return "FillRequest[act=" + getActivityComponent().flattenToShortString() + ", id=" + mProxy.focusedId + "]"; + ", id=" + mProxy.getFocusedId() + "]"; } }
core/java/android/service/autofill/augmented/FillResponse.java +2 −0 Original line number Diff line number Diff line Loading @@ -102,6 +102,8 @@ public final class FillResponse implements Parcelable { // TODO(b/111330312): add methods to disable app / activity, either here or on manager } // TODO(b/111330312): implement to String @Override public int describeContents() { return 0; Loading