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

Commit 00ab85ed authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix crash when viewing or editing contacts without account" into oc-dev

parents 47af0f49 c20d688f
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -580,9 +580,9 @@ class AccountTypeManagerImpl extends AccountTypeManager
        if (account == null) {
            return null;
        }
        final AccountType type = mTypeProvider.getTypeForAccount(account);
        AccountType type = mTypeProvider.getTypeForAccount(account);
        if (type == null) {
            return null;
            type = mFallbackAccountType;
        }
        return type.wrapAccount(mContext, account);
    }
@@ -703,7 +703,8 @@ class AccountTypeManagerImpl extends AccountTypeManager
     */
    @Override
    public AccountType getAccountType(AccountTypeWithDataSet accountTypeWithDataSet) {
        return mTypeProvider.getType(
        final AccountType type = mTypeProvider.getType(
                accountTypeWithDataSet.accountType, accountTypeWithDataSet.dataSet);
        return type != null ? type : mFallbackAccountType;
    }
}
+14 −0
Original line number Diff line number Diff line
@@ -93,4 +93,18 @@ public class FallbackAccountType extends BaseAccountType {
    public boolean areContactsWritable() {
        return true;
    }


    /**
     * {@inheritDoc}
     *
     * <p>This is overriden because the base class validates that the account.type matches
     * {@link #accountType} but for the fallback case we want to be more permissive</p>
     */
    @Override
    public AccountInfo wrapAccount(Context context, AccountWithDataSet account) {
        return new AccountInfo(
                new AccountDisplayInfo(account, account.name,
                        getDisplayLabel(context), getDisplayIcon(context), false), this);
    }
}