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

The following examples show how to use com.grarak.kerneladiutor.utils.Utils#getInt() . 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: Screen.java    From kernel_adiutor with Apache License 2.0 4 votes vote down vote up
public static int getAutoHBMSmoothingSamples(Context context) {
    return Utils.getInt("AutoHBM_Samples", 3, context);
}
 
Example 2
Source File: Screen.java    From kernel_adiutor with Apache License 2.0 4 votes vote down vote up
public static int getAutoHBMThresh(Context context) {
    return Utils.getInt("AutoHBM_Threshold", 1500, context);
}
 
Example 3
Source File: BootService.java    From kernel_adiutor with Apache License 2.0 4 votes vote down vote up
private void init() {
    final List<String> applys = new ArrayList<>();
    final List<String> plugins = new ArrayList<>();

    CPUVoltage.storeVoltageTable(this);

    if (Screen.isScreenAutoHBMActive(this) && Screen.hasScreenHBM()) {
        startService(new Intent(this, AutoHighBrightnessModeService.class));
    }

    Class[] classes = {BatteryFragment.class, CPUFragment.class, CPUHotplugFragment.class,
            CPUVoltageFragment.class, EntropyFragment.class, GPUFragment.class, IOFragment.class,
            KSMFragment.class, LMKFragment.class, MiscFragment.class,
            ScreenFragment.class, SoundFragment.class, ThermalFragment.class, WakeLockFragment.class,
            VMFragment.class, WakeFragment.class, CoreControl.class
    };

    for (Class mClass : classes)
        if (Utils.getBoolean(mClass.getSimpleName() + "onboot", false, this)) {
            log("Applying on boot for " + mClass.getSimpleName());
            applys.addAll(Utils.getApplys(mClass));
        }

    String plugs;
    if (!(plugs = Utils.getString("plugins", "", this)).isEmpty()) {
        String[] ps = plugs.split("wefewfewwgwe");
        for (String plug : ps)
            if (Utils.getBoolean(plug + "onboot", false, this)) plugins.add(plug);
    }

    if (applys.size() > 0 || plugins.size() > 0) {
        final int delay = Utils.getInt("applyonbootdelay", 5, this);
        mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        mBuilder = new NotificationCompat.Builder(this);
        mBuilder.setContentTitle(getString(R.string.apply_on_boot))
                .setContentText(getString(R.string.apply_on_boot_time, delay))
                .setSmallIcon(R.drawable.ic_launcher_preview);

        TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
        stackBuilder.addParentStack(MainActivity.class);
        stackBuilder.addNextIntent(new Intent(this, MainActivity.class));
        PendingIntent pendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
        mBuilder.setContentIntent(pendingIntent);

        new Thread(new Runnable() {
            @Override
            public void run() {
                boolean notification = Utils.getBoolean("applyonbootnotification", true, BootService.this);
                for (int i = delay; i >= 0; i--)
                    try {
                        Thread.sleep(1000);
                        String note = getString(R.string.apply_on_boot_time, i);
                        if (notification) {
                            mBuilder.setContentText(note).setProgress(delay, delay - i, false);
                            mNotifyManager.notify(id, mBuilder.build());
                        } else if ((i % 10 == 0 || i == delay) && i != 0) toast(note);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                if (notification) {
                    mBuilder.setContentText(getString(R.string.apply_on_boot_finished)).setProgress(0, 0, false);
                    mNotifyManager.notify(id, mBuilder.build());
                }
                apply(applys, plugins);
                stopSelf();
            }
        }).start();
    } else stopSelf();
}