summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/view/autofill/AutofillManagerInternal.java8
-rw-r--r--services/autofill/java/com/android/server/autofill/AutofillManagerService.java11
-rw-r--r--services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java5
-rw-r--r--services/core/java/com/android/server/clipboard/ClipboardService.java12
-rw-r--r--services/java/com/android/server/SystemServer.java11
5 files changed, 39 insertions, 8 deletions
diff --git a/core/java/android/view/autofill/AutofillManagerInternal.java b/core/java/android/view/autofill/AutofillManagerInternal.java
index 3de1a03d98e5..a07d46d77258 100644
--- a/core/java/android/view/autofill/AutofillManagerInternal.java
+++ b/core/java/android/view/autofill/AutofillManagerInternal.java
@@ -45,4 +45,12 @@ public abstract class AutofillManagerInternal {
@Nullable
public abstract AutofillOptions getAutofillOptions(@NonNull String packageName,
long versionCode, @UserIdInt int userId);
+
+ /**
+ * Checks whether the given {@code uid} owns the
+ * {@link android.service.autofill.augmented.AugmentedAutofillService} implementation associated
+ * with the given {@code userId}.
+ */
+ public abstract boolean isAugmentedAutofillServiceForUser(@NonNull int callingUid,
+ @UserIdInt int userId);
}
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
index fdc3567aa002..a94d1dc7f243 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
@@ -806,6 +806,17 @@ public final class AutofillManagerService
mAugmentedAutofillState.injectAugmentedAutofillInfo(options, userId, packageName);
return options;
}
+
+ @Override
+ public boolean isAugmentedAutofillServiceForUser(int callingUid, int userId) {
+ synchronized (mLock) {
+ final AutofillManagerServiceImpl service = peekServiceForUserLocked(userId);
+ if (service != null) {
+ return service.isAugmentedAutofillServiceForUserLocked(callingUid);
+ }
+ }
+ return false;
+ }
}
/**
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
index 4bd6fbd39de4..f1963b37a6cf 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java
@@ -1165,6 +1165,11 @@ final class AutofillManagerServiceImpl
return true;
}
+ boolean isAugmentedAutofillServiceForUserLocked(int callingUid) {
+ return mRemoteAugmentedAutofillServiceInfo != null
+ && mRemoteAugmentedAutofillServiceInfo.applicationInfo.uid == callingUid;
+ }
+
/**
* Sets which packages and activities can trigger augmented autofill.
*
diff --git a/services/core/java/com/android/server/clipboard/ClipboardService.java b/services/core/java/com/android/server/clipboard/ClipboardService.java
index 258c325716f2..d28482ef82ab 100644
--- a/services/core/java/com/android/server/clipboard/ClipboardService.java
+++ b/services/core/java/com/android/server/clipboard/ClipboardService.java
@@ -52,6 +52,7 @@ import android.provider.Settings;
import android.text.TextUtils;
import android.util.Slog;
import android.util.SparseArray;
+import android.view.autofill.AutofillManagerInternal;
import com.android.server.LocalServices;
import com.android.server.SystemService;
@@ -159,6 +160,7 @@ public class ClipboardService extends SystemService {
private final PackageManager mPm;
private final AppOpsManager mAppOps;
private final ContentCaptureManagerInternal mContentCaptureInternal;
+ private final AutofillManagerInternal mAutofillInternal;
private final IBinder mPermissionOwner;
private HostClipboardMonitor mHostClipboardMonitor = null;
private Thread mHostMonitorThread = null;
@@ -179,6 +181,7 @@ public class ClipboardService extends SystemService {
mUm = (IUserManager) ServiceManager.getService(Context.USER_SERVICE);
mAppOps = (AppOpsManager) getContext().getSystemService(Context.APP_OPS_SERVICE);
mContentCaptureInternal = LocalServices.getService(ContentCaptureManagerInternal.class);
+ mAutofillInternal = LocalServices.getService(AutofillManagerInternal.class);
final IBinder permOwner = mUgmInternal.newUriPermissionOwner("clipboard");
mPermissionOwner = permOwner;
if (IS_EMULATOR) {
@@ -653,13 +656,18 @@ public class ClipboardService extends SystemService {
// Clipboard can only be read by applications with focus..
boolean allowed = mWm.isUidFocused(callingUid);
if (!allowed && mContentCaptureInternal != null) {
- // ...or the Intelligence Service
+ // ...or the Content Capture Service
allowed = mContentCaptureInternal.isContentCaptureServiceForUser(callingUid,
userId);
}
+ if (!allowed && mAutofillInternal != null) {
+ // ...or the Augmented Autofill Service
+ allowed = mAutofillInternal.isAugmentedAutofillServiceForUser(callingUid,
+ userId);
+ }
if (!allowed) {
Slog.e(TAG, "Denying clipboard access to " + callingPackage
- + ", application is not in focus neither is the IntelligeService for "
+ + ", application is not in focus neither is a system service for "
+ "user " + userId);
}
return allowed;
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 0cd730b68c72..2a2de7796424 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -32,7 +32,6 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageItemInfo;
import android.content.pm.PackageManager;
-import android.content.pm.PackageManagerInternal;
import android.content.res.Configuration;
import android.content.res.Resources.Theme;
import android.database.sqlite.SQLiteCompatibilityWalFlags;
@@ -1248,11 +1247,6 @@ public final class SystemServer {
mSystemServiceManager.startService(CONTENT_SUGGESTIONS_SERVICE_CLASS);
traceEnd();
- // NOTE: ClipboardService indirectly depends on IntelligenceService
- traceBeginAndSlog("StartClipboardService");
- mSystemServiceManager.startService(ClipboardService.class);
- traceEnd();
-
traceBeginAndSlog("InitNetworkStackClient");
try {
NetworkStackClient.getInstance().init();
@@ -1887,6 +1881,11 @@ public final class SystemServer {
traceEnd();
}
+ // NOTE: ClipboardService depends on ContentCapture and Autofill
+ traceBeginAndSlog("StartClipboardService");
+ mSystemServiceManager.startService(ClipboardService.class);
+ traceEnd();
+
traceBeginAndSlog("AppServiceManager");
mSystemServiceManager.startService(AppBindingService.Lifecycle.class);
traceEnd();