Catch SecurityException when sending clip change broadcast.
This fixes an issue where the system server can crash if a SecurityException occurs while a clip change broadcast is being sent. If an app is not permitted to access clipboard, then the clipboardAccessAllowed check throws a SecurityException. This is ok when the exception can propogate back to a caller, such as when setClipData has been called, but when this happens while a change broadcast is being triggered it will instead crash the system. Bug: 207333180 Test: atest ClipboardManagerTest Test: atest ClipDescriptionTest Change-Id: If18ce497a89335ed26c8996571448c2c083887e6
This commit is contained in:
@@ -639,7 +639,7 @@ public class ClipboardService extends SystemService {
|
||||
clipboard.primaryClipListeners.getBroadcastItem(i)
|
||||
.dispatchPrimaryClipChanged();
|
||||
}
|
||||
} catch (RemoteException e) {
|
||||
} catch (RemoteException | SecurityException e) {
|
||||
// The RemoteCallbackList will take care of removing
|
||||
// the dead object for us.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user