Java Code Examples for com.grarak.kerneladiutor.utils.root.Control#deletespecificcommand()

The following examples show how to use com.grarak.kerneladiutor.utils.root.Control#deletespecificcommand() . 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: Battery.java    From KA27 with Apache License 2.0 5 votes vote down vote up
public static void activateDeviceidle(boolean active, Context context) {
    Control.deletespecificcommand(context, active ? DEVICEIDLE_DIS : DEVICEIDLE_ENA, null);
    Control.deletespecificcommand(context, DEVICEIDLE_DEEP_ENA, null);
    Control.deletespecificcommand(context, DEVICEIDLE_DEEP_DIS, null);
    Control.deletespecificcommand(context, DEVICEIDLE_LIGHT_DIS, null);
    Control.deletespecificcommand(context, DEVICEIDLE_LIGHT_ENA, null);
    Control.runCommand("", active ?  DEVICEIDLE_ENA : DEVICEIDLE_DIS, Control.CommandType.SHELL, context);
}
 
Example 2
Source File: Misc.java    From KA27 with Apache License 2.0 5 votes vote down vote up
public static void activateLogger(boolean active, Context context) {
    if (!LOGGER_FILE.equals(LOGD)) {
        Control.runCommand(active ? "1" : "0", LOGGER_FILE, Control.CommandType.GENERIC, context);
    }
    if (LOGGER_FILE.equals(LOGD)) {
        // This is needed because the path changes from "start" to "stop" so it breaks the commandsaver function
        Control.deletespecificcommand(context, active ? "stop" : "start", null);

        Control.runCommand("logd", active ? "start" : "stop", Control.CommandType.SHELL, context);
    }
}
 
Example 3
Source File: CPU.java    From KA27 with Apache License 2.0 5 votes vote down vote up
public static boolean setPCMaxFreq(int freq, int core, Context context) {
    for (int i = 0; i < 10; i++) {
        if (core > 0) {
            Control.deletespecificcommand(context, null, "echo " + "1" + " > " + String.format(Locale.US, Constants.CPU_CORE_ONLINE, core));
            Control.run("echo " + "1" + " > " + String.format(Locale.US, Constants.CPU_CORE_ONLINE, core), String.format(Locale.US, Constants.CPU_CORE_ONLINE, core), context);
        }
        Control.setPermission(String.format(Locale.US, Constants.CPU_MAX_FREQ, core), 644, context);
        Control.run("echo " + Integer.toString(freq) + " > " + String.format(Locale.US, CPU_MAX_FREQ, core), String.format(Locale.US, CPU_MAX_FREQ, core), context);
        if (freq == getMaxFreq(core, true))
            return true;
    }
    return false;
}
 
Example 4
Source File: CPU.java    From KA27 with Apache License 2.0 5 votes vote down vote up
public static boolean setPCMinFreq(int freq, int core, Context context) {
    for (int i = 0; i < 10; i++) {
        if (core > 0) {
            Control.deletespecificcommand(context, null, "echo " + "1" + " > " + String.format(Locale.US, Constants.CPU_CORE_ONLINE, core));
            Control.run("echo " + "1" + " > " + String.format(Locale.US, Constants.CPU_CORE_ONLINE, core), String.format(Locale.US, Constants.CPU_CORE_ONLINE, core), context);
        }
        Control.setPermission(String.format(Locale.US, Constants.CPU_MIN_FREQ, core), 644, context);
        Control.run("echo " + Integer.toString(freq) + " > " + String.format(Locale.US, CPU_MIN_FREQ, core), String.format(Locale.US, CPU_MIN_FREQ, core), context);
        if (freq == getMinFreq(core, true))
            return true;
    }
    return false;
}
 
Example 5
Source File: CPU.java    From KA27 with Apache License 2.0 5 votes vote down vote up
public static boolean setGovernorPC(String governor, int core, Context context) {
    for (int i = 0; i < 10; i++) {
        if (core > 0) {
            Control.deletespecificcommand(context, null, "echo " + "1" + " > " + String.format(Locale.US, Constants.CPU_CORE_ONLINE, core));
            Control.run("echo " + "1" + " > " + String.format(Locale.US, Constants.CPU_CORE_ONLINE, core), String.format(Locale.US, Constants.CPU_CORE_ONLINE, core), context);
        }
        Control.setPermission(String.format(Locale.US, Constants.CPU_SCALING_GOVERNOR, core), 644, context);
        Control.run("echo " + governor + " > " + String.format(Locale.US, CPU_SCALING_GOVERNOR, core), String.format(Locale.US, CPU_SCALING_GOVERNOR, core), context);
        if (governor.equals(getCurGovernor(core, true)))
            return true;
    }
    return false;
}
 
