Perform text classification when emulator sets clipboard.
This fixes an issue where clipboard clips coming from the emulator host do not have text classification performed, resulting in the clip being permanently in the CLAFFICATION_NOT_PERFORMED state. Bug: 204085258 Test: build; use system image in emulator; manual copy and check Test: atest ClipDescriptionTest Test: atest ClipboardManagerTest Change-Id: Ic89d6e87976ec75a7b9a55e2602619aa6e93ddce
This commit is contained in:
@@ -535,9 +535,6 @@ public class ClipboardService extends SystemService {
|
||||
mEmulatorClipboardMonitor.accept(clip);
|
||||
|
||||
final int userId = UserHandle.getUserId(uid);
|
||||
if (clip != null) {
|
||||
startClassificationLocked(clip, userId);
|
||||
}
|
||||
|
||||
// Update this user
|
||||
setPrimaryClipInternalLocked(getClipboardLocked(userId), clip, uid, sourcePackage);
|
||||
@@ -593,6 +590,17 @@ public class ClipboardService extends SystemService {
|
||||
@GuardedBy("mLock")
|
||||
private void setPrimaryClipInternalLocked(PerUserClipboard clipboard, @Nullable ClipData clip,
|
||||
int uid, @Nullable String sourcePackage) {
|
||||
final int userId = UserHandle.getUserId(uid);
|
||||
if (clip != null) {
|
||||
startClassificationLocked(clip, userId);
|
||||
}
|
||||
|
||||
setPrimaryClipInternalNoClassifyLocked(clipboard, clip, uid, sourcePackage);
|
||||
}
|
||||
|
||||
@GuardedBy("mLock")
|
||||
private void setPrimaryClipInternalNoClassifyLocked(PerUserClipboard clipboard,
|
||||
@Nullable ClipData clip, int uid, @Nullable String sourcePackage) {
|
||||
revokeUris(clipboard);
|
||||
clipboard.activePermissionOwners.clear();
|
||||
if (clip == null && clipboard.primaryClip == null) {
|
||||
|
||||
Reference in New Issue
Block a user