Search in sources :

Example 1 with AccountManagerAddAccountStrategy

use of com.microsoft.identity.common.internal.broker.ipc.AccountManagerAddAccountStrategy in project microsoft-authentication-library-common-for-android by AzureAD.

the class BrokerMsalController method getIpcStrategies.

/**
 * Gets a list of communication strategies.
 * Order of objects in the list will reflects the order of strategies that will be used.
 */
@NonNull
private static List<IIpcStrategy> getIpcStrategies(final Context applicationContext, final String activeBrokerPackageName) {
    final List<IIpcStrategy> strategies = new ArrayList<>();
    final StringBuilder sb = new StringBuilder(100);
    sb.append("Broker Strategies added : ");
    final ContentProviderStrategy contentProviderStrategy = new ContentProviderStrategy(applicationContext);
    if (contentProviderStrategy.isBrokerContentProviderAvailable(activeBrokerPackageName)) {
        sb.append("ContentProviderStrategy, ");
        strategies.add(contentProviderStrategy);
    }
    final MicrosoftAuthClient client = new MicrosoftAuthClient(applicationContext);
    if (client.isBoundServiceSupported(activeBrokerPackageName)) {
        sb.append("BoundServiceStrategy, ");
        strategies.add(new BoundServiceStrategy<>(client));
    }
    if (AccountManagerUtil.canUseAccountManagerOperation(applicationContext)) {
        sb.append("AccountManagerStrategy.");
        strategies.add(new AccountManagerAddAccountStrategy(applicationContext));
    }
    Logger.info(TAG, sb.toString());
    return strategies;
}
Also used : ContentProviderStrategy(com.microsoft.identity.common.internal.broker.ipc.ContentProviderStrategy) IIpcStrategy(com.microsoft.identity.common.internal.broker.ipc.IIpcStrategy) ArrayList(java.util.ArrayList) MicrosoftAuthClient(com.microsoft.identity.common.internal.broker.MicrosoftAuthClient) AccountManagerAddAccountStrategy(com.microsoft.identity.common.internal.broker.ipc.AccountManagerAddAccountStrategy) NonNull(androidx.annotation.NonNull)

Aggregations

NonNull (androidx.annotation.NonNull)1 MicrosoftAuthClient (com.microsoft.identity.common.internal.broker.MicrosoftAuthClient)1 AccountManagerAddAccountStrategy (com.microsoft.identity.common.internal.broker.ipc.AccountManagerAddAccountStrategy)1 ContentProviderStrategy (com.microsoft.identity.common.internal.broker.ipc.ContentProviderStrategy)1 IIpcStrategy (com.microsoft.identity.common.internal.broker.ipc.IIpcStrategy)1 ArrayList (java.util.ArrayList)1