Java Code Examples for com.grarak.kerneladiutor.utils.Utils#readFile()

The following examples show how to use com.grarak.kerneladiutor.utils.Utils#readFile() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ZRAM.java    From KernelAdiutor with GNU General Public License v3.0 6 votes vote down vote up
public static void setDisksize(final int value, final Context context) {
    String maxCompStrems = null;
    if (Utils.existFile(MAX_COMP_STREAMS)) {
        maxCompStrems = Utils.readFile(MAX_COMP_STREAMS);
    }
    int size = value * 1024 * 1024;
    run("swapoff " + BLOCK + " > /dev/null 2>&1", BLOCK + "swapoff", context);
    run(Control.write("1", RESET), RESET, context);
    run(Control.write("0", DISKSIZE), DISKSIZE + "reset", context);
    if (maxCompStrems != null) {
        run(Control.write(maxCompStrems, MAX_COMP_STREAMS), MAX_COMP_STREAMS, context);
    }
    if (size != 0) {
        run(Control.write(String.valueOf(size), DISKSIZE), DISKSIZE, context);
        run("mkswap " + BLOCK + " > /dev/null 2>&1", BLOCK + "mkswap", context);
        run("swapon " + BLOCK + " > /dev/null 2>&1", BLOCK + "swapon", context);
    }
}
 
Example 2
Source File: SupportedDownloads.java    From KernelAdiutor with GNU General Public License v3.0 6 votes vote down vote up
public SupportedDownloads(Context context) {
    try {
        String json = Utils.existFile(context.getFilesDir() + "/downloads.json") ?
                Utils.readFile(context.getFilesDir() + "/downloads.json", false) :
                Utils.readAssetFile(context, "downloads.json");
        JSONArray devices = new JSONArray(json);
        for (int i = 0; i < devices.length(); i++) {
            JSONObject device = devices.getJSONObject(i);
            JSONArray vendors = device.getJSONArray("vendor");
            for (int x = 0; x < vendors.length(); x++) {
                if (vendors.getString(x).equals(Device.getVendor())) {
                    JSONArray names = device.getJSONArray("device");
                    for (int y = 0; y < names.length(); y++) {
                        if (names.getString(y).equals(Device.getDeviceName())) {
                            mLink = device.getString("link");
                        }
                    }
                }
            }
        }
    } catch (JSONException e) {
        Utils.toast("Failed to read downloads.json " + e.getMessage(), context);
    }
}
 
Example 3
Source File: LogsFragment.java    From KA27 with Apache License 2.0 5 votes vote down vote up
private String sysfsrecord(String file) {
    String ret = "";
    RootFile sysfspath = new RootFile(file);
    if (sysfspath.isDirectory()) return ret = sysfspathIsdirectory(file);
    else {
        Log.i(Constants.TAG, "Path: " + file + " | Value: " + Utils.readFile(file));
        return ret = ret + "Path: " + file + " | Value: " + Utils.readFile(file) + "\n";
    }
}
 
Example 4
Source File: CPU.java    From KA27 with Apache License 2.0 5 votes vote down vote up
public static int getCurFreq(int core) {
    if (Utils.existFile(String.format(Locale.US, CPU_CUR_FREQ, core))) {
        String value = Utils.readFile(String.format(Locale.US, CPU_CUR_FREQ, core));
        if (value != null) return Utils.stringToInt(value);
    }
    return 0;
}
 
Example 5
Source File: KSM.java    From KA27 with Apache License 2.0 5 votes vote down vote up
public static List < String > getCpuGovs() {
    String file = getKsmFile(UKSM_CPU_GOV);
    if (Utils.existFile(file)) {
        String values = Utils.readFile(file);
        if (values != null) {
            String[] valueArray = values.split(" ");
            String[] out = new String[valueArray.length];

            for (int i = 0; i < valueArray.length; i++)
                out[i] = valueArray[i].replace("[", "").replace("]", "");
            return new ArrayList < > (Arrays.asList(out));
        }
    }
    return null;
}
 
Example 6
Source File: Thermal.java    From kernel_adiutor with Apache License 2.0 5 votes vote down vote up
public static boolean isTempThrottleActive() {
    String temp = Utils.readFile(MSM_THERMAL_TEMP_THROTTLE);
    if (temp.equals("Y") || temp.equals("1")) {
        return true;
    }
    return false;
}
 
