Last active
July 25, 2021 15:06
-
-
Save user-mw/e75f4c4a247065a8df5361b9d2db845d to your computer and use it in GitHub Desktop.
Method setPrimaryClip() inside ClipboardImpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ClipboardService extends SystemService { | |
// Code | |
private class ClipboardImpl extends IClipboard.Stub { | |
// Code | |
@Override | |
public void setPrimaryClip(ClipData clip, String callingPackage, @UserIdInt int userId) { | |
synchronized (this) { | |
if (clip == null || clip.getItemCount() <= 0) { | |
throw new IllegalArgumentException("No items"); | |
} | |
// Code | |
if (!clipboardAccessAllowed(AppOpsManager.OP_WRITE_CLIPBOARD, callingPackage, | |
intendingUid, intendingUserId)) { | |
return; | |
} | |
// Code | |
setPrimaryClipInternal(clip, intendingUid); | |
} | |
} | |
// Code | |
} | |
// Code | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment