Merge "Permanently and immediately binds the augmented autofill service."
This commit is contained in:
committed by
Android (Google) Code Review
commit
9868947bd0
@@ -84,6 +84,18 @@ public abstract class AugmentedAutofillService extends Service {
|
||||
|
||||
private final IAugmentedAutofillService mInterface = new IAugmentedAutofillService.Stub() {
|
||||
|
||||
@Override
|
||||
public void onConnected() {
|
||||
mHandler.sendMessage(obtainMessage(AugmentedAutofillService::handleOnConnected,
|
||||
AugmentedAutofillService.this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisconnected() {
|
||||
mHandler.sendMessage(obtainMessage(AugmentedAutofillService::handleOnDisconnected,
|
||||
AugmentedAutofillService.this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFillRequest(int sessionId, IBinder client, int taskId,
|
||||
ComponentName componentName, AutofillId focusedId, AutofillValue focusedValue,
|
||||
@@ -174,6 +186,14 @@ public abstract class AugmentedAutofillService extends Service {
|
||||
public void onDisconnected() {
|
||||
}
|
||||
|
||||
private void handleOnConnected() {
|
||||
onConnected();
|
||||
}
|
||||
|
||||
private void handleOnDisconnected() {
|
||||
onDisconnected();
|
||||
}
|
||||
|
||||
private void handleOnFillRequest(int sessionId, @NonNull IBinder client, int taskId,
|
||||
@NonNull ComponentName componentName, @NonNull AutofillId focusedId,
|
||||
@Nullable AutofillValue focusedValue, long requestTime,
|
||||
|
||||
@@ -31,7 +31,8 @@ import java.util.List;
|
||||
* @hide
|
||||
*/
|
||||
oneway interface IAugmentedAutofillService {
|
||||
|
||||
void onConnected();
|
||||
void onDisconnected();
|
||||
void onFillRequest(int sessionId, in IBinder autofillManagerClient, int taskId,
|
||||
in ComponentName activityComponent, in AutofillId focusedId,
|
||||
in AutofillValue focusedValue, long requestTime, in IFillCallback callback);
|
||||
|
||||
@@ -1179,6 +1179,7 @@ final class AutofillManagerServiceImpl
|
||||
if (mMaster.verbose) Slog.v(TAG, "whitelisting augmented packages: " + packages);
|
||||
mWhitelistedAugmentAutofillPackages.addAll(packages);
|
||||
}
|
||||
mRemoteAugmentedAutofillService = getRemoteAugmentedAutofillServiceLocked();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,9 @@ final class RemoteAugmentedAutofillService
|
||||
boolean bindInstantServiceAllowed, boolean verbose) {
|
||||
super(context, AugmentedAutofillService.SERVICE_INTERFACE, serviceName, userId, callbacks,
|
||||
bindInstantServiceAllowed, verbose);
|
||||
|
||||
// Bind right away.
|
||||
scheduleBind();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -82,6 +85,22 @@ final class RemoteAugmentedAutofillService
|
||||
return new Pair<>(serviceInfo, serviceComponent);
|
||||
}
|
||||
|
||||
@Override // from RemoteService
|
||||
protected void handleOnConnectedStateChanged(boolean state) {
|
||||
if (state && getTimeoutIdleBindMillis() != PERMANENT_BOUND_TIMEOUT_MS) {
|
||||
scheduleUnbind();
|
||||
}
|
||||
try {
|
||||
if (state) {
|
||||
mService.onConnected();
|
||||
} else {
|
||||
mService.onDisconnected();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Slog.w(mTag, "Exception calling onConnectedStateChanged(" + state + "): " + e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // from AbstractRemoteService
|
||||
protected IAugmentedAutofillService getServiceInterface(IBinder service) {
|
||||
return IAugmentedAutofillService.Stub.asInterface(service);
|
||||
|
||||
Reference in New Issue
Block a user