Fix NPE in ClipboarService.
Check if primaryClip is null or not before trying to set the timestamp.
Fixes: 35144954
Test: cts-tradefed run singleCommand cts-dev --module -t \
com.android.cts.devicepolicy.ManagedProfileTest#testCrossProfileCopyPaste
Change-Id: If322626553f42dda56a42adc2c6e4d206715a673
This commit is contained in:
@@ -404,9 +404,11 @@ public class ClipboardService extends SystemService {
|
||||
return;
|
||||
}
|
||||
clipboard.primaryClip = clip;
|
||||
final ClipDescription description = clipboard.primaryClip.getDescription();
|
||||
if (description != null) {
|
||||
description.setTimestamp(SystemClock.elapsedRealtime());
|
||||
if (clip != null) {
|
||||
final ClipDescription description = clip.getDescription();
|
||||
if (description != null) {
|
||||
description.setTimestamp(SystemClock.elapsedRealtime());
|
||||
}
|
||||
}
|
||||
final long ident = Binder.clearCallingIdentity();
|
||||
final int n = clipboard.primaryClipListeners.beginBroadcast();
|
||||
|
||||
Reference in New Issue
Block a user