Example 6
Source File: StartUpCommandsFragment.java    From kernel_adiutor with Apache License 2.0 5 votes vote down vote up
@Override
public void onClick(DialogInterface dialog, int which) {
    switch (which){
        case DialogInterface.BUTTON_POSITIVE:
            //Yes button clicked
            Control.deletespecificcommand(getActivity(), null, null);
            forcerefresh(getActivity());
            break;

        case DialogInterface.BUTTON_NEGATIVE:
            //No button clicked
            break;
    }
}
 
Example 7
Source File: Misc.java    From kernel_adiutor with Apache License 2.0 5 votes vote down vote up
public static void activateLogger(boolean active, Context context) {
    if (!LOGGER_FILE.equals(LOGD)) {
        Control.runCommand(active ? "1" : "0", LOGGER_FILE, Control.CommandType.GENERIC, context);
    }
    if (LOGGER_FILE.equals(LOGD)) {
        // This is needed because the path changes from "start" to "stop" so it breaks the commandsaver function
        Control.deletespecificcommand(context, active ? "stop" : "start", null);

        Control.runCommand("logd", active ? "start" : "stop", Control.CommandType.SHELL, context);
    }
}
 
Example 8
Source File: CPU.java    From kernel_adiutor with Apache License 2.0 5 votes vote down vote up
public static void activateMSM_Limiter(boolean active, Context context) {
    if (active) {
        for (int i = 0; i < CPU.getCoreCount(); i++) {
            Control.deletespecificcommand(context, String.format(CPU_SCALING_GOVERNOR, i), null);
            Control.deletespecificcommand(context, String.format(CPU_SCALING_GOVERNOR, i) + "permission644", null);
            Control.deletespecificcommand(context, String.format(CPU_SCALING_GOVERNOR, i) + "permission444", null);
        }
        CPU.setMSMLimiterGovernor(CPU.getCurGovernor(true), context, -1);
    }
    else {
        Control.deletespecificcommand(context, CPU_MSM_LIMITER_SCALING_GOVERNOR, null);
        CPU.setGovernor(CPU.getMSMLimiterGovernor(-1), context);
    }
    Control.runCommand(active ? "1" : "0", mMSMLimiterEnable, Control.CommandType.GENERIC, context);
}
 
Example 9
Source File: CPU.java    From kernel_adiutor with Apache License 2.0 5 votes vote down vote up
public static void activatePerCoreControl(boolean active, Context context) {
    Utils.saveBoolean("MSM_Limiter_Per_Core_Control", active, context);
    if (active) {
        Control.deletespecificcommand(context, CPU_MSM_LIMITER_SCALING_GOVERNOR, null);
        for (int i = 0; i < CPU.getCoreCount(); i++) {
            CPU.setMSMLimiterGovernor(CPU.getMSMLimiterGovernor(-1), context, i);
        }
    }
    else {
        for (int i = 0; i < CPU.getCoreCount(); i++) {
            Control.deletespecificcommand(context, String.format(CPU_MSM_LIMITER_SCALING_GOVERNOR_PER_CORE, i), null);
        }
        CPU.setMSMLimiterGovernor(CPU.getMSMLimiterGovernor(0), context, -1);
    }
}
 
Example 10
Source File: Battery.java    From KA27 with Apache License 2.0 4 votes vote down vote up
public static void activateDeviceidlelight(boolean active, Context context) {
    if (!active) Control.deletespecificcommand(context, DEVICEIDLE_ENA, null);
    Control.deletespecificcommand(context, active ? DEVICEIDLE_LIGHT_DIS : DEVICEIDLE_LIGHT_ENA, null);
    Control.runCommand("", active ?  DEVICEIDLE_LIGHT_ENA : DEVICEIDLE_LIGHT_DIS, Control.CommandType.SHELL, context);
}
 
Example 11
Source File: Battery.java    From KA27 with Apache License 2.0 4 votes vote down vote up
public static void activateDeviceidledeep(boolean active, Context context) {
    if (!active) Control.deletespecificcommand(context, DEVICEIDLE_ENA, null);
    Control.deletespecificcommand(context, active ? DEVICEIDLE_DEEP_DIS : DEVICEIDLE_DEEP_ENA, null);
    Control.runCommand("", active ?  DEVICEIDLE_DEEP_ENA : DEVICEIDLE_DEEP_DIS, Control.CommandType.SHELL, context);
}