Skip to content

Instantly share code, notes, and snippets.

@user-mw
Last active July 25, 2021 15:06
Show Gist options
  • Save user-mw/e75f4c4a247065a8df5361b9d2db845d to your computer and use it in GitHub Desktop.
Save user-mw/e75f4c4a247065a8df5361b9d2db845d to your computer and use it in GitHub Desktop.
Method setPrimaryClip() inside ClipboardImpl
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