Example 7
Source File: Screen.java    From kernel_adiutor with Apache License 2.0 5 votes vote down vote up
public static GammaProfiles.DsiPanelProfiles getDsiPanelProfiles(Context context) {
    if (GAMMA_PROFILES == null) {
        if (Utils.existFile(context.getFilesDir() + "/gamma_profiles.json")) {
            GAMMA_PROFILES = new GammaProfiles(Utils.readFile(context.getFilesDir() + "/gamma_profiles.json"));
        } else {
            GAMMA_PROFILES = new GammaProfiles(Utils.readAssetFile(context, "gamma_profiles.json"));
        }
    }
    return GAMMA_PROFILES.getDsiPanelProfiles();
}
 
Example 8
Source File: CPUFreq.java    From KernelAdiutor with GNU General Public License v3.0 5 votes vote down vote up
public int getCpuCount() {
    if (mCpuCount == 0 && Utils.existFile(CPU_PRESENT)) {
        try {
            String output = Utils.readFile(CPU_PRESENT);
            mCpuCount = output.equals("0") ? 1 : Integer.parseInt(output.split("-")[1]) + 1;
        } catch (Exception ignored) {
        }
    }
    if (mCpuCount == 0) {
        mCpuCount = Runtime.getRuntime().availableProcessors();
    }
    return mCpuCount;
}
 
Example 9
Source File: Sound.java    From KernelAdiutor with GNU General Public License v3.0 4 votes vote down vote up
public String getVolumeGain() {
    return Utils.readFile(VOLUME_BOOST);
}
 
Example 10
Source File: Gamma.java    From KernelAdiutor with GNU General Public License v3.0 4 votes vote down vote up
public static String getBluePositive() {
    return Utils.readFile(DSI_PANEL_BP);
}
 
Example 11
Source File: Sound.java    From KernelAdiutor with GNU General Public License v3.0 4 votes vote down vote up
public String getMicrophoneGain() {
    return Utils.readFile(MIC_BOOST);
}
 
Example 12
Source File: Sound.java    From KA27 with Apache License 2.0 4 votes vote down vote up
public static String getMicrophoneGain() {
    return Utils.readFile(MIC_BOOST);
}
 
Example 13
Source File: Screen.java    From KA27 with Apache License 2.0 4 votes vote down vote up
public static String getGreenGreys() {
    return Utils.readFile(GAMMACONTROL_GREEN_GREYS);
}
 
Example 14
Source File: Gamma.java    From KernelAdiutor with GNU General Public License v3.0 4 votes vote down vote up
public static String getBlueWhites() {
    return Utils.readFile(GAMMACONTROL_BLUE_WHITES);
}
 
Example 15
Source File: Misc.java    From KernelAdiutor with GNU General Public License v3.0 4 votes vote down vote up
public static String getCpuQuietCurGovernor() {
    return Utils.readFile(CPU_QUIET_CURRENT_GOVERNOR);
}
 
Example 16
Source File: Calibration.java    From KernelAdiutor with GNU General Public License v3.0 4 votes vote down vote up
public boolean isSRGBEnabled() {
    String value = Utils.readFile(SRGB);
    return value.equals("1") || value.contains("mode = 1");
}
 
Example 17
Source File: Info.java    From kernel_adiutor with Apache License 2.0 4 votes vote down vote up
public static String getMemInfo() {
    return Utils.readFile(PROC_MEMINFO);
}
 
Example 18
Source File: Gamma.java    From KernelAdiutor with GNU General Public License v3.0 4 votes vote down vote up
public static String getGreenMids() {
    return Utils.readFile(GAMMACONTROL_GREEN_MIDS);
}
 
Example 19
Source File: Screen.java    From KA27 with Apache License 2.0 4 votes vote down vote up
public static String getGreenMids() {
    return Utils.readFile(GAMMACONTROL_GREEN_MIDS);
}
 
Example 20
Source File: Info.java    From kernel_adiutor with Apache License 2.0 4 votes vote down vote up
public static String getCpuInfo() {
    return Utils.readFile(PROC_CPUINFO);
}