private BackupConfig getBackupConfig(BackupType backupType, EnumSet<DataType> enabledTypes, BackupImapStore imapStore) { return new BackupConfig( imapStore, 0, getPreferences().getMaxItemsPerSync(), getPreferences().getBackupContactGroup(), backupType, enabledTypes, getPreferences().isAppLogDebug() ); }
@Before public void before() { initMocks(this); sentNotifications = new ArrayList<NotificationCompat.Builder>(); service = new SmsBackupService() { @Override public Context getApplicationContext() { return RuntimeEnvironment.application; } @Override public Resources getResources() { return getApplicationContext().getResources(); } @Override protected BackupTask getBackupTask() { return backupTask; } @Override protected BackupJobs getBackupJobs() { return backupJobs; } @Override protected Preferences getPreferences() { return preferences; } @Override public int checkPermission(String permission, int pid, int uid) { return PERMISSION_GRANTED; } @Override protected AuthPreferences getAuthPreferences() { return authPreferences; } @Override protected void notifyUser(int icon, NotificationCompat.Builder builder) { sentNotifications.add(builder); } }; shadowConnectivityManager = shadowOf(service.getConnectivityManager()); shadowWifiManager = shadowOf(service.getWifiManager()); service.onCreate(); when(authPreferences.getStoreUri()).thenReturn("imap+ssl+://xoauth:foooo@imap.gmail.com:993"); when(authPreferences.isLoginInformationSet()).thenReturn(true); when(preferences.getBackupContactGroup()).thenReturn(ContactGroup.EVERYBODY); when(preferences.isUseOldScheduler()).thenReturn(true); when(preferences.getDataTypePreferences()).thenReturn(dataTypePreferences); when(dataTypePreferences.enabled()).thenReturn(EnumSet.of(DataType.SMS)); }
public MessageConverter(Context context, Preferences preferences, String userEmail, PersonLookup personLookup, ContactAccessor contactAccessor) { this.context = context; markAsReadType = preferences.getMarkAsReadType(); this.personLookup = personLookup; markAsReadOnRestore = preferences.getMarkAsReadOnRestore(); String referenceUid = preferences.getReferenceUid(); if (referenceUid == null) { referenceUid = generateReferenceValue(); preferences.setReferenceUid(referenceUid); } final ContactGroup backupContactGroup = preferences.getBackupContactGroup(); ContactGroupIds allowedIds = contactAccessor.getGroupContactIds(context.getContentResolver(), backupContactGroup); if (LOCAL_LOGV) Log.v(TAG, "whitelisted ids for backup: " + allowedIds); messageGenerator = new MessageGenerator(context, new Address(userEmail), preferences.getEmailAddressStyle(), new HeaderGenerator(referenceUid, App.getVersionCode(context)), personLookup, preferences.getMailSubjectPrefix(), allowedIds, new MmsSupport(context.getContentResolver(), personLookup), preferences.getCallLogType(), preferences.getDataTypePreferences()); }