Retrieve effectiveUserId after userId is set/re-set

Fixes: 123502937

Test: Followed steps in comment #1 of the first bug above
      Note that the test should be done with unified lock disabled, e.g.
      have separate pin/pattern/pass for owner and work profile

Change-Id: I01d66a8a1d3ed1811497c2acb7db6158d99727a0
This commit is contained in:
Kevin Chyn
2019-02-05 18:55:52 -08:00
parent 9ffe6f2d7e
commit e264bf3f66

View File

@@ -157,7 +157,6 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
boolean frp = KeyguardManager.ACTION_CONFIRM_FRP_CREDENTIAL.equals(intent.getAction()); boolean frp = KeyguardManager.ACTION_CONFIRM_FRP_CREDENTIAL.equals(intent.getAction());
mUserId = UserHandle.myUserId(); mUserId = UserHandle.myUserId();
final int effectiveUserId = mUserManager.getCredentialOwnerProfile(mUserId);
if (isInternalActivity()) { if (isInternalActivity()) {
try { try {
mUserId = Utils.getUserIdFromBundle(this, intent.getExtras()); mUserId = Utils.getUserIdFromBundle(this, intent.getExtras());
@@ -165,6 +164,7 @@ public class ConfirmDeviceCredentialActivity extends FragmentActivity {
Log.e(TAG, "Invalid intent extra", se); Log.e(TAG, "Invalid intent extra", se);
} }
} }
final int effectiveUserId = mUserManager.getCredentialOwnerProfile(mUserId);
final boolean isManagedProfile = UserManager.get(this).isManagedProfile(mUserId); final boolean isManagedProfile = UserManager.get(this).isManagedProfile(mUserId);
// if the client app did not hand in a title and we are about to show the work challenge, // if the client app did not hand in a title and we are about to show the work challenge,
// check whether there is a policy setting the organization name and use that as title // check whether there is a policy setting the organization name and use that as title