diff --git a/common b/common index 7c3e3aafb7..d9ba441b65 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 7c3e3aafb737bfff3d39111700b358a7b8791454 +Subproject commit d9ba441b65de5bfafb6b7c711c86b1db008f10ea diff --git a/msal/src/main/java/com/microsoft/identity/client/SingleAccountPublicClientApplication.java b/msal/src/main/java/com/microsoft/identity/client/SingleAccountPublicClientApplication.java index ee8757c32d..2ce70e2f9f 100644 --- a/msal/src/main/java/com/microsoft/identity/client/SingleAccountPublicClientApplication.java +++ b/msal/src/main/java/com/microsoft/identity/client/SingleAccountPublicClientApplication.java @@ -144,7 +144,13 @@ public void onTaskCompleted(final List result) { // To simplify the logic, if more than one account is returned, the first account will be picked. // We do not support switching from MULTIPLE to SINGLE. // See getAccountFromICacheRecordList() for more details. + Logger.info(TAG, "onTaskCompleted of getCurrentAccount, result size is "+ result.size()); final MultiTenantAccount oldAccount = getPersistedCurrentAccount(); + if (oldAccount != null) + Logger.info(TAG, "onTaskCompleted of getCurrentAccount, oldAccount is "+ oldAccount.getUsername() + " with id "+oldAccount.getId()); + else { + Logger.info(TAG, "onTaskCompleted of getCurrentAccount, oldAccount is null"); + } persistCurrentAccount(result); checkCurrentAccountNotifyCallback(callback, result, oldAccount); } @@ -179,6 +185,7 @@ public ICurrentAccountResult getCurrentAccount() throws InterruptedException, Ms new CurrentAccountCallback() { @Override public void onAccountLoaded(@Nullable final IAccount activeAccount) { + Logger.info(TAG, "calling onAccountLoaded with account "+activeAccount.getUsername()); final CurrentAccountResult currentAccountResult = new CurrentAccountResult( activeAccount, null, @@ -191,6 +198,7 @@ public void onAccountLoaded(@Nullable final IAccount activeAccount) { @Override public void onAccountChanged(@Nullable final IAccount priorAccount, @Nullable final IAccount currentAccount) { + final CurrentAccountResult currentAccountResult = new CurrentAccountResult( currentAccount, priorAccount, @@ -234,9 +242,10 @@ private void checkCurrentAccountNotifyCallback(@NonNull final CurrentAccountCall : getAccountFromICacheRecordList(newAccountRecords); if (!isHomeAccountIdMatching(oldAccount, newAccount)) { + Logger.info(TAG,"in checkCurrentAccountNotifyCallback homeAccount is not matching the old one!, hence calling onAccountChanged"); callback.onAccountChanged(oldAccount, newAccount); } - + Logger.info(TAG,"calling onAccountLoaded with new account "+ newAccount.getUsername()); callback.onAccountLoaded(newAccount); } @@ -600,6 +609,12 @@ private MultiTenantAccount getPersistedCurrentAccount() { * Please note that this layer will not verify if the list belongs to a single account or not. */ private void persistCurrentAccount(@Nullable final List cacheRecords) { + Logger.info( + TAG, "in persistCurrentAccount to persist following records in sharedPref"); + for (ICacheRecord cacheRecord : cacheRecords) { + Logger.info( + TAG,cacheRecord.getAccount().getUsername()); + } synchronized(SingleAccountPublicClientApplication.class) { if (cacheRecords == null || cacheRecords.size() == 0) { sharedPreferencesFileManager.clear(); @@ -628,13 +643,13 @@ private MultiTenantAccount getAccountFromICacheRecordList(@NonNull final List account = AccountAdapter.adapt(cacheRecords); if (account.size() != 1) { - Logger.verbose( + Logger.info( methodTag, "Returned cacheRecords were adapted into multiple IAccount. " + "This is unexpected in Single account mode." + "Returning the first adapted account."); } - + Logger.info(methodTag, "getAccountFromICacheRecordList returned account, username is "+ account.get(0).getUsername()); return (MultiTenantAccount) account.get(0); }