Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3bdabe17 authored by Yuhan Zhao's avatar Yuhan Zhao Committed by Automerger Merge Worker
Browse files

Merge "Fixing the bug where secondary lockscreen intent is sent to the admin...

Merge "Fixing the bug where secondary lockscreen intent is sent to the admin receiver but no the service." into rvc-dev am: 6dc855e1 am: d547a99d am: 33491d05

Change-Id: I179166dcd64d39e78b7b1154e5779ab48541cb50
parents fbdd55ac 33491d05
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -966,18 +966,21 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab
        boolean changed = false;

        if (enabled && (oldIntent == null)) {
            Intent intent = new Intent(
                    DevicePolicyManager.ACTION_BIND_SECONDARY_LOCKSCREEN_SERVICE);
            ComponentName profileOwnerComponent =
                    mDevicePolicyManager.getProfileOwnerAsUser(userId);
            intent.setComponent(profileOwnerComponent);
            ComponentName poComponent = mDevicePolicyManager.getProfileOwnerAsUser(userId);
            if (poComponent == null) {
                Log.e(TAG, "No profile owner found for User " + userId);
            } else {
                Intent intent =
                        new Intent(DevicePolicyManager.ACTION_BIND_SECONDARY_LOCKSCREEN_SERVICE)
                                .setPackage(poComponent.getPackageName());
                ResolveInfo resolveInfo = mContext.getPackageManager().resolveService(intent, 0);
            if (resolveInfo != null) {
                Intent newIntent = new Intent();
                newIntent.setComponent(profileOwnerComponent);
                mSecondaryLockscreenRequirement.put(userId, newIntent);
                if (resolveInfo != null && resolveInfo.serviceInfo != null) {
                    Intent launchIntent =
                            new Intent().setComponent(resolveInfo.serviceInfo.getComponentName());
                    mSecondaryLockscreenRequirement.put(userId, launchIntent);
                    changed = true;
                }
            }
        } else if (!enabled && (oldIntent != null)) {
            mSecondaryLockscreenRequirement.put(userId, null);
            changed = true;