Do not emit WTF if there is no delegate
WTF should only be logged when there is more than one delegates,
not when there is none.
Test: atest com.android.cts.devicepolicy.MixedDeviceOwnerTest#testKeyManagement
and check logcat for the absence of WTF logs
Bug: 122363826
Change-Id: I51972ec4fabb2de70a6fe1700afae3aea95e34ab
This commit is contained in:
@@ -6101,7 +6101,9 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
|
||||
synchronized (getLockObject()) {
|
||||
delegates = getDelegatePackagesInternalLocked(scope, userId);
|
||||
}
|
||||
if (delegates.size() != 1) {
|
||||
if (delegates.size() == 0) {
|
||||
return null;
|
||||
} else if (delegates.size() > 1) {
|
||||
Slog.wtf(LOG_TAG, "More than one delegate holds " + scope);
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user