@Deprecated @Override public void startSync(long mailboxId, boolean userRequest, int deltaMessageCount) throws RemoteException { final Mailbox mailbox = Mailbox.restoreMailboxWithId(mContext, mailboxId); if (mailbox == null) return; final Account account = Account.restoreAccountWithId(mContext, mailbox.mAccountKey); if (account == null) return; final EmailServiceInfo info = EmailServiceUtils.getServiceInfoForAccount(mContext, account.mId); final android.accounts.Account acct = new android.accounts.Account(account.mEmailAddress, info.accountType); final Bundle extras = Mailbox.createSyncBundle(mailboxId); if (userRequest) { extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); extras.putBoolean(ContentResolver.SYNC_EXTRAS_DO_NOT_RETRY, true); extras.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); } if (deltaMessageCount != 0) { extras.putInt(Mailbox.SYNC_EXTRA_DELTA_MESSAGE_COUNT, deltaMessageCount); } ContentResolver.requestSync(acct, EmailContent.AUTHORITY, extras); LogUtils.i( Logging.LOG_TAG, "requestSync EmailServiceStub startSync %s, %s", account.toString(), extras.toString()); }
/** Starts all remote services */ public static void setRemoteServicesLogging(Context context, int debugBits) { for (EmailServiceInfo info : getServiceInfoList(context)) { if (info.intentAction != null) { EmailServiceProxy service = EmailServiceUtils.getService(context, info.protocol); if (service != null) { try { service.setLogging(debugBits); } catch (RemoteException e) { // Move along, nothing to see } } } } }
private static void syncAccount(final Context context, final Account account) { final EmailServiceUtils.EmailServiceInfo info = EmailServiceUtils.getServiceInfo(context, account.getProtocol(context)); final android.accounts.Account amAccount = new android.accounts.Account(account.mEmailAddress, info.accountType); final Bundle extras = new Bundle(3); extras.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, true); extras.putBoolean(ContentResolver.SYNC_EXTRAS_DO_NOT_RETRY, true); extras.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, true); ContentResolver.requestSync(amAccount, EmailContent.AUTHORITY, extras); LogUtils.i( TAG, "requestSync SecurityPolicy syncAccount %s, %s", account.toString(), extras.toString()); }