Java源码示例:com.grarak.kerneladiutor.fragments.kernel.EntropyFragment

示例1
/**
 * Add all fragments in a list
 */
private void setList() {
    ITEMS.clear();
    ITEMS.add(new DAdapter.MainHeader());
    ITEMS.add(new DAdapter.Header(getString(R.string.information)));
    ITEMS.add(new DAdapter.Item(getString(R.string.kernel_information), new KernelInformationFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.frequency_table), new FrequencyTableFragment()));
    ITEMS.add(new DAdapter.Header(getString(R.string.kernel)));

    ITEMS.add(new DAdapter.Item(getString(R.string.cpu), new CPUFragment()));
    if (CPUHotplug.hasCpuHotplug()) ITEMS.add(new DAdapter.Item(getString(R.string.cpu_hotplug), new CPUHotplugFragment()));
    if (CPUVoltage.hasCpuVoltage()) ITEMS.add(new DAdapter.Item(getString(R.string.cpu_voltage), new CPUVoltageFragment()));
    if (Entropy.hasEntropy()) ITEMS.add(new DAdapter.Item(getString(R.string.entropy), new EntropyFragment()));
    if (GPU.hasGpuControl()) ITEMS.add(new DAdapter.Item(getString(R.string.gpu), new GPUFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.io_scheduler), new IOFragment()));
    if (KSM.hasKsm()) ITEMS.add(new DAdapter.Item(getString(R.string.ksm), new KSMFragment()));
    if (LMK.getMinFrees() != null) ITEMS.add(new DAdapter.Item(getString(R.string.low_memory_killer), new LMKFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.misc_controls), new MiscFragment()));
    if (!Utils.isTV(this)) ITEMS.add(new DAdapter.Item(getString(R.string.battery), new BatteryFragment())); //Power and battery
    if (Ram.hasRamControl()) ITEMS.add(new DAdapter.Item(getString(R.string.ram), new RamFragment()));
    if (Screen.hasScreen()) ITEMS.add(new DAdapter.Item(getString(R.string.screen), new ScreenFragment()));
    if (Sound.hasSound()) ITEMS.add(new DAdapter.Item(getString(R.string.sound), new SoundFragment()));
    if (Thermal.hasThermal()) ITEMS.add(new DAdapter.Item(getString(R.string.thermal), new ThermalFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.virtual_memory), new VMFragment()));
    if (Wake.hasWake()) ITEMS.add(new DAdapter.Item(getString(R.string.wake_controls), new WakeFragment()));
    if (WakeLock.hasAnyWakelocks()) ITEMS.add(new DAdapter.Item(getString(R.string.wakelocks), new WakeLockFragment()));

    ITEMS.add(new DAdapter.Header(getString(R.string.tools)));
    if (Backup.hasBackup()) ITEMS.add(new DAdapter.Item(getString(R.string.backup), new BackupFragment()));
    if (Buildprop.hasBuildprop()) ITEMS.add(new DAdapter.Item(getString(R.string.build_prop_editor), new BuildpropFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.initd), new InitdFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.logs), new LogsFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.profile), new ProfileFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.recovery), new RecoveryFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.startup_commands), new StartUpCommandsFragment()));
    ITEMS.add(new DAdapter.Header(getString(R.string.other)));
    ITEMS.add(new DAdapter.Item(getString(R.string.settings), new SettingsFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.about_us), new AboutusFragment()));
}
 
示例2
private static String listcommands(Context context) {
    CommandDB commandDB = new CommandDB(context);
    List < CommandDB.CommandItem > commandItems = commandDB.getAllCommands();
    final List < String > applys = new ArrayList < > ();
    List < String > commands = new ArrayList < > ();

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

    for (Class mClass: classes) {
        if (Utils.getBoolean(mClass.getSimpleName() + "onboot", false, context)) {
            applys.addAll(Utils.getApplys(mClass));
        }
    }

    if (applys.size() > 0) {
        for (CommandDB.CommandItem commandItem: commandItems)
            for (String sys: applys) {
                String path = commandItem.getPath();
                if ((sys.contains(path) || path.contains(sys))) {
                    String command = commandItem.getCommand();
                    if (commands.indexOf(command) < 0)
                        commands.add(command);
                }
            }
    }

    if (commands.size() > 0) {
        final String allcommands = android.text.TextUtils.join("\n", commands);
        return allcommands;
    }
    return "No changes";
}
 
