summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Karpinski <mkarpinski@google.com>2019-03-25 20:37:57 +0000
committerMichal Karpinski <mkarpinski@google.com>2019-03-26 11:07:33 +0000
commit322df0bb7409c79a3ad8faa285096af1d884b29f (patch)
tree5c1b3bdb48076c5166189e00d25d32ddb8e9e137
parent356c5dfd420331434e893f852ee3ac3f307a3c40 (diff)
Modify AbstractRemoteService#mBindInstantServiceAllowed to #mBindingFlags
in order to support multiple binding flags And supply BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS for RemoteFillService. Test: atest CtsAutoFillServiceTestCases Test: atest AutofillManagerServiceTest Bug: 126267782 Change-Id: Id5262d6a4e0fde0ad874020f783cfbf72fe201f4
-rw-r--r--core/java/android/app/role/RoleControllerManager.java2
-rw-r--r--core/java/android/permission/PermissionControllerManager.java2
-rw-r--r--core/java/com/android/internal/infra/AbstractMultiplePendingRequestsRemoteService.java6
-rw-r--r--core/java/com/android/internal/infra/AbstractRemoteService.java14
-rw-r--r--core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java6
-rw-r--r--services/appprediction/java/com/android/server/appprediction/RemoteAppPredictionService.java3
-rw-r--r--services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java3
-rw-r--r--services/autofill/java/com/android/server/autofill/RemoteFillService.java3
-rw-r--r--services/contentcapture/java/com/android/server/contentcapture/RemoteContentCaptureService.java3
-rw-r--r--services/contentsuggestions/java/com/android/server/contentsuggestions/RemoteContentSuggestionsService.java3
10 files changed, 24 insertions, 21 deletions
diff --git a/core/java/android/app/role/RoleControllerManager.java b/core/java/android/app/role/RoleControllerManager.java
index e96c9a541c3f..bd981179e2ff 100644
--- a/core/java/android/app/role/RoleControllerManager.java
+++ b/core/java/android/app/role/RoleControllerManager.java
@@ -167,7 +167,7 @@ public class RoleControllerManager {
RemoteService(@NonNull Context context, @NonNull ComponentName componentName,
@NonNull Handler handler, @UserIdInt int userId) {
super(context, RoleControllerService.SERVICE_INTERFACE, componentName, userId,
- service -> Log.e(LOG_TAG, "RemoteService " + service + " died"), handler, false,
+ service -> Log.e(LOG_TAG, "RemoteService " + service + " died"), handler, 0,
false, 1);
}
diff --git a/core/java/android/permission/PermissionControllerManager.java b/core/java/android/permission/PermissionControllerManager.java
index 61511aa509b1..55fae3014666 100644
--- a/core/java/android/permission/PermissionControllerManager.java
+++ b/core/java/android/permission/PermissionControllerManager.java
@@ -472,7 +472,7 @@ public final class PermissionControllerManager {
@NonNull UserHandle user) {
super(context, SERVICE_INTERFACE, componentName, user.getIdentifier(),
service -> Log.e(TAG, "RemoteService " + service + " died"),
- context.getMainThreadHandler(), false, false, 1);
+ context.getMainThreadHandler(), 0, false, 1);
}
/**
diff --git a/core/java/com/android/internal/infra/AbstractMultiplePendingRequestsRemoteService.java b/core/java/com/android/internal/infra/AbstractMultiplePendingRequestsRemoteService.java
index 37f61bf650c7..206efa94b7f6 100644
--- a/core/java/com/android/internal/infra/AbstractMultiplePendingRequestsRemoteService.java
+++ b/core/java/com/android/internal/infra/AbstractMultiplePendingRequestsRemoteService.java
@@ -45,9 +45,9 @@ public abstract class AbstractMultiplePendingRequestsRemoteService<S
public AbstractMultiplePendingRequestsRemoteService(@NonNull Context context,
@NonNull String serviceInterface, @NonNull ComponentName componentName, int userId,
@NonNull VultureCallback<S> callback, @NonNull Handler handler,
- boolean bindInstantServiceAllowed, boolean verbose, int initialCapacity) {
- super(context, serviceInterface, componentName, userId, callback, handler,
- bindInstantServiceAllowed, verbose);
+ int bindingFlags, boolean verbose, int initialCapacity) {
+ super(context, serviceInterface, componentName, userId, callback, handler, bindingFlags,
+ verbose);
mInitialCapacity = initialCapacity;
}
diff --git a/core/java/com/android/internal/infra/AbstractRemoteService.java b/core/java/com/android/internal/infra/AbstractRemoteService.java
index 0a83fcc6db61..1155854efd55 100644
--- a/core/java/com/android/internal/infra/AbstractRemoteService.java
+++ b/core/java/com/android/internal/infra/AbstractRemoteService.java
@@ -82,7 +82,7 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I
private final VultureCallback<S> mVultureCallback;
private final int mUserId;
private final ServiceConnection mServiceConnection = new RemoteServiceConnection();
- private final boolean mBindInstantServiceAllowed;
+ private final int mBindingFlags;
protected I mService;
private boolean mBinding;
@@ -113,7 +113,7 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I
// NOTE: must be package-protected so this class is not extended outside
AbstractRemoteService(@NonNull Context context, @NonNull String serviceInterface,
@NonNull ComponentName componentName, int userId, @NonNull VultureCallback<S> callback,
- @NonNull Handler handler, boolean bindInstantServiceAllowed, boolean verbose) {
+ @NonNull Handler handler, int bindingFlags, boolean verbose) {
mContext = context;
mVultureCallback = callback;
mVerbose = verbose;
@@ -121,7 +121,7 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I
mIntent = new Intent(serviceInterface).setComponent(mComponentName);
mUserId = userId;
mHandler = new Handler(handler.getLooper());
- mBindInstantServiceAllowed = bindInstantServiceAllowed;
+ mBindingFlags = bindingFlags;
}
/**
@@ -264,7 +264,7 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I
}
}
pw.println();
- pw.append(prefix).append("mBindInstantServiceAllowed=").println(mBindInstantServiceAllowed);
+ pw.append(prefix).append("mBindingFlags=").println(mBindingFlags);
pw.append(prefix).append("idleTimeout=")
.append(Long.toString(idleTimeout / 1000)).append("s\n");
pw.append(prefix).append("requestTimeout=");
@@ -407,10 +407,8 @@ public abstract class AbstractRemoteService<S extends AbstractRemoteService<S, I
if (mVerbose) Slog.v(mTag, "ensureBound()");
mBinding = true;
- int flags = Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE;
- if (mBindInstantServiceAllowed) {
- flags |= Context.BIND_ALLOW_INSTANT;
- }
+ final int flags = Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE
+ | mBindingFlags;
final boolean willBind = mContext.bindServiceAsUser(mIntent, mServiceConnection, flags,
mHandler, new UserHandle(mUserId));
diff --git a/core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java b/core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java
index a70fc3e17d60..66bee95b0302 100644
--- a/core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java
+++ b/core/java/com/android/internal/infra/AbstractSinglePendingRequestRemoteService.java
@@ -44,9 +44,9 @@ public abstract class AbstractSinglePendingRequestRemoteService<S
public AbstractSinglePendingRequestRemoteService(@NonNull Context context,
@NonNull String serviceInterface, @NonNull ComponentName componentName, int userId,
@NonNull VultureCallback<S> callback, @NonNull Handler handler,
- boolean bindInstantServiceAllowed, boolean verbose) {
- super(context, serviceInterface, componentName, userId, callback, handler,
- bindInstantServiceAllowed, verbose);
+ int bindingFlags, boolean verbose) {
+ super(context, serviceInterface, componentName, userId, callback, handler, bindingFlags,
+ verbose);
}
@Override // from AbstractRemoteService
diff --git a/services/appprediction/java/com/android/server/appprediction/RemoteAppPredictionService.java b/services/appprediction/java/com/android/server/appprediction/RemoteAppPredictionService.java
index 21088e442212..19226be2e1ca 100644
--- a/services/appprediction/java/com/android/server/appprediction/RemoteAppPredictionService.java
+++ b/services/appprediction/java/com/android/server/appprediction/RemoteAppPredictionService.java
@@ -47,7 +47,8 @@ public class RemoteAppPredictionService extends
RemoteAppPredictionServiceCallbacks callback, boolean bindInstantServiceAllowed,
boolean verbose) {
super(context, serviceInterface, componentName, userId, callback,
- context.getMainThreadHandler(), bindInstantServiceAllowed,
+ context.getMainThreadHandler(),
+ bindInstantServiceAllowed ? Context.BIND_ALLOW_INSTANT : 0,
verbose, /* initialCapacity= */ 1);
}
diff --git a/services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java b/services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java
index 3c17ac35f624..adf582925489 100644
--- a/services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java
+++ b/services/autofill/java/com/android/server/autofill/RemoteAugmentedAutofillService.java
@@ -58,7 +58,8 @@ final class RemoteAugmentedAutofillService
boolean bindInstantServiceAllowed, boolean verbose, int idleUnbindTimeoutMs,
int requestTimeoutMs) {
super(context, AugmentedAutofillService.SERVICE_INTERFACE, serviceName, userId, callbacks,
- context.getMainThreadHandler(), bindInstantServiceAllowed, verbose);
+ context.getMainThreadHandler(),
+ bindInstantServiceAllowed ? Context.BIND_ALLOW_INSTANT : 0, verbose);
mIdleUnbindTimeoutMs = idleUnbindTimeoutMs;
mRequestTimeoutMs = requestTimeoutMs;
diff --git a/services/autofill/java/com/android/server/autofill/RemoteFillService.java b/services/autofill/java/com/android/server/autofill/RemoteFillService.java
index b8a7d44a4d10..0ce6c87f1f28 100644
--- a/services/autofill/java/com/android/server/autofill/RemoteFillService.java
+++ b/services/autofill/java/com/android/server/autofill/RemoteFillService.java
@@ -64,7 +64,8 @@ final class RemoteFillService
RemoteFillService(Context context, ComponentName componentName, int userId,
FillServiceCallbacks callbacks, boolean bindInstantServiceAllowed) {
super(context, AutofillService.SERVICE_INTERFACE, componentName, userId, callbacks,
- context.getMainThreadHandler(), bindInstantServiceAllowed, sVerbose);
+ context.getMainThreadHandler(), Context.BIND_ALLOW_BACKGROUND_ACTIVITY_STARTS
+ | (bindInstantServiceAllowed ? Context.BIND_ALLOW_INSTANT : 0), sVerbose);
mCallbacks = callbacks;
}
diff --git a/services/contentcapture/java/com/android/server/contentcapture/RemoteContentCaptureService.java b/services/contentcapture/java/com/android/server/contentcapture/RemoteContentCaptureService.java
index df9ccbc499ba..0afe252d96bd 100644
--- a/services/contentcapture/java/com/android/server/contentcapture/RemoteContentCaptureService.java
+++ b/services/contentcapture/java/com/android/server/contentcapture/RemoteContentCaptureService.java
@@ -47,7 +47,8 @@ final class RemoteContentCaptureService
ContentCapturePerUserService perUserService, boolean bindInstantServiceAllowed,
boolean verbose, int idleUnbindTimeoutMs) {
super(context, serviceInterface, serviceComponentName, userId, perUserService,
- context.getMainThreadHandler(), bindInstantServiceAllowed, verbose,
+ context.getMainThreadHandler(),
+ bindInstantServiceAllowed ? Context.BIND_ALLOW_INSTANT : 0, verbose,
/* initialCapacity= */ 2);
mPerUserService = perUserService;
mServerCallback = callback.asBinder();
diff --git a/services/contentsuggestions/java/com/android/server/contentsuggestions/RemoteContentSuggestionsService.java b/services/contentsuggestions/java/com/android/server/contentsuggestions/RemoteContentSuggestionsService.java
index 442972a1e477..4b36352bac51 100644
--- a/services/contentsuggestions/java/com/android/server/contentsuggestions/RemoteContentSuggestionsService.java
+++ b/services/contentsuggestions/java/com/android/server/contentsuggestions/RemoteContentSuggestionsService.java
@@ -47,7 +47,8 @@ public class RemoteContentSuggestionsService extends
int userId, Callbacks callbacks,
boolean bindInstantServiceAllowed, boolean verbose) {
super(context, ContentSuggestionsService.SERVICE_INTERFACE, serviceName, userId, callbacks,
- context.getMainThreadHandler(), bindInstantServiceAllowed, verbose,
+ context.getMainThreadHandler(),
+ bindInstantServiceAllowed ? Context.BIND_ALLOW_INSTANT : 0, verbose,
/* initialCapacity= */ 1);
}