Merge "Fixing the bug where secondary lockscreen intent is sent to the admin receiver but no the service." into rvc-dev

This commit is contained in:
Yuhan Zhao
2020-03-24 19:51:12 +00:00
committed by Android (Google) Code Review

View File

@@ -966,18 +966,21 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
boolean changed = false; boolean changed = false;
if (enabled && (oldIntent == null)) { if (enabled && (oldIntent == null)) {
Intent intent = new Intent( ComponentName poComponent = mDevicePolicyManager.getProfileOwnerAsUser(userId);
DevicePolicyManager.ACTION_BIND_SECONDARY_LOCKSCREEN_SERVICE); if (poComponent == null) {
ComponentName profileOwnerComponent = Log.e(TAG, "No profile owner found for User " + userId);
mDevicePolicyManager.getProfileOwnerAsUser(userId); } else {
intent.setComponent(profileOwnerComponent); Intent intent =
new Intent(DevicePolicyManager.ACTION_BIND_SECONDARY_LOCKSCREEN_SERVICE)
.setPackage(poComponent.getPackageName());
ResolveInfo resolveInfo = mContext.getPackageManager().resolveService(intent, 0); ResolveInfo resolveInfo = mContext.getPackageManager().resolveService(intent, 0);
if (resolveInfo != null) { if (resolveInfo != null && resolveInfo.serviceInfo != null) {
Intent newIntent = new Intent(); Intent launchIntent =
newIntent.setComponent(profileOwnerComponent); new Intent().setComponent(resolveInfo.serviceInfo.getComponentName());
mSecondaryLockscreenRequirement.put(userId, newIntent); mSecondaryLockscreenRequirement.put(userId, launchIntent);
changed = true; changed = true;
} }
}
} else if (!enabled && (oldIntent != null)) { } else if (!enabled && (oldIntent != null)) {
mSecondaryLockscreenRequirement.put(userId, null); mSecondaryLockscreenRequirement.put(userId, null);
changed = true; changed = true;