示例3
private void init() {
    final List < String > applys = new ArrayList < > ();

    CPUVoltage.storeVoltageTable(this);

    Class[] classes = {
        BatteryFragment.class,
        CPUFragment.class,
        CPUHotplugFragment.class,
        CPUVoltageFragment.class,
        EntropyFragment.class,
        GPUFragment.class,
        IOFragment.class,
        KSMFragment.class,
        LMKFragment.class,
        MiscFragment.class,
        RamFragment.class,
        ScreenFragment.class,
        SoundFragment.class,
        ThermalFragment.class,
        VMFragment.class,
        WakeFragment.class,
        WakeLockFragment.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));
        }

    if (applys.size() > 0) {

        if (!needNotification) {
            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", false, BootService.this);
                if (delay > 0) {
                    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(NOTIFY_ID, mBuilder.build());
                            } else if ((i % 10 == 0 || i == delay) && i != 0) toast(note);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }
                }
                apply(applys);
                if (notification) {
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                        mBuilder.setContentText(getString(R.string.apply_on_boot_finished));
                        mNotifyManager.notify(102, mBuilder.build());
                    } else {
                        mBuilder.setContentText(getString(R.string.apply_on_boot_finished)).setProgress(0, 0, false);
                        mNotifyManager.notify(NOTIFY_ID, mBuilder.build());
                    }
                }
                stopSelf();
            }
        }).start();
    } else stopSelf();
}
 
示例4
/**
 * Add all fragments in a list
 */
private void setList() {
    ITEMS.clear();
    ITEMS.add(new DAdapter.MainHeader());
    ITEMS.add(new DAdapter.Header(getString(R.string.information)));
    ITEMS.add(new DAdapter.Item(getString(R.string.kernel_information), new KernelInformationFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.frequency_table), new FrequencyTableFragment()));
    ITEMS.add(new DAdapter.Header(getString(R.string.kernel)));
    ITEMS.add(new DAdapter.Item(getString(R.string.cpu), new CPUFragment()));
    if (CPUVoltage.hasCpuVoltage())
        ITEMS.add(new DAdapter.Item(getString(R.string.cpu_voltage), new CPUVoltageFragment()));
    if (CPUHotplug.hasCpuHotplug())
        ITEMS.add(new DAdapter.Item(getString(R.string.cpu_hotplug), new CPUHotplugFragment()));
    if (CoreControl.hasMinLittle())
        ITEMS.add(new DAdapter.Item(getString(R.string.corecontrol), new CoreControlFragment()));
    if (Thermal.hasThermal())
        ITEMS.add(new DAdapter.Item(getString(R.string.thermal), new ThermalFragment()));
    if (GPU.hasGpuControl())
        ITEMS.add(new DAdapter.Item(getString(R.string.gpu), new GPUFragment()));
    if (Screen.hasScreen())
        ITEMS.add(new DAdapter.Item(getString(R.string.screen), new ScreenFragment()));
    if (Wake.hasWake())
        ITEMS.add(new DAdapter.Item(getString(R.string.wake_controls), new WakeFragment()));
    if (Sound.hasSound())
        ITEMS.add(new DAdapter.Item(getString(R.string.sound), new SoundFragment()));
    if (!Utils.isTV(this))
        ITEMS.add(new DAdapter.Item(getString(R.string.battery), new BatteryFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.io_scheduler), new IOFragment()));
    if (KSM.hasKsm())
        ITEMS.add(new DAdapter.Item(getString(R.string.ksm), new KSMFragment()));
    if (LMK.getMinFrees() != null)
        ITEMS.add(new DAdapter.Item(getString(R.string.low_memory_killer), new LMKFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.virtual_memory), new VMFragment()));
    if (WakeLock.hasAnyWakelocks()) {
        ITEMS.add(new DAdapter.Item(getString(R.string.wakelocks), new WakeLockFragment()));
    }
    if (Entropy.hasEntropy())
        ITEMS.add(new DAdapter.Item(getString(R.string.entropy), new EntropyFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.misc_controls), new MiscFragment()));
    ITEMS.add(new DAdapter.Header(getString(R.string.tools)));
    Downloads downloads;
    if ((downloads = new Downloads(this)).isSupported())
        ITEMS.add(new DAdapter.Item(getString(R.string.downloads),
                DownloadsFragment.newInstance(downloads.getLink())));
    if (Backup.hasBackup())
        ITEMS.add(new DAdapter.Item(getString(R.string.backup), new BackupFragment()));
    if (Buildprop.hasBuildprop() && RootUtils.busyboxInstalled())
        ITEMS.add(new DAdapter.Item(getString(R.string.build_prop_editor), new BuildpropFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.profile), new ProfileFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.recovery), new RecoveryFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.initd), new InitdFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.startup_commands), new StartUpCommandsFragment()));
    ITEMS.add(new DAdapter.Header(getString(R.string.other)));
    ITEMS.add(new DAdapter.Item(getString(R.string.settings), new SettingsFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.faq), new FAQFragment()));
    ITEMS.add(new DAdapter.Item(getString(R.string.about_us), new AboutusFragment()));
}
 
示例5
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();
}
 
示例6
private void initFragments() {
    mFragments.clear();
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.statistics));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.overall, OverallFragment.class, R.drawable.ic_chart));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.device, DeviceFragment.class, R.drawable.ic_device));
    if (Device.MemInfo.getInstance().getItems().size() > 0) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.memory, MemoryFragment.class, R.drawable.ic_save));
    }
    if (Device.Input.getInstance().supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.inputs, InputsFragment.class, R.drawable.ic_keyboard));
    }
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.kernel));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.cpu, CPUFragment.class, R.drawable.ic_cpu));
    if (Voltage.getInstance().supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.cpu_voltage, CPUVoltageFragment.class, R.drawable.ic_bolt));
    }
    if (Hotplug.supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.cpu_hotplug, CPUHotplugFragment.class, R.drawable.ic_switch));
    }
    if (Thermal.supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.thermal, ThermalFragment.class, R.drawable.ic_temperature));
    }
    if (GPU.supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.gpu, GPUFragment.class, R.drawable.ic_gpu));
    }
    if (Screen.supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.screen, ScreenFragment.class, R.drawable.ic_display));
    }
    if (Wake.supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.wake, WakeFragment.class, R.drawable.ic_unlock));
    }
    if (Sound.getInstance().supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.sound, SoundFragment.class, R.drawable.ic_music));
    }
    if (Battery.getInstance(this).supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.battery, BatteryFragment.class, R.drawable.ic_battery));
    }
    if (LED.getInstance().supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.led, LEDFragment.class, R.drawable.ic_led));
    }
    if (IO.getInstance().supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.io_scheduler, IOFragment.class, R.drawable.ic_sdcard));
    }
    if (KSM.getInstance().supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.ksm, KSMFragment.class, R.drawable.ic_merge));
    }
    if (LMK.supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.lmk, LMKFragment.class, R.drawable.ic_stackoverflow));
    }
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.virtual_memory, VMFragment.class, R.drawable.ic_server));
    if (Entropy.supported()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.entropy, EntropyFragment.class, R.drawable.ic_numbers));
    }
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.misc, MiscFragment.class, R.drawable.ic_clear));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.tools));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.data_sharing, DataSharingFragment.class, R.drawable.ic_database));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.custom_controls, CustomControlsFragment.class, R.drawable.ic_console));

    SupportedDownloads supportedDownloads = new SupportedDownloads(this);
    if (supportedDownloads.getLink() != null) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.downloads, DownloadsFragment.class, R.drawable.ic_download));
    }
    if (Backup.hasBackup()) {
        mFragments.add(new NavigationActivity.NavigationFragment(R.string.backup, BackupFragment.class, R.drawable.ic_restore));
    }
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.build_prop_editor, BuildpropFragment.class, R.drawable.ic_edit));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.profile, ProfileFragment.class, R.drawable.ic_layers));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.recovery, RecoveryFragment.class, R.drawable.ic_security));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.initd, InitdFragment.class, R.drawable.ic_shell));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.on_boot, OnBootFragment.class, R.drawable.ic_start));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.other));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.settings, SettingsFragment.class, R.drawable.ic_settings));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.about, AboutFragment.class, R.drawable.ic_about));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.contributors, ContributorsFragment.class, R.drawable.ic_people));
    mFragments.add(new NavigationActivity.NavigationFragment(R.string.help, HelpFragment.class, R.drawable.ic_help));
}