[core] Fix config manager
This commit is contained in:
parent
4d3cf0f16a
commit
9913da0b24
|
|
@ -83,7 +83,7 @@ public class ConfigManager {
|
||||||
|
|
||||||
private void writeText(@NonNull File file, String value) {
|
private void writeText(@NonNull File file, String value) {
|
||||||
try {
|
try {
|
||||||
Files.write(file.toPath(), value.getBytes(), StandardOpenOption.CREATE_NEW);
|
Files.write(file.toPath(), value.getBytes(), StandardOpenOption.CREATE);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, Log.getStackTraceString(e));
|
Log.e(TAG, Log.getStackTraceString(e));
|
||||||
}
|
}
|
||||||
|
|
@ -104,7 +104,7 @@ public class ConfigManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized void updateConfig() {
|
private synchronized void updateConfig() {
|
||||||
resourceHook = resourceHookSwitch.exists();
|
resourceHook = readInt(resourceHookSwitch, 0) == 1;
|
||||||
variant = readInt(variantSwitch, -1);
|
variant = readInt(variantSwitch, -1);
|
||||||
verboseLog = readInt(verboseLogSwitch, 0) == 1;
|
verboseLog = readInt(verboseLogSwitch, 0) == 1;
|
||||||
miscPath = "/data/misc/" + readText(miscFile, "lspd");
|
miscPath = "/data/misc/" + readText(miscFile, "lspd");
|
||||||
|
|
@ -336,14 +336,17 @@ public class ConfigManager {
|
||||||
|
|
||||||
public void setResourceHook(boolean resourceHook) {
|
public void setResourceHook(boolean resourceHook) {
|
||||||
writeInt(resourceHookSwitch, resourceHook ? 1 : 0);
|
writeInt(resourceHookSwitch, resourceHook ? 1 : 0);
|
||||||
|
this.resourceHook = resourceHook;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVerboseLog(boolean verboseLog) {
|
public void setVerboseLog(boolean verboseLog) {
|
||||||
writeInt(verboseLogSwitch, verboseLog ? 1 : 0);
|
writeInt(verboseLogSwitch, verboseLog ? 1 : 0);
|
||||||
|
this.verboseLog = verboseLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setVariant(int variant) {
|
public void setVariant(int variant) {
|
||||||
writeInt(variantSwitch, variant);
|
writeInt(variantSwitch, variant);
|
||||||
|
this.variant = variant;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isPermissive() {
|
public boolean isPermissive() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue