SynchronizeFolderOperation.java 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609
  1. /* ownCloud Android client application
  2. * Copyright (C) 2012-2014 ownCloud Inc.
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2,
  6. * as published by the Free Software Foundation.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. */
  17. package com.owncloud.android.operations;
  18. import java.io.File;
  19. import java.io.FileInputStream;
  20. import java.io.FileOutputStream;
  21. import java.io.IOException;
  22. import java.io.InputStream;
  23. import java.io.OutputStream;
  24. import java.util.ArrayList;
  25. import java.util.HashMap;
  26. import java.util.List;
  27. import java.util.Map;
  28. import java.util.Vector;
  29. import org.apache.http.HttpStatus;
  30. import android.accounts.Account;
  31. import android.content.Context;
  32. import android.content.Intent;
  33. import android.util.Log;
  34. //import android.support.v4.content.LocalBroadcastManager;
  35. import com.owncloud.android.datamodel.FileDataStorageManager;
  36. import com.owncloud.android.datamodel.OCFile;
  37. import com.owncloud.android.lib.common.OwnCloudClient;
  38. import com.owncloud.android.lib.common.operations.RemoteOperation;
  39. import com.owncloud.android.lib.common.operations.RemoteOperationResult;
  40. import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
  41. import com.owncloud.android.lib.common.utils.Log_OC;
  42. import com.owncloud.android.lib.resources.files.FileUtils;
  43. import com.owncloud.android.lib.resources.files.ReadRemoteFileOperation;
  44. import com.owncloud.android.lib.resources.files.ReadRemoteFolderOperation;
  45. import com.owncloud.android.lib.resources.files.RemoteFile;
  46. import com.owncloud.android.lib.resources.shares.GetRemoteSharesForFileOperation;
  47. import com.owncloud.android.lib.resources.shares.OCShare;
  48. import com.owncloud.android.syncadapter.FileSyncAdapter;
  49. import com.owncloud.android.utils.FileStorageUtils;
  50. /**
  51. * Remote operation performing the synchronization of the list of files contained
  52. * in a folder identified with its remote path.
  53. *
  54. * Fetches the list and properties of the files contained in the given folder, including their
  55. * properties, and updates the local database with them.
  56. *
  57. * Does NOT enter in the child folders to synchronize their contents also.
  58. *
  59. * @author David A. Velasco
  60. */
  61. public class SynchronizeFolderOperation extends RemoteOperation {
  62. private static final String TAG = SynchronizeFolderOperation.class.getSimpleName();
  63. public static final String EVENT_SINGLE_FOLDER_CONTENTS_SYNCED =
  64. SynchronizeFolderOperation.class.getName() + ".EVENT_SINGLE_FOLDER_CONTENTS_SYNCED";
  65. public static final String EVENT_SINGLE_FOLDER_SHARES_SYNCED =
  66. SynchronizeFolderOperation.class.getName() + ".EVENT_SINGLE_FOLDER_SHARES_SYNCED";
  67. /** Time stamp for the synchronization process in progress */
  68. private long mCurrentSyncTime;
  69. /** Remote folder to synchronize */
  70. private OCFile mLocalFolder;
  71. /** Access to the local database */
  72. private FileDataStorageManager mStorageManager;
  73. /** Account where the file to synchronize belongs */
  74. private Account mAccount;
  75. /** Android context; necessary to send requests to the download service */
  76. private Context mContext;
  77. /** Files and folders contained in the synchronized folder after a successful operation */
  78. private List<OCFile> mChildren;
  79. /** Counter of conflicts found between local and remote files */
  80. private int mConflictsFound;
  81. /** Counter of failed operations in synchronization of kept-in-sync files */
  82. private int mFailsInFavouritesFound;
  83. /**
  84. * Map of remote and local paths to files that where locally stored in a location
  85. * out of the ownCloud folder and couldn't be copied automatically into it
  86. **/
  87. private Map<String, String> mForgottenLocalFiles;
  88. /** 'True' means that this operation is part of a full account synchronization */
  89. private boolean mSyncFullAccount;
  90. /** 'True' means that Share resources bound to the files into should be refreshed also */
  91. private boolean mIsShareSupported;
  92. /** 'True' means that the remote folder changed and should be fetched */
  93. private boolean mRemoteFolderChanged;
  94. /** 'True' means that Etag will be ignored */
  95. private boolean mIgnoreETag;
  96. /**
  97. * Creates a new instance of {@link SynchronizeFolderOperation}.
  98. *
  99. * @param folder Folder to synchronize.
  100. * @param currentSyncTime Time stamp for the synchronization process in progress.
  101. * @param syncFullAccount 'True' means that this operation is part of a full account
  102. * synchronization.
  103. * @param isShareSupported 'True' means that the server supports the sharing API.
  104. * @param ignoreEtag 'True' means that the content of the remote folder should
  105. * be fetched and updated even though the 'eTag' did not
  106. * change.
  107. * @param dataStorageManager Interface with the local database.
  108. * @param account ownCloud account where the folder is located.
  109. * @param context Application context.
  110. */
  111. public SynchronizeFolderOperation( OCFile folder,
  112. long currentSyncTime,
  113. boolean syncFullAccount,
  114. boolean isShareSupported,
  115. boolean ignoreETag,
  116. FileDataStorageManager dataStorageManager,
  117. Account account,
  118. Context context ) {
  119. mLocalFolder = folder;
  120. mCurrentSyncTime = currentSyncTime;
  121. mSyncFullAccount = syncFullAccount;
  122. mIsShareSupported = isShareSupported;
  123. mStorageManager = dataStorageManager;
  124. mAccount = account;
  125. mContext = context;
  126. mForgottenLocalFiles = new HashMap<String, String>();
  127. mRemoteFolderChanged = false;
  128. mIgnoreETag = ignoreETag;
  129. }
  130. public int getConflictsFound() {
  131. return mConflictsFound;
  132. }
  133. public int getFailsInFavouritesFound() {
  134. return mFailsInFavouritesFound;
  135. }
  136. public Map<String, String> getForgottenLocalFiles() {
  137. return mForgottenLocalFiles;
  138. }
  139. /**
  140. * Returns the list of files and folders contained in the synchronized folder,
  141. * if called after synchronization is complete.
  142. *
  143. * @return List of files and folders contained in the synchronized folder.
  144. */
  145. public List<OCFile> getChildren() {
  146. return mChildren;
  147. }
  148. /**
  149. * Performs the synchronization.
  150. *
  151. * {@inheritDoc}
  152. */
  153. @Override
  154. protected RemoteOperationResult run(OwnCloudClient client) {
  155. RemoteOperationResult result = null;
  156. mFailsInFavouritesFound = 0;
  157. mConflictsFound = 0;
  158. mForgottenLocalFiles.clear();
  159. if (FileUtils.PATH_SEPARATOR.equals(mLocalFolder.getRemotePath()) && !mSyncFullAccount) {
  160. updateOCVersion(client);
  161. }
  162. result = checkForChanges(client);
  163. if (result.isSuccess()) {
  164. if (mRemoteFolderChanged) {
  165. result = fetchAndSyncRemoteFolder(client);
  166. } else {
  167. mChildren = mStorageManager.getFolderContent(mLocalFolder, false);
  168. }
  169. }
  170. if (!mSyncFullAccount) {
  171. sendLocalBroadcast(
  172. EVENT_SINGLE_FOLDER_CONTENTS_SYNCED, mLocalFolder.getRemotePath(), result
  173. );
  174. }
  175. if (result.isSuccess() && mIsShareSupported && !mSyncFullAccount) {
  176. refreshSharesForFolder(client); // share result is ignored
  177. }
  178. if (!mSyncFullAccount) {
  179. sendLocalBroadcast(
  180. EVENT_SINGLE_FOLDER_SHARES_SYNCED, mLocalFolder.getRemotePath(), result
  181. );
  182. }
  183. return result;
  184. }
  185. private void updateOCVersion(OwnCloudClient client) {
  186. UpdateOCVersionOperation update = new UpdateOCVersionOperation(mAccount, mContext);
  187. RemoteOperationResult result = update.execute(client);
  188. if (result.isSuccess()) {
  189. mIsShareSupported = update.getOCVersion().isSharedSupported();
  190. }
  191. }
  192. private RemoteOperationResult checkForChanges(OwnCloudClient client) {
  193. mRemoteFolderChanged = true;
  194. RemoteOperationResult result = null;
  195. String remotePath = null;
  196. remotePath = mLocalFolder.getRemotePath();
  197. Log_OC.d(TAG, "Checking changes in " + mAccount.name + remotePath);
  198. // remote request
  199. ReadRemoteFileOperation operation = new ReadRemoteFileOperation(remotePath);
  200. result = operation.execute(client);
  201. if (result.isSuccess()){
  202. OCFile remoteFolder = FileStorageUtils.fillOCFile((RemoteFile) result.getData().get(0));
  203. if (!mIgnoreETag) {
  204. // check if remote and local folder are different
  205. mRemoteFolderChanged =
  206. !(remoteFolder.getEtag().equalsIgnoreCase(mLocalFolder.getEtag()));
  207. }
  208. result = new RemoteOperationResult(ResultCode.OK);
  209. Log_OC.i(TAG, "Checked " + mAccount.name + remotePath + " : " +
  210. (mRemoteFolderChanged ? "changed" : "not changed"));
  211. } else {
  212. // check failed
  213. if (result.getCode() == ResultCode.FILE_NOT_FOUND) {
  214. removeLocalFolder();
  215. }
  216. if (result.isException()) {
  217. Log_OC.e(TAG, "Checked " + mAccount.name + remotePath + " : " +
  218. result.getLogMessage(), result.getException());
  219. } else {
  220. Log_OC.e(TAG, "Checked " + mAccount.name + remotePath + " : " +
  221. result.getLogMessage());
  222. }
  223. }
  224. return result;
  225. }
  226. private RemoteOperationResult fetchAndSyncRemoteFolder(OwnCloudClient client) {
  227. String remotePath = mLocalFolder.getRemotePath();
  228. ReadRemoteFolderOperation operation = new ReadRemoteFolderOperation(remotePath);
  229. RemoteOperationResult result = operation.execute(client);
  230. Log_OC.d(TAG, "Synchronizing " + mAccount.name + remotePath);
  231. if (result.isSuccess()) {
  232. synchronizeData(result.getData(), client);
  233. if (mConflictsFound > 0 || mFailsInFavouritesFound > 0) {
  234. result = new RemoteOperationResult(ResultCode.SYNC_CONFLICT);
  235. // should be a different result code, but will do the job
  236. }
  237. } else {
  238. if (result.getCode() == ResultCode.FILE_NOT_FOUND)
  239. removeLocalFolder();
  240. }
  241. return result;
  242. }
  243. private void removeLocalFolder() {
  244. if (mStorageManager.fileExists(mLocalFolder.getFileId())) {
  245. String currentSavePath = FileStorageUtils.getSavePath(mAccount.name);
  246. mStorageManager.removeFolder(
  247. mLocalFolder,
  248. true,
  249. ( mLocalFolder.isDown() &&
  250. mLocalFolder.getStoragePath().startsWith(currentSavePath)
  251. )
  252. );
  253. }
  254. }
  255. /**
  256. * Synchronizes the data retrieved from the server about the contents of the target folder
  257. * with the current data in the local database.
  258. *
  259. * Grants that mChildren is updated with fresh data after execution.
  260. *
  261. * @param folderAndFiles Remote folder and children files in Folder
  262. *
  263. * @param client Client instance to the remote server where the data were
  264. * retrieved.
  265. * @return 'True' when any change was made in the local data, 'false' otherwise
  266. */
  267. private void synchronizeData(ArrayList<Object> folderAndFiles, OwnCloudClient client) {
  268. // get 'fresh data' from the database
  269. mLocalFolder = mStorageManager.getFileByPath(mLocalFolder.getRemotePath());
  270. // parse data from remote folder
  271. OCFile remoteFolder = fillOCFile((RemoteFile)folderAndFiles.get(0));
  272. remoteFolder.setParentId(mLocalFolder.getParentId());
  273. remoteFolder.setFileId(mLocalFolder.getFileId());
  274. Log_OC.d(TAG, "Remote folder " + mLocalFolder.getRemotePath()
  275. + " changed - starting update of local data ");
  276. List<OCFile> updatedFiles = new Vector<OCFile>(folderAndFiles.size() - 1);
  277. List<SynchronizeFileOperation> filesToSyncContents = new Vector<SynchronizeFileOperation>();
  278. // get current data about local contents of the folder to synchronize
  279. List<OCFile> localFiles = mStorageManager.getFolderContent(mLocalFolder, false);
  280. Map<String, OCFile> localFilesMap = new HashMap<String, OCFile>(localFiles.size());
  281. for (OCFile file : localFiles) {
  282. localFilesMap.put(file.getRemotePath(), file);
  283. }
  284. // loop to update every child
  285. OCFile remoteFile = null, localFile = null;
  286. for (int i=1; i<folderAndFiles.size(); i++) {
  287. /// new OCFile instance with the data from the server
  288. remoteFile = fillOCFile((RemoteFile)folderAndFiles.get(i));
  289. remoteFile.setParentId(mLocalFolder.getFileId());
  290. /// retrieve local data for the read file
  291. // localFile = mStorageManager.getFileByPath(remoteFile.getRemotePath());
  292. localFile = localFilesMap.remove(remoteFile.getRemotePath());
  293. /// add to the remoteFile (the new one) data about LOCAL STATE (not existing in server)
  294. remoteFile.setLastSyncDateForProperties(mCurrentSyncTime);
  295. if (localFile != null) {
  296. // some properties of local state are kept unmodified
  297. remoteFile.setFileId(localFile.getFileId());
  298. remoteFile.setKeepInSync(localFile.keepInSync());
  299. remoteFile.setLastSyncDateForData(localFile.getLastSyncDateForData());
  300. remoteFile.setModificationTimestampAtLastSyncForData(
  301. localFile.getModificationTimestampAtLastSyncForData()
  302. );
  303. remoteFile.setStoragePath(localFile.getStoragePath());
  304. // eTag will not be updated unless contents are synchronized
  305. // (Synchronize[File|Folder]Operation with remoteFile as parameter)
  306. remoteFile.setEtag(localFile.getEtag());
  307. if (remoteFile.isFolder()) {
  308. remoteFile.setFileLength(localFile.getFileLength());
  309. // TODO move operations about size of folders to FileContentProvider
  310. } else if (mRemoteFolderChanged && remoteFile.isImage() &&
  311. remoteFile.getModificationTimestamp() != localFile.getModificationTimestamp()) {
  312. remoteFile.setNeedsUpdateThumbnail(true);
  313. Log.d(TAG, "Image " + remoteFile.getFileName() + " updated on the server");
  314. }
  315. remoteFile.setPublicLink(localFile.getPublicLink());
  316. remoteFile.setShareByLink(localFile.isShareByLink());
  317. } else {
  318. // remote eTag will not be updated unless contents are synchronized
  319. // (Synchronize[File|Folder]Operation with remoteFile as parameter)
  320. remoteFile.setEtag("");
  321. }
  322. /// check and fix, if needed, local storage path
  323. checkAndFixForeignStoragePath(remoteFile); // policy - local files are COPIED
  324. // into the ownCloud local folder;
  325. searchForLocalFileInDefaultPath(remoteFile); // legacy
  326. /// prepare content synchronization for kept-in-sync files
  327. if (remoteFile.keepInSync()) {
  328. SynchronizeFileOperation operation = new SynchronizeFileOperation( localFile,
  329. remoteFile,
  330. mAccount,
  331. true,
  332. mContext
  333. );
  334. filesToSyncContents.add(operation);
  335. }
  336. updatedFiles.add(remoteFile);
  337. }
  338. // save updated contents in local database
  339. mStorageManager.saveFolder(remoteFolder, updatedFiles, localFilesMap.values());
  340. // request for the synchronization of file contents AFTER saving current remote properties
  341. startContentSynchronizations(filesToSyncContents, client);
  342. mChildren = updatedFiles;
  343. }
  344. /**
  345. * Performs a list of synchronization operations, determining if a download or upload is needed
  346. * or if exists conflict due to changes both in local and remote contents of the each file.
  347. *
  348. * If download or upload is needed, request the operation to the corresponding service and goes
  349. * on.
  350. *
  351. * @param filesToSyncContents Synchronization operations to execute.
  352. * @param client Interface to the remote ownCloud server.
  353. */
  354. private void startContentSynchronizations(
  355. List<SynchronizeFileOperation> filesToSyncContents, OwnCloudClient client
  356. ) {
  357. RemoteOperationResult contentsResult = null;
  358. for (SynchronizeFileOperation op: filesToSyncContents) {
  359. contentsResult = op.execute(mStorageManager, mContext); // async
  360. if (!contentsResult.isSuccess()) {
  361. if (contentsResult.getCode() == ResultCode.SYNC_CONFLICT) {
  362. mConflictsFound++;
  363. } else {
  364. mFailsInFavouritesFound++;
  365. if (contentsResult.getException() != null) {
  366. Log_OC.e(TAG, "Error while synchronizing favourites : "
  367. + contentsResult.getLogMessage(), contentsResult.getException());
  368. } else {
  369. Log_OC.e(TAG, "Error while synchronizing favourites : "
  370. + contentsResult.getLogMessage());
  371. }
  372. }
  373. } // won't let these fails break the synchronization process
  374. }
  375. }
  376. public boolean isMultiStatus(int status) {
  377. return (status == HttpStatus.SC_MULTI_STATUS);
  378. }
  379. /**
  380. * Creates and populates a new {@link OCFile} object with the data read from the server.
  381. *
  382. * @param remote remote file read from the server (remote file or folder).
  383. * @return New OCFile instance representing the remote resource described by we.
  384. */
  385. private OCFile fillOCFile(RemoteFile remote) {
  386. OCFile file = new OCFile(remote.getRemotePath());
  387. file.setCreationTimestamp(remote.getCreationTimestamp());
  388. file.setFileLength(remote.getLength());
  389. file.setMimetype(remote.getMimeType());
  390. file.setModificationTimestamp(remote.getModifiedTimestamp());
  391. file.setEtag(remote.getEtag());
  392. file.setPermissions(remote.getPermissions());
  393. file.setRemoteId(remote.getRemoteId());
  394. return file;
  395. }
  396. /**
  397. * Checks the storage path of the OCFile received as parameter.
  398. * If it's out of the local ownCloud folder, tries to copy the file inside it.
  399. *
  400. * If the copy fails, the link to the local file is nullified. The account of forgotten
  401. * files is kept in {@link #mForgottenLocalFiles}
  402. *)
  403. * @param file File to check and fix.
  404. */
  405. private void checkAndFixForeignStoragePath(OCFile file) {
  406. String storagePath = file.getStoragePath();
  407. String expectedPath = FileStorageUtils.getDefaultSavePathFor(mAccount.name, file);
  408. if (storagePath != null && !storagePath.equals(expectedPath)) {
  409. /// fix storagePaths out of the local ownCloud folder
  410. File originalFile = new File(storagePath);
  411. if (FileStorageUtils.getUsableSpace(mAccount.name) < originalFile.length()) {
  412. mForgottenLocalFiles.put(file.getRemotePath(), storagePath);
  413. file.setStoragePath(null);
  414. } else {
  415. InputStream in = null;
  416. OutputStream out = null;
  417. try {
  418. File expectedFile = new File(expectedPath);
  419. File expectedParent = expectedFile.getParentFile();
  420. expectedParent.mkdirs();
  421. if (!expectedParent.isDirectory()) {
  422. throw new IOException(
  423. "Unexpected error: parent directory could not be created"
  424. );
  425. }
  426. expectedFile.createNewFile();
  427. if (!expectedFile.isFile()) {
  428. throw new IOException("Unexpected error: target file could not be created");
  429. }
  430. in = new FileInputStream(originalFile);
  431. out = new FileOutputStream(expectedFile);
  432. byte[] buf = new byte[1024];
  433. int len;
  434. while ((len = in.read(buf)) > 0){
  435. out.write(buf, 0, len);
  436. }
  437. file.setStoragePath(expectedPath);
  438. } catch (Exception e) {
  439. Log_OC.e(TAG, "Exception while copying foreign file " + expectedPath, e);
  440. mForgottenLocalFiles.put(file.getRemotePath(), storagePath);
  441. file.setStoragePath(null);
  442. } finally {
  443. try {
  444. if (in != null) in.close();
  445. } catch (Exception e) {
  446. Log_OC.d(TAG, "Weird exception while closing input stream for "
  447. + storagePath + " (ignoring)", e);
  448. }
  449. try {
  450. if (out != null) out.close();
  451. } catch (Exception e) {
  452. Log_OC.d(TAG, "Weird exception while closing output stream for "
  453. + expectedPath + " (ignoring)", e);
  454. }
  455. }
  456. }
  457. }
  458. }
  459. private RemoteOperationResult refreshSharesForFolder(OwnCloudClient client) {
  460. RemoteOperationResult result = null;
  461. // remote request
  462. GetRemoteSharesForFileOperation operation =
  463. new GetRemoteSharesForFileOperation(mLocalFolder.getRemotePath(), false, true);
  464. result = operation.execute(client);
  465. if (result.isSuccess()) {
  466. // update local database
  467. ArrayList<OCShare> shares = new ArrayList<OCShare>();
  468. for(Object obj: result.getData()) {
  469. shares.add((OCShare) obj);
  470. }
  471. mStorageManager.saveSharesInFolder(shares, mLocalFolder);
  472. }
  473. return result;
  474. }
  475. /**
  476. * Scans the default location for saving local copies of files searching for
  477. * a 'lost' file with the same full name as the {@link OCFile} received as
  478. * parameter.
  479. *
  480. * @param file File to associate a possible 'lost' local file.
  481. */
  482. private void searchForLocalFileInDefaultPath(OCFile file) {
  483. if (file.getStoragePath() == null && !file.isFolder()) {
  484. File f = new File(FileStorageUtils.getDefaultSavePathFor(mAccount.name, file));
  485. if (f.exists()) {
  486. file.setStoragePath(f.getAbsolutePath());
  487. file.setLastSyncDateForData(f.lastModified());
  488. }
  489. }
  490. }
  491. /**
  492. * Sends a message to any application component interested in the progress
  493. * of the synchronization.
  494. *
  495. * @param event
  496. * @param dirRemotePath Remote path of a folder that was just synchronized
  497. * (with or without success)
  498. * @param result
  499. */
  500. private void sendLocalBroadcast(
  501. String event, String dirRemotePath, RemoteOperationResult result
  502. ) {
  503. Log_OC.d(TAG, "Send broadcast " + event);
  504. Intent intent = new Intent(event);
  505. intent.putExtra(FileSyncAdapter.EXTRA_ACCOUNT_NAME, mAccount.name);
  506. if (dirRemotePath != null) {
  507. intent.putExtra(FileSyncAdapter.EXTRA_FOLDER_PATH, dirRemotePath);
  508. }
  509. intent.putExtra(FileSyncAdapter.EXTRA_RESULT, result);
  510. mContext.sendStickyBroadcast(intent);
  511. //LocalBroadcastManager.getInstance(mContext).sendBroadcast(intent);
  512. }
  513. public boolean getRemoteFolderChanged() {
  514. return mRemoteFolderChanged;
  515. }
  516. }