Magisk/app/src/main/java/com/topjohnwu/magisk/module/Module.java

59 lines
1.3 KiB
Java
Raw Normal View History

2016-08-22 23:18:28 +02:00
package com.topjohnwu.magisk.module;
2016-08-17 13:00:55 +02:00
import com.topjohnwu.magisk.utils.Logger;
2016-09-28 19:42:25 +02:00
import com.topjohnwu.magisk.utils.ModuleHelper;
2016-08-22 23:18:28 +02:00
import com.topjohnwu.magisk.utils.Utils;
public class Module extends BaseModule {
2016-08-17 13:00:55 +02:00
private String mRemoveFile;
private String mDisableFile;
private boolean mEnable, mRemove;
2016-08-29 00:35:07 +02:00
2016-09-27 09:51:38 +02:00
public Module(String path) {
2016-09-02 20:18:37 +02:00
2016-09-21 05:29:43 +02:00
parseProps(Utils.readFile(path + "/module.prop"));
mRemoveFile = path + "/remove";
mDisableFile = path + "/disable";
if (mId == null) {
int sep = path.lastIndexOf('/');
mId = path.substring(sep + 1);
}
if (mName == null)
mName = mId;
2016-09-06 23:54:08 +02:00
2016-09-27 18:33:01 +02:00
Logger.dev("Creating Module, id: " + mId);
2016-09-06 23:54:08 +02:00
mEnable = !Utils.itemExist(mDisableFile);
mRemove = Utils.itemExist(mRemoveFile);
2016-08-17 13:00:55 +02:00
}
public void createDisableFile() {
mEnable = !Utils.createFile(mDisableFile);
}
2016-08-22 19:44:34 +02:00
public void removeDisableFile() {
mEnable = Utils.removeFile(mDisableFile);
}
public boolean isEnabled() {
return mEnable;
}
public void createRemoveFile() {
mRemove = Utils.createFile(mRemoveFile);
}
2016-08-22 19:44:34 +02:00
public void deleteRemoveFile() {
mRemove = !Utils.removeFile(mRemoveFile);
}
public boolean willBeRemoved() {
return mRemove;
}
2016-08-17 13:00:55 +02:00
}