Do not throw SecurityException from getPrimaryClip.

Currently getPrimaryClip throws a SecurityException if a Uri in
clipboard has become invalid and permission to it can no longer be
granted. This is unexpected and can crash apps that are trying to
paste.

This change catches the exception and clears clipboard if this case
occurs.

Bug: 187942504
Test: atest android.appsecurity.cts.AppSecurityTests#testPermissionDiffCert
Test: build & flash, create invalid Uri by uninstalling and reinstalling Chrome
Change-Id: I9994bb03f1aed47e32a500bba8886eea3f2cd905
1 file changed