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

Commit d81683a9 authored by Automerger Merge Worker's avatar Automerger Merge Worker
Browse files

Merge "Merge "Unlock the work profile for remote input" into rvc-dev am:...

Merge "Merge "Unlock the work profile for remote input" into rvc-dev am: defcfd0b am: e38ac17b am: c44af184" into rvc-qpr-dev-plus-aosp am: 1327eeb2

Change-Id: I86ba8c44954dd97236e9dbc8d990646b136a14f0
parents df1f5de0 1327eeb2
Loading
Loading
Loading
Loading
+26 −5
Original line number Original line Diff line number Diff line
@@ -28,6 +28,7 @@ import android.app.RemoteInput;
import android.app.RemoteInputHistoryItem;
import android.app.RemoteInputHistoryItem;
import android.content.Context;
import android.content.Context;
import android.content.Intent;
import android.content.Intent;
import android.content.pm.UserInfo;
import android.net.Uri;
import android.net.Uri;
import android.os.Handler;
import android.os.Handler;
import android.os.RemoteException;
import android.os.RemoteException;
@@ -401,15 +402,35 @@ public class NotificationRemoteInputManager implements Dumpable {


        if (!mLockscreenUserManager.shouldAllowLockscreenRemoteInput()) {
        if (!mLockscreenUserManager.shouldAllowLockscreenRemoteInput()) {
            final int userId = pendingIntent.getCreatorUserHandle().getIdentifier();
            final int userId = pendingIntent.getCreatorUserHandle().getIdentifier();

            final boolean isLockedManagedProfile =
                    mUserManager.getUserInfo(userId).isManagedProfile()
                    && mKeyguardManager.isDeviceLocked(userId);

            final boolean isParentUserLocked;
            if (isLockedManagedProfile) {
                final UserInfo profileParent = mUserManager.getProfileParent(userId);
                isParentUserLocked = (profileParent != null)
                        && mKeyguardManager.isDeviceLocked(profileParent.id);
            } else {
                isParentUserLocked = false;
            }

            if (mLockscreenUserManager.isLockscreenPublicMode(userId)
            if (mLockscreenUserManager.isLockscreenPublicMode(userId)
                    || mStatusBarStateController.getState() == StatusBarState.KEYGUARD) {
                    || mStatusBarStateController.getState() == StatusBarState.KEYGUARD) {
                // Even if we don't have security we should go through this flow, otherwise we won't
                // If the parent user is no longer locked, and the user to which the remote input
                // go to the shade
                // is destined is a locked, managed profile, then onLockedWorkRemoteInput should be
                // called to unlock it.
                if (isLockedManagedProfile && !isParentUserLocked) {
                    mCallback.onLockedWorkRemoteInput(userId, row, view);
                } else {
                    // Even if we don't have security we should go through this flow, otherwise
                    // we won't go to the shade.
                    mCallback.onLockedRemoteInput(row, view);
                    mCallback.onLockedRemoteInput(row, view);
                }
                return true;
                return true;
            }
            }
            if (mUserManager.getUserInfo(userId).isManagedProfile()
            if (isLockedManagedProfile) {
                    && mKeyguardManager.isDeviceLocked(userId)) {
                mCallback.onLockedWorkRemoteInput(userId, row, view);
                mCallback.onLockedWorkRemoteInput(userId, row, view);
                return true;
                return true;
            }
            }