Loading core/java/android/view/autofill/AutofillManagerInternal.java +8 −0 Original line number Diff line number Diff line Loading @@ -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); } services/autofill/java/com/android/server/autofill/AutofillManagerService.java +11 −0 Original line number Diff line number Diff line Loading @@ -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; } } /** Loading services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +5 −0 Original line number Diff line number Diff line Loading @@ -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. * Loading services/core/java/com/android/server/clipboard/ClipboardService.java +10 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading @@ -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) { Loading Loading @@ -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; Loading services/java/com/android/server/SystemServer.java +5 −6 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); Loading Loading @@ -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(); Loading Loading
core/java/android/view/autofill/AutofillManagerInternal.java +8 −0 Original line number Diff line number Diff line Loading @@ -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); }
services/autofill/java/com/android/server/autofill/AutofillManagerService.java +11 −0 Original line number Diff line number Diff line Loading @@ -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; } } /** Loading
services/autofill/java/com/android/server/autofill/AutofillManagerServiceImpl.java +5 −0 Original line number Diff line number Diff line Loading @@ -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. * Loading
services/core/java/com/android/server/clipboard/ClipboardService.java +10 −2 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading @@ -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) { Loading Loading @@ -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; Loading
services/java/com/android/server/SystemServer.java +5 −6 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); Loading Loading @@ -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(); Loading