mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-30 00:01:19 +00:00
Added workaround for broken inotify on Marshmallow
This commit is contained in:
parent
336aec5251
commit
b38a152f6a
1 changed files with 15 additions and 9 deletions
|
@ -59,8 +59,6 @@ public class ConfigXml {
|
|||
*/
|
||||
public static final String CONFIG_FILE = "config.xml";
|
||||
|
||||
private static final int OPEN_CONFIG_MAX_TRIES = 10;
|
||||
|
||||
private final Context mContext;
|
||||
|
||||
private final File mConfigFile;
|
||||
|
@ -76,13 +74,11 @@ public class ConfigXml {
|
|||
generateKeysConfig(context);
|
||||
}
|
||||
|
||||
for (int i = 0; i < OPEN_CONFIG_MAX_TRIES && mConfig == null; i++) {
|
||||
try {
|
||||
DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||
mConfig = db.parse(mConfigFile);
|
||||
} catch (SAXException | ParserConfigurationException | IOException e) {
|
||||
throw new OpenConfigException();
|
||||
}
|
||||
try {
|
||||
DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||
mConfig = db.parse(mConfigFile);
|
||||
} catch (SAXException | ParserConfigurationException | IOException e) {
|
||||
throw new OpenConfigException();
|
||||
}
|
||||
|
||||
if (isFirstStart) {
|
||||
|
@ -139,6 +135,16 @@ public class ConfigXml {
|
|||
changed = true;
|
||||
}
|
||||
|
||||
// FileObserver does not work correctly on Android Marshmallow.
|
||||
// Nougat seems to have the same problem in emulator, but we should check this again.
|
||||
// https://code.google.com/p/android/issues/detail?id=189231
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (!r.getAttribute("rescanIntervalS").equals("60")) {
|
||||
r.setAttribute("rescanIntervalS", "60");
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (applyHashers(r)) {
|
||||
changed = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue