items) {
54 | items.add(new DownloadAboutView(mKernelContent));
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/java/com/viewpagerindicator/PageIndicator.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2011 Patrik Akerfeldt
3 | * Copyright (C) 2011 Jake Wharton
4 | *
5 | * Licensed under the Apache License, Version 2.0 (the "License");
6 | * you may not use this file except in compliance with the License.
7 | * You may obtain a copy of the License at
8 | *
9 | * http://www.apache.org/licenses/LICENSE-2.0
10 | *
11 | * Unless required by applicable law or agreed to in writing, software
12 | * distributed under the License is distributed on an "AS IS" BASIS,
13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 | * See the License for the specific language governing permissions and
15 | * limitations under the License.
16 | */
17 | package com.viewpagerindicator;
18 |
19 | import android.support.v4.view.ViewPager;
20 |
21 | /**
22 | * A PageIndicator is responsible to show an visual indicator on the total views
23 | * number and the current visible view.
24 | */
25 | public interface PageIndicator extends ViewPager.OnPageChangeListener {
26 | /**
27 | * Bind the indicator to a ViewPager.
28 | *
29 | * @param view
30 | */
31 | void setViewPager(ViewPager view);
32 |
33 | /**
34 | * Bind the indicator to a ViewPager.
35 | *
36 | * @param view
37 | * @param initialPosition
38 | */
39 | void setViewPager(ViewPager view, int initialPosition);
40 |
41 | /**
42 | * Set the current page of both the ViewPager and indicator.
43 | *
44 | * This must be used if you need to set the page before
45 | * the views are drawn on screen (e.g., default start page).
46 | *
47 | * @param item
48 | */
49 | void setCurrentItem(int item);
50 |
51 | /**
52 | * Set a page change listener which will receive forwarded events.
53 | *
54 | * @param listener
55 | */
56 | void setOnPageChangeListener(ViewPager.OnPageChangeListener listener);
57 |
58 | /**
59 | * Notify the indicator that the fragment list has changed.
60 | */
61 | void notifyDataSetChanged();
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_usage_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
26 |
27 |
35 |
36 |
45 |
46 |
55 |
56 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/rv_value_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
19 |
20 |
25 |
26 |
31 |
32 |
38 |
39 |
45 |
46 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/app/src/main/java/com/grarak/kerneladiutor/database/tools/customcontrols/ExportControl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-2016 Willi Ye
3 | *
4 | * This file is part of Kernel Adiutor.
5 | *
6 | * Kernel Adiutor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Kernel Adiutor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Kernel Adiutor. If not, see .
18 | *
19 | */
20 | package com.grarak.kerneladiutor.database.tools.customcontrols;
21 |
22 | import com.grarak.kerneladiutor.utils.Utils;
23 |
24 | import org.json.JSONException;
25 | import org.json.JSONObject;
26 |
27 | import java.io.File;
28 |
29 | /**
30 | * Created by willi on 03.07.16.
31 | */
32 | public class ExportControl {
33 |
34 | private JSONObject mMain;
35 |
36 | public ExportControl(Controls.ControlItem item, int version) {
37 | mMain = new JSONObject();
38 | try {
39 | item.getItem().remove("uniqueId");
40 | item.getItem().remove("onboot");
41 | item.getItem().remove("arguments");
42 | mMain.put("version", version);
43 | mMain.put("control", item.getItem());
44 | } catch (JSONException ignored) {
45 | }
46 | }
47 |
48 | public boolean export(String name) {
49 | if (!name.endsWith(".json")) name += ".json";
50 | File exportFiles = new File(Utils.getInternalDataStorage() + "/controls");
51 | File file = new File(exportFiles.toString() + "/" + name);
52 | if (file.exists()) return false;
53 | exportFiles.mkdirs();
54 | Utils.writeFile(file.toString(), mMain.toString(), false, false);
55 | return true;
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/java/com/grarak/kerneladiutor/views/recyclerview/ButtonView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 Willi Ye
3 | *
4 | * This file is part of Kernel Adiutor.
5 | *
6 | * Kernel Adiutor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Kernel Adiutor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Kernel Adiutor. If not, see .
18 | *
19 | */
20 | package com.grarak.kerneladiutor.views.recyclerview;
21 |
22 | import android.support.v7.widget.AppCompatButton;
23 | import android.view.View;
24 |
25 | import com.grarak.kerneladiutor.R;
26 |
27 | /**
28 | * Created by willi on 28.09.17.
29 | */
30 |
31 | public class ButtonView extends RecyclerViewItem {
32 |
33 | private AppCompatButton mButton;
34 |
35 | private String mText;
36 | private View.OnClickListener mOnClickListener;
37 |
38 | @Override
39 | public int getLayoutRes() {
40 | return R.layout.rv_button;
41 | }
42 |
43 | @Override
44 | protected boolean cardCompatible() {
45 | return false;
46 | }
47 |
48 | @Override
49 | public void onCreateView(View view) {
50 | mButton = view.findViewById(R.id.btn);
51 |
52 | super.onCreateView(view);
53 | setup();
54 | }
55 |
56 | public void setText(String text) {
57 | mText = text;
58 | setup();
59 | }
60 |
61 | private void setup() {
62 | if (mButton != null) {
63 | mButton.setText(mText);
64 | mButton.setOnClickListener(mOnClickListener);
65 | }
66 | }
67 |
68 | public void setOnClickListener(View.OnClickListener onClickListener) {
69 | mOnClickListener = onClickListener;
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/app/src/main/java/com/grarak/kerneladiutor/activities/TextActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-2016 Willi Ye
3 | *
4 | * This file is part of Kernel Adiutor.
5 | *
6 | * Kernel Adiutor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Kernel Adiutor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Kernel Adiutor. If not, see .
18 | *
19 | */
20 | package com.grarak.kerneladiutor.activities;
21 |
22 | import android.os.Bundle;
23 | import android.support.annotation.Nullable;
24 | import android.view.View;
25 | import android.widget.TextView;
26 |
27 | import com.grarak.kerneladiutor.R;
28 | import com.grarak.kerneladiutor.utils.Utils;
29 |
30 | /**
31 | * Created by willi on 14.04.16.
32 | */
33 | public class TextActivity extends BaseActivity {
34 |
35 | public static final String MESSAGE_INTENT = "message_intent";
36 | public static final String SUMMARY_INTENT = "summary_intent";
37 |
38 | @Override
39 | protected void onCreate(@Nullable Bundle savedInstanceState) {
40 | super.onCreate(savedInstanceState);
41 | setContentView(R.layout.activity_text);
42 |
43 | String message = getIntent().getStringExtra(MESSAGE_INTENT);
44 | final String url = getIntent().getStringExtra(SUMMARY_INTENT);
45 |
46 | if (message != null)
47 | ((TextView) findViewById(R.id.message_text)).setText(message);
48 | if (url != null)
49 | findViewById(R.id.help_fab).setOnClickListener(new View.OnClickListener() {
50 | @Override
51 | public void onClick(View v) {
52 | Utils.launchUrl(url, TextActivity.this);
53 | }
54 | });
55 | }
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/rv_frequencytable_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
16 |
17 |
21 |
22 |
29 |
30 |
37 |
38 |
45 |
46 |
47 |
48 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/app/src/main/java/com/grarak/kerneladiutor/views/recyclerview/StatsView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-2016 Willi Ye
3 | *
4 | * This file is part of Kernel Adiutor.
5 | *
6 | * Kernel Adiutor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Kernel Adiutor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Kernel Adiutor. If not, see .
18 | *
19 | */
20 | package com.grarak.kerneladiutor.views.recyclerview;
21 |
22 | import android.view.View;
23 | import android.widget.TextView;
24 |
25 | import com.grarak.kerneladiutor.R;
26 |
27 | /**
28 | * Created by willi on 23.08.16.
29 | */
30 |
31 | public class StatsView extends RecyclerViewItem {
32 |
33 | private TextView mStatView;
34 | private TextView mTitleView;
35 |
36 | private CharSequence mStat;
37 | private CharSequence mTitle;
38 |
39 | @Override
40 | public int getLayoutRes() {
41 | return R.layout.rv_stats_view;
42 | }
43 |
44 | @Override
45 | public void onCreateView(View view) {
46 | mStatView = (TextView) view.findViewById(R.id.stat);
47 | mTitleView = (TextView) view.findViewById(R.id.title);
48 |
49 | super.onCreateView(view);
50 | }
51 |
52 | public void setStat(CharSequence stat) {
53 | mStat = stat;
54 | refresh();
55 | }
56 |
57 | public void setTitle(CharSequence title) {
58 | mTitle = title;
59 | refresh();
60 | }
61 |
62 | @Override
63 | protected void refresh() {
64 | super.refresh();
65 |
66 | if (mStatView != null && mStat != null) {
67 | mStatView.setText(mStat);
68 | }
69 | if (mTitleView != null && mTitle != null) {
70 | mTitleView.setText(mTitle);
71 | }
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/app/src/main/java/com/grarak/kerneladiutor/utils/kernel/cpuhotplug/MPDecision.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-2016 Willi Ye
3 | *
4 | * This file is part of Kernel Adiutor.
5 | *
6 | * Kernel Adiutor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Kernel Adiutor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Kernel Adiutor. If not, see .
18 | *
19 | */
20 | package com.grarak.kerneladiutor.utils.kernel.cpuhotplug;
21 |
22 | import android.content.Context;
23 |
24 | import com.grarak.kerneladiutor.fragments.ApplyOnBootFragment;
25 | import com.grarak.kerneladiutor.utils.Utils;
26 | import com.grarak.kerneladiutor.utils.kernel.cpu.CPUFreq;
27 | import com.grarak.kerneladiutor.utils.root.Control;
28 |
29 | /**
30 | * Created by willi on 07.05.16.
31 | */
32 | public class MPDecision {
33 |
34 | public static final String HOTPLUG_MPDEC = "mpdecision";
35 |
36 | public static void enableMpdecision(boolean enable, Context context) {
37 | if (enable) {
38 | run(Control.startService(HOTPLUG_MPDEC), HOTPLUG_MPDEC, context);
39 | } else {
40 | run(Control.stopService(HOTPLUG_MPDEC), HOTPLUG_MPDEC, context);
41 | for (int i = 0; i < CPUFreq.getCpuCount(); i++) {
42 | CPUFreq.onlineCpu(i, true, ApplyOnBootFragment.CPU_HOTPLUG, false, context);
43 | }
44 | }
45 | }
46 |
47 | public static boolean isMpdecisionEnabled() {
48 | return Utils.isPropRunning(HOTPLUG_MPDEC);
49 | }
50 |
51 | public static boolean supported() {
52 | return Utils.hasProp(HOTPLUG_MPDEC);
53 | }
54 |
55 | private static void run(String command, String id, Context context) {
56 | Control.runSetting(command, ApplyOnBootFragment.CPU_HOTPLUG, id, context);
57 | }
58 |
59 | }
60 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/rv_drop_down_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
21 |
22 |
28 |
29 |
34 |
35 |
40 |
41 |
42 |
43 |
50 |
51 |
52 |
53 |
58 |
59 |
--------------------------------------------------------------------------------
/app/src/main/java/com/grarak/kerneladiutor/utils/tools/Initd.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-2016 Willi Ye
3 | *
4 | * This file is part of Kernel Adiutor.
5 | *
6 | * Kernel Adiutor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Kernel Adiutor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Kernel Adiutor. If not, see .
18 | *
19 | */
20 | package com.grarak.kerneladiutor.utils.tools;
21 |
22 | import com.grarak.kerneladiutor.utils.Utils;
23 | import com.grarak.kerneladiutor.utils.root.RootFile;
24 | import com.grarak.kerneladiutor.utils.root.RootUtils;
25 |
26 | import java.util.List;
27 |
28 | /**
29 | * Created by willi on 16.07.16.
30 | */
31 | public class Initd {
32 |
33 | private static final String INITD = "/system/etc/init.d";
34 |
35 | public static void write(String file, String text) {
36 | RootUtils.mount(true, "/system");
37 | RootFile f = new RootFile(INITD + "/" + file);
38 | f.write(text, false);
39 | RootUtils.chmod(INITD + "/" + file, "755");
40 | RootUtils.mount(false, "/system");
41 | }
42 |
43 | public static void delete(String file) {
44 | RootUtils.mount(true, "/system");
45 | RootFile f = new RootFile(INITD + "/" + file);
46 | f.delete();
47 | RootUtils.mount(false, "/system");
48 | }
49 |
50 | public static String execute(String file) {
51 | RootUtils.chmod(INITD + "/" + file, "755");
52 | return RootUtils.runCommand(INITD + "/" + file);
53 | }
54 |
55 | public static String read(String file) {
56 | return Utils.readFile(INITD + "/" + file);
57 | }
58 |
59 | public static List list() {
60 | RootFile file = new RootFile(INITD);
61 | if (!file.exists()) {
62 | RootUtils.mount(true, "/system");
63 | file.mkdir();
64 | RootUtils.mount(false, "/system");
65 | }
66 | return file.list();
67 | }
68 |
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/java/com/grarak/kerneladiutor/utils/Prefs.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-2016 Willi Ye
3 | *
4 | * This file is part of Kernel Adiutor.
5 | *
6 | * Kernel Adiutor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Kernel Adiutor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Kernel Adiutor. If not, see .
18 | *
19 | */
20 | package com.grarak.kerneladiutor.utils;
21 |
22 | import android.content.Context;
23 | import android.preference.PreferenceManager;
24 |
25 | /**
26 | * Created by willi on 01.01.16.
27 | */
28 | public class Prefs {
29 |
30 | public static void remove(String name, Context context) {
31 | PreferenceManager.getDefaultSharedPreferences(context).edit().remove(name).apply();
32 | }
33 |
34 | public static int getInt(String name, int defaults, Context context) {
35 | return PreferenceManager.getDefaultSharedPreferences(context).getInt(name, defaults);
36 | }
37 |
38 | public static void saveInt(String name, int value, Context context) {
39 | PreferenceManager.getDefaultSharedPreferences(context).edit().putInt(name, value).apply();
40 | }
41 |
42 | public static boolean getBoolean(String name, boolean defaults, Context context) {
43 | return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(name, defaults);
44 | }
45 |
46 | public static void saveBoolean(String name, boolean value, Context context) {
47 | PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(name, value).apply();
48 | }
49 |
50 | public static String getString(String name, String defaults, Context context) {
51 | return PreferenceManager.getDefaultSharedPreferences(context).getString(name, defaults);
52 | }
53 |
54 | public static void saveString(String name, String value, Context context) {
55 | PreferenceManager.getDefaultSharedPreferences(context).edit().putString(name, value).apply();
56 | }
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_global_offset.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
17 |
18 |
22 |
23 |
34 |
35 |
45 |
46 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/app/src/main/res/values-da/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Adgangskode
6 | Forkert adgangskode
7 | Vælg billede
8 | Intet billede
9 | Noget gik galt!
10 | Tryk på tilbage igen for at afslutte
11 | Annullér
12 | OK
13 | Ukendt
14 | Uden for område
15 | Indstillinger
16 | Mere
17 |
18 |
19 | Gem
20 |
21 | Vælg %s?
22 |
23 | MHz
24 | ºC
25 | ºF
26 |
27 |
28 |
29 | Om
30 | Bidragsydere
31 | Hjælp
32 |
33 | Offline
34 | Oppetid
35 |
36 | RAM
37 | Fingeraftryk
38 | Bootloader
39 | Hardware
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/app/src/main/java/com/grarak/kerneladiutor/utils/kernel/vm/VM.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-2016 Willi Ye
3 | *
4 | * This file is part of Kernel Adiutor.
5 | *
6 | * Kernel Adiutor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Kernel Adiutor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Kernel Adiutor. If not, see .
18 | *
19 | */
20 | package com.grarak.kerneladiutor.utils.kernel.vm;
21 |
22 | import android.content.Context;
23 |
24 | import com.grarak.kerneladiutor.fragments.ApplyOnBootFragment;
25 | import com.grarak.kerneladiutor.utils.Utils;
26 | import com.grarak.kerneladiutor.utils.root.Control;
27 |
28 | /**
29 | * Created by willi on 29.06.16.
30 | */
31 | public class VM {
32 |
33 | private static final String PATH = "/proc/sys/vm";
34 | private static final String[] SUPPORTED_VM = {"dirty_ratio", "dirty_background_ratio", "dirty_expire_centisecs",
35 | "dirty_writeback_centisecs", "min_free_kbytes", "oom_kill_allocating_task", "overcommit_ratio", "swappiness",
36 | "vfs_cache_pressure", "laptop_mode", "extra_free_kbytes"};
37 |
38 | public static void setValue(String value, int position, Context context) {
39 | run(Control.write(value, PATH + "/" + SUPPORTED_VM[position]), PATH + "/" +
40 | SUPPORTED_VM[position], context);
41 | }
42 |
43 | public static String getValue(int position) {
44 | return Utils.readFile(PATH + "/" + SUPPORTED_VM[position]);
45 | }
46 |
47 | public static String getName(int position) {
48 | return SUPPORTED_VM[position];
49 | }
50 |
51 | public static boolean exists(int position) {
52 | return Utils.existFile(PATH + "/" + SUPPORTED_VM[position]);
53 | }
54 |
55 | public static int size() {
56 | return SUPPORTED_VM.length;
57 | }
58 |
59 | private static void run(String command, String id, Context context) {
60 | Control.runSetting(command, ApplyOnBootFragment.VM, id, context);
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/java/com/grarak/kerneladiutor/fragments/other/HelpFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-2016 Willi Ye
3 | *
4 | * This file is part of Kernel Adiutor.
5 | *
6 | * Kernel Adiutor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Kernel Adiutor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Kernel Adiutor. If not, see .
18 | *
19 | */
20 | package com.grarak.kerneladiutor.fragments.other;
21 |
22 | import com.grarak.kerneladiutor.R;
23 | import com.grarak.kerneladiutor.fragments.RecyclerViewFragment;
24 | import com.grarak.kerneladiutor.views.recyclerview.DescriptionView;
25 | import com.grarak.kerneladiutor.views.recyclerview.RecyclerViewItem;
26 |
27 | import java.util.LinkedHashMap;
28 | import java.util.List;
29 |
30 | /**
31 | * Created by willi on 25.07.16.
32 | */
33 | public class HelpFragment extends RecyclerViewFragment {
34 |
35 | private static final LinkedHashMap sHelps = new LinkedHashMap<>();
36 |
37 | static {
38 | sHelps.put(R.string.misspelled, R.string.misspelled_summary);
39 | sHelps.put(R.string.have_to_donate, R.string.have_to_donate_summary);
40 | sHelps.put(R.string.cpu_freq_not_sticking, R.string.cpu_freq_not_sticking_summary);
41 | sHelps.put(R.string.feature_not_appearing, R.string.feature_not_appearing_summary);
42 | sHelps.put(R.string.feature_function, R.string.feature_function_summary);
43 | sHelps.put(R.string.add_new_features, R.string.add_new_features_summary);
44 | }
45 |
46 | @Override
47 | protected boolean showViewPager() {
48 | return false;
49 | }
50 |
51 | @Override
52 | protected void addItems(List items) {
53 | for (int id : sHelps.keySet()) {
54 | DescriptionView descriptionView = new DescriptionView();
55 | descriptionView.setTitle(getString(id));
56 | descriptionView.setSummary(getString(sHelps.get(id)));
57 |
58 | items.add(descriptionView);
59 | }
60 | }
61 |
62 | }
63 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/fragment_profile_dialog.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
21 |
22 |
30 |
31 |
36 |
37 |
46 |
47 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/app/src/main/java/com/bvalosek/cpuspy/CpuSpyApp.java:
--------------------------------------------------------------------------------
1 | //-----------------------------------------------------------------------------
2 | //
3 | // (C) Brandon Valosek, 2011
4 | // (C) Willi Ye, 2015
5 | //
6 | //-----------------------------------------------------------------------------
7 | // Modified by Willi Ye to work with big.LITTLE
8 |
9 | package com.bvalosek.cpuspy;
10 |
11 | import android.content.Context;
12 | import android.util.SparseArray;
13 |
14 | import com.grarak.kerneladiutor.utils.Prefs;
15 | import com.grarak.kerneladiutor.utils.Utils;
16 |
17 | /**
18 | * main application class
19 | */
20 | public class CpuSpyApp {
21 |
22 | private final String PREF_OFFSETS;
23 |
24 | /**
25 | * the long-living object used to monitor the system frequency states
26 | */
27 | private final CpuStateMonitor mMonitor;
28 |
29 | public CpuSpyApp(int core, Context context) {
30 | PREF_OFFSETS = "offsets" + core;
31 | mMonitor = new CpuStateMonitor(core);
32 | loadOffsets(context);
33 | }
34 |
35 | /**
36 | * @return the internal CpuStateMonitor object
37 | */
38 | public CpuStateMonitor getCpuStateMonitor() {
39 | return mMonitor;
40 | }
41 |
42 | /**
43 | * Load the saved string of offsets from preferences and put it into the
44 | * state monitor
45 | */
46 | private void loadOffsets(Context context) {
47 | String prefs = Prefs.getString(PREF_OFFSETS, "", context);
48 |
49 | if (prefs.isEmpty()) return;
50 | // split the string by peroids and then the info by commas and load
51 | SparseArray offsets = new SparseArray<>();
52 | String[] sOffsets = prefs.split(",");
53 | for (String offset : sOffsets) {
54 | String[] parts = offset.split(" ");
55 | offsets.put(Utils.strToInt(parts[0]), Utils.strToLong(parts[1]));
56 | }
57 |
58 | mMonitor.setOffsets(offsets);
59 | }
60 |
61 | /**
62 | * Save the state-time offsets as a string e.g. "100 24, 200 251, 500 124
63 | * etc
64 | */
65 | public void saveOffsets(Context context) {
66 | // build the string by iterating over the freq->duration map
67 | StringBuilder str = new StringBuilder();
68 | SparseArray offsets = mMonitor.getOffsets();
69 | for (int i = 0; i < offsets.size(); i++) {
70 | str.append(offsets.keyAt(i)).append(" ").append(offsets.valueAt(i)).append(",");
71 | }
72 |
73 | Prefs.saveString(PREF_OFFSETS, str.toString(), context);
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/app/src/main/java/com/grarak/kerneladiutor/views/recyclerview/ContributorView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-2016 Willi Ye
3 | *
4 | * This file is part of Kernel Adiutor.
5 | *
6 | * Kernel Adiutor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Kernel Adiutor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Kernel Adiutor. If not, see .
18 | *
19 | */
20 | package com.grarak.kerneladiutor.views.recyclerview;
21 |
22 | import android.view.View;
23 | import android.widget.TextView;
24 |
25 | import com.grarak.kerneladiutor.R;
26 | import com.grarak.kerneladiutor.utils.Utils;
27 | import com.grarak.kerneladiutor.utils.ViewUtils;
28 | import com.grarak.kerneladiutor.utils.other.Contributors;
29 | import com.mikhaellopez.circularimageview.CircularImageView;
30 |
31 | /**
32 | * Created by willi on 23.07.16.
33 | */
34 | public class ContributorView extends RecyclerViewItem {
35 |
36 | private final Contributors.Contributor mContributor;
37 |
38 | public ContributorView(Contributors.Contributor contributor) {
39 | mContributor = contributor;
40 | }
41 |
42 | @Override
43 | public int getLayoutRes() {
44 | return R.layout.rv_contributor_view;
45 | }
46 |
47 | @Override
48 | public void onCreateView(View view) {
49 | super.onCreateView(view);
50 |
51 | CircularImageView image = (CircularImageView) view.findViewById(R.id.image);
52 | TextView name = (TextView) view.findViewById(R.id.name);
53 | TextView contributions = (TextView) view.findViewById(R.id.contributions);
54 |
55 | ViewUtils.loadImagefromUrl(mContributor.getAvatarUrl(), image, 200, 200);
56 | name.setText(mContributor.getLogin());
57 | contributions.setText(view.getResources().getString(R.string.commits, mContributor.getContributions()));
58 |
59 | view.setOnClickListener(new View.OnClickListener() {
60 | @Override
61 | public void onClick(View v) {
62 | Utils.launchUrl(mContributor.getHtmlUrl(), v.getContext());
63 | }
64 | });
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/app/src/main/java/com/grarak/kerneladiutor/utils/kernel/cpuhotplug/AiOHotplug.java:
--------------------------------------------------------------------------------
1 | package com.grarak.kerneladiutor.utils.kernel.cpuhotplug;
2 |
3 | import android.content.Context;
4 |
5 | import com.grarak.kerneladiutor.fragments.ApplyOnBootFragment;
6 | import com.grarak.kerneladiutor.utils.Utils;
7 | import com.grarak.kerneladiutor.utils.root.Control;
8 |
9 | /**
10 | * Created by willi on 19.06.17.
11 | */
12 |
13 | public class AiOHotplug {
14 |
15 | private static final String PARENT = "/sys/kernel/AiO_HotPlug";
16 | private static final String TOGGLE = PARENT + "/toggle";
17 | private static final String CORES = PARENT + "/cores";
18 | private static final String BIG_CORES = PARENT + "/big_cores";
19 | private static final String LITTLE_CORES = PARENT + "/LITTLE_cores";
20 |
21 | public static void setLITTLECores(int cores, Context context) {
22 | run(Control.write(String.valueOf(cores), LITTLE_CORES), LITTLE_CORES, context);
23 | }
24 |
25 | public static int getLITTLECores() {
26 | return Utils.strToInt(Utils.readFile(LITTLE_CORES));
27 | }
28 |
29 | public static boolean hasLITTLECores() {
30 | return Utils.existFile(LITTLE_CORES);
31 | }
32 |
33 | public static void setBigCores(int cores, Context context) {
34 | run(Control.write(String.valueOf(cores), BIG_CORES), BIG_CORES, context);
35 | }
36 |
37 | public static int getBigCores() {
38 | return Utils.strToInt(Utils.readFile(BIG_CORES));
39 | }
40 |
41 | public static boolean hasBigCores() {
42 | return Utils.existFile(BIG_CORES);
43 | }
44 |
45 | public static void setCores(int cores, Context context) {
46 | run(Control.write(String.valueOf(cores), CORES), CORES, context);
47 | }
48 |
49 | public static int getCores() {
50 | return Utils.strToInt(Utils.readFile(CORES));
51 | }
52 |
53 | public static boolean hasCores() {
54 | return Utils.existFile(CORES);
55 | }
56 |
57 | public static void enable(boolean enable, Context context) {
58 | run(Control.write(enable ? "1" : "0", TOGGLE), TOGGLE, context);
59 | }
60 |
61 | public static boolean isEnabled() {
62 | return Utils.readFile(TOGGLE).equals("1");
63 | }
64 |
65 | public static boolean hasToggle() {
66 | return Utils.existFile(TOGGLE);
67 | }
68 |
69 | public static boolean supported() {
70 | return Utils.existFile(PARENT);
71 | }
72 |
73 | private static void run(String command, String id, Context context) {
74 | Control.runSetting(command, ApplyOnBootFragment.CPU_HOTPLUG, id, context);
75 | }
76 |
77 | }
78 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/ad_native_express_view.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
16 |
17 |
20 |
21 |
25 |
26 |
33 |
34 |
45 |
46 |
51 |
52 |
53 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/app/src/main/java/com/grarak/kerneladiutor/fragments/statistics/MemoryFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-2016 Willi Ye
3 | *
4 | * This file is part of Kernel Adiutor.
5 | *
6 | * Kernel Adiutor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Kernel Adiutor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Kernel Adiutor. If not, see .
18 | *
19 | */
20 | package com.grarak.kerneladiutor.fragments.statistics;
21 |
22 | import android.content.res.Configuration;
23 |
24 | import com.grarak.kerneladiutor.R;
25 | import com.grarak.kerneladiutor.fragments.RecyclerViewFragment;
26 | import com.grarak.kerneladiutor.utils.Device;
27 | import com.grarak.kerneladiutor.utils.Utils;
28 | import com.grarak.kerneladiutor.views.recyclerview.DescriptionView;
29 | import com.grarak.kerneladiutor.views.recyclerview.RecyclerViewItem;
30 |
31 | import java.util.List;
32 |
33 | /**
34 | * Created by willi on 05.08.16.
35 | */
36 | public class MemoryFragment extends RecyclerViewFragment {
37 |
38 | @Override
39 | protected boolean showViewPager() {
40 | return false;
41 | }
42 |
43 | @Override
44 | public int getSpanCount() {
45 | int span = Utils.isTablet(getActivity()) ? Utils.getOrientation(getActivity()) ==
46 | Configuration.ORIENTATION_LANDSCAPE ? 5 : 4 : Utils.getOrientation(getActivity()) ==
47 | Configuration.ORIENTATION_LANDSCAPE ? 3 : 2;
48 | if (itemsSize() != 0 && span > itemsSize()) {
49 | span = itemsSize();
50 | }
51 | return span;
52 | }
53 |
54 | @Override
55 | protected void addItems(List items) {
56 | List mems = Device.MemInfo.getItems();
57 | for (String mem : mems) {
58 | DescriptionView memView = new DescriptionView();
59 | memView.setTitle(mem);
60 | memView.setSummary(Device.MemInfo.getItem(mem).replace(" ", "")
61 | .replace("kB", getString(R.string.kb)));
62 |
63 | items.add(memView);
64 | }
65 | }
66 |
67 | @Override
68 | protected boolean showAd() {
69 | return true;
70 | }
71 |
72 | }
73 |
--------------------------------------------------------------------------------
/app/src/main/java/com/grarak/kerneladiutor/utils/kernel/entropy/Entropy.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-2016 Willi Ye
3 | *
4 | * This file is part of Kernel Adiutor.
5 | *
6 | * Kernel Adiutor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Kernel Adiutor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Kernel Adiutor. If not, see .
18 | *
19 | */
20 | package com.grarak.kerneladiutor.utils.kernel.entropy;
21 |
22 | import android.content.Context;
23 |
24 | import com.grarak.kerneladiutor.fragments.ApplyOnBootFragment;
25 | import com.grarak.kerneladiutor.utils.Utils;
26 | import com.grarak.kerneladiutor.utils.root.Control;
27 |
28 | /**
29 | * Created by willi on 29.06.16.
30 | */
31 | public class Entropy {
32 |
33 | private static final String PARENT = "/proc/sys/kernel/random";
34 | private static final String AVAILABLE = PARENT + "/entropy_avail";
35 | private static final String POOLSIZE = PARENT + "/poolsize";
36 | private static final String READ = PARENT + "/read_wakeup_threshold";
37 | private static final String WRITE = PARENT + "/write_wakeup_threshold";
38 |
39 | public static void setWrite(int value, Context context) {
40 | run(Control.write(String.valueOf(value), WRITE), WRITE, context);
41 | }
42 |
43 | public static int getWrite() {
44 | return Utils.strToInt(Utils.readFile(WRITE));
45 | }
46 |
47 | public static void setRead(int value, Context context) {
48 | run(Control.write(String.valueOf(value), READ), READ, context);
49 | }
50 |
51 | public static int getRead() {
52 | return Utils.strToInt(Utils.readFile(READ));
53 | }
54 |
55 | public static int getPoolsize() {
56 | return Utils.strToInt(Utils.readFile(POOLSIZE));
57 | }
58 |
59 | public static int getAvailable() {
60 | return Utils.strToInt(Utils.readFile(AVAILABLE));
61 | }
62 |
63 | public static boolean supported() {
64 | return Utils.existFile(PARENT);
65 | }
66 |
67 | private static void run(String command, String id, Context context) {
68 | Control.runSetting(command, ApplyOnBootFragment.ENTROPY, id, context);
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
13 |
14 |
24 |
25 |
29 |
30 |
36 |
37 |
43 |
44 |
50 |
51 |
57 |
58 |
59 |
60 |
66 |
67 |
68 |
69 |
70 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/app/src/main/res/layout/rv_datasharing_device.xml:
--------------------------------------------------------------------------------
1 |
2 |
12 |
13 |
18 |
19 |
28 |
29 |
33 |
34 |
38 |
39 |
46 |
47 |
57 |
58 |
59 |
63 |
64 |
65 |
66 |
--------------------------------------------------------------------------------
/app/src/main/java/com/grarak/kerneladiutor/views/recyclerview/downloads/KernelItemView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-2016 Willi Ye
3 | *
4 | * This file is part of Kernel Adiutor.
5 | *
6 | * Kernel Adiutor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Kernel Adiutor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Kernel Adiutor. If not, see .
18 | *
19 | */
20 | package com.grarak.kerneladiutor.views.recyclerview.downloads;
21 |
22 | import android.view.View;
23 | import android.widget.ImageView;
24 | import android.widget.TextView;
25 |
26 | import com.grarak.kerneladiutor.R;
27 | import com.grarak.kerneladiutor.utils.Utils;
28 | import com.grarak.kerneladiutor.utils.ViewUtils;
29 | import com.grarak.kerneladiutor.utils.tools.SupportedDownloads;
30 | import com.grarak.kerneladiutor.views.recyclerview.RecyclerViewItem;
31 |
32 | /**
33 | * Created by willi on 06.07.16.
34 | */
35 | public class KernelItemView extends RecyclerViewItem {
36 |
37 | private final SupportedDownloads.KernelContent mKernelContent;
38 |
39 | public KernelItemView(SupportedDownloads.KernelContent content) {
40 | mKernelContent = content;
41 | }
42 |
43 | @Override
44 | public int getLayoutRes() {
45 | return R.layout.rv_kernel_item_view;
46 | }
47 |
48 | @Override
49 | public void onCreateView(View view) {
50 | super.onCreateView(view);
51 |
52 | final ImageView icon = (ImageView) view.findViewById(R.id.icon);
53 | TextView title = (TextView) view.findViewById(R.id.title);
54 | TextView summary = (TextView) view.findViewById(R.id.summary);
55 |
56 | ViewUtils.loadImagefromUrl(mKernelContent.getLogo(), icon, 300, 300);
57 |
58 | title.setText(Utils.htmlFrom(mKernelContent.getName()).toString());
59 | summary.setText(Utils.htmlFrom(mKernelContent.getShortDescription()));
60 |
61 | view.setOnClickListener(new View.OnClickListener() {
62 | @Override
63 | public void onClick(View view) {
64 | if (getOnItemClickListener() != null) {
65 | getOnItemClickListener().onClick(KernelItemView.this);
66 | }
67 | }
68 | });
69 | }
70 |
71 | @Override
72 | protected boolean cardCompatible() {
73 | return false;
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/app/src/main/java/com/grarak/kerneladiutor/views/recyclerview/XYGraphView.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-2016 Willi Ye
3 | *
4 | * This file is part of Kernel Adiutor.
5 | *
6 | * Kernel Adiutor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Kernel Adiutor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Kernel Adiutor. If not, see .
18 | *
19 | */
20 | package com.grarak.kerneladiutor.views.recyclerview;
21 |
22 | import android.view.View;
23 | import android.widget.TextView;
24 |
25 | import com.grarak.kerneladiutor.R;
26 | import com.grarak.kerneladiutor.views.XYGraph;
27 |
28 | import java.util.ArrayList;
29 | import java.util.List;
30 |
31 | /**
32 | * Created by willi on 12.05.16.
33 | */
34 | public class XYGraphView extends RecyclerViewItem {
35 |
36 | private TextView mTitle;
37 | private TextView mText;
38 | private XYGraph mGraph;
39 |
40 | private CharSequence mTitleStr;
41 | private CharSequence mTextStr;
42 | private List mPercentages = new ArrayList<>();
43 |
44 | @Override
45 | public int getLayoutRes() {
46 | return R.layout.rv_xygraph_view;
47 | }
48 |
49 | @Override
50 | public void onCreateView(View view) {
51 | mTitle = (TextView) view.findViewById(R.id.title);
52 | mText = (TextView) view.findViewById(R.id.text);
53 | mGraph = (XYGraph) view.findViewById(R.id.graph);
54 |
55 | super.onCreateView(view);
56 | }
57 |
58 | public void setTitle(CharSequence title) {
59 | mTitleStr = title;
60 | refresh();
61 | }
62 |
63 | public void setText(CharSequence text) {
64 | mTextStr = text;
65 | refresh();
66 | }
67 |
68 | public void addPercentage(int percentage) {
69 | mPercentages.add(percentage);
70 | refresh();
71 | }
72 |
73 | @Override
74 |
75 | protected void refresh() {
76 | super.refresh();
77 | if (mTitle != null && mTitleStr != null) {
78 | mTitle.setText(mTitleStr);
79 | }
80 | if (mText != null && mTextStr != null) {
81 | mText.setText(mTextStr);
82 | }
83 | if (mGraph != null) {
84 | mGraph.clear();
85 | for (int per : mPercentages) {
86 | mGraph.addPercentage(per);
87 | }
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/app/src/main/java/com/grarak/kerneladiutor/database/tools/profiles/ImportProfile.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-2016 Willi Ye
3 | *
4 | * This file is part of Kernel Adiutor.
5 | *
6 | * Kernel Adiutor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Kernel Adiutor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Kernel Adiutor. If not, see .
18 | *
19 | */
20 | package com.grarak.kerneladiutor.database.tools.profiles;
21 |
22 | import com.grarak.kerneladiutor.utils.Utils;
23 |
24 | import org.json.JSONArray;
25 | import org.json.JSONException;
26 | import org.json.JSONObject;
27 |
28 | import java.util.LinkedHashMap;
29 |
30 | /**
31 | * Created by willi on 15.07.16.
32 | */
33 | public class ImportProfile {
34 |
35 | private int mVersion;
36 | private JSONArray mCommands;
37 |
38 | public ImportProfile(String path) {
39 | String json = Utils.readFile(path);
40 | if (json != null && !json.isEmpty()) {
41 | try {
42 | JSONObject main = new JSONObject(json);
43 | mVersion = main.getInt("version");
44 | JSONObject profile = main.getJSONObject("profile");
45 |
46 | mCommands = profile.getJSONArray("commands");
47 | for (int i = 0; i < mCommands.length(); i++) {
48 | JSONObject command = mCommands.getJSONObject(i);
49 | if (!command.has("path") || !command.has("command")) {
50 | mCommands = null;
51 | break;
52 | }
53 | }
54 | } catch (JSONException ignored) {
55 | }
56 | }
57 | }
58 |
59 | public LinkedHashMap getResults() {
60 | LinkedHashMap results = new LinkedHashMap<>();
61 | for (int i = 0; i < mCommands.length(); i++) {
62 | try {
63 | JSONObject command = mCommands.getJSONObject(i);
64 | results.put(command.getString("path"), command.getString("command"));
65 | } catch (JSONException ignored) {
66 | }
67 | }
68 | return results;
69 | }
70 |
71 | public boolean matchesVersion() {
72 | return Profiles.VERSION == mVersion;
73 | }
74 |
75 | public boolean readable() {
76 | return mCommands != null;
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/app/src/main/java/com/grarak/kerneladiutor/fragments/SwitcherFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2017 Willi Ye
3 | *
4 | * This file is part of Kernel Adiutor.
5 | *
6 | * Kernel Adiutor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Kernel Adiutor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Kernel Adiutor. If not, see .
18 | *
19 | */
20 | package com.grarak.kerneladiutor.fragments;
21 |
22 | import android.os.Bundle;
23 | import android.support.annotation.Nullable;
24 | import android.support.v7.widget.SwitchCompat;
25 | import android.view.LayoutInflater;
26 | import android.view.View;
27 | import android.view.ViewGroup;
28 | import android.widget.CompoundButton;
29 | import android.widget.TextView;
30 |
31 | import com.grarak.kerneladiutor.R;
32 |
33 | /**
34 | * Created by willi on 17.09.17.
35 | */
36 |
37 | public class SwitcherFragment extends BaseFragment {
38 |
39 | public static SwitcherFragment newInstance(String title, String summary, boolean checked,
40 | CompoundButton.OnCheckedChangeListener onCheckedChangeListener) {
41 | SwitcherFragment fragment = new SwitcherFragment();
42 | fragment.mTitle = title;
43 | fragment.mSummary = summary;
44 | fragment.mChecked = checked;
45 | fragment.mOnCheckedChangeListener = onCheckedChangeListener;
46 | return fragment;
47 | }
48 |
49 | private String mTitle;
50 | private String mSummary;
51 | private boolean mChecked;
52 | private CompoundButton.OnCheckedChangeListener mOnCheckedChangeListener;
53 |
54 | private SwitchCompat mSwitch;
55 |
56 | @Nullable
57 | @Override
58 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
59 | @Nullable Bundle savedInstanceState) {
60 | View view = inflater.inflate(R.layout.fragment_switcher, container, false);
61 | if (mTitle != null) {
62 | ((TextView) view.findViewById(R.id.title)).setText(mTitle);
63 | }
64 | if (mSummary != null) {
65 | ((TextView) view.findViewById(R.id.summary)).setText(mSummary);
66 | }
67 | mSwitch = view.findViewById(R.id.switcher);
68 | mSwitch.setChecked(mChecked);
69 | mSwitch.setOnCheckedChangeListener(mOnCheckedChangeListener);
70 | return view;
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/app/src/main/java/com/grarak/kerneladiutor/activities/tools/CustomControlsActivity.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-2016 Willi Ye
3 | *
4 | * This file is part of Kernel Adiutor.
5 | *
6 | * Kernel Adiutor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Kernel Adiutor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Kernel Adiutor. If not, see .
18 | *
19 | */
20 | package com.grarak.kerneladiutor.activities.tools;
21 |
22 | import android.os.Bundle;
23 | import android.support.annotation.Nullable;
24 | import android.support.v4.app.Fragment;
25 |
26 | import com.grarak.kerneladiutor.R;
27 | import com.grarak.kerneladiutor.activities.BaseActivity;
28 | import com.grarak.kerneladiutor.fragments.tools.customcontrols.CreateFragment;
29 | import com.grarak.kerneladiutor.utils.tools.customcontrols.Items;
30 |
31 | import java.util.ArrayList;
32 |
33 | /**
34 | * Created by willi on 30.06.16.
35 | */
36 | public class CustomControlsActivity extends BaseActivity {
37 |
38 | public static final String SETTINGS_INTENT = "settings";
39 | public static final String RESULT_INTENT = "result";
40 |
41 | private ArrayList mSettings;
42 |
43 | @Override
44 | protected void onCreate(@Nullable Bundle savedInstanceState) {
45 | super.onCreate(savedInstanceState);
46 | setContentView(R.layout.activity_fragments);
47 |
48 | initToolBar();
49 |
50 | mSettings = getIntent().getParcelableArrayListExtra(SETTINGS_INTENT);
51 | for (Items.Setting setting : mSettings) {
52 | if (setting.getId().equals("id")) {
53 | getSupportActionBar().setTitle(getString(Items.Control.getControl(setting.getName(null)
54 | .toString()).getRes()));
55 | }
56 | }
57 |
58 | getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, getFragment(),
59 | "create_fragment").commit();
60 | }
61 |
62 | private Fragment getFragment() {
63 | Fragment fragment = getSupportFragmentManager().findFragmentByTag("create_fragment");
64 | if (fragment == null) {
65 | return CreateFragment.newInstance(mSettings);
66 | }
67 | return fragment;
68 | }
69 |
70 | @Override
71 | public void finish() {
72 | getSupportFragmentManager().beginTransaction().remove(getFragment()).commit();
73 | super.finish();
74 | }
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/app/src/main/java/com/grarak/kerneladiutor/utils/kernel/vm/ZRAM.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-2016 Willi Ye
3 | *
4 | * This file is part of Kernel Adiutor.
5 | *
6 | * Kernel Adiutor is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU General Public License as published by
8 | * the Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * Kernel Adiutor is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License
17 | * along with Kernel Adiutor. If not, see .
18 | *
19 | */
20 | package com.grarak.kerneladiutor.utils.kernel.vm;
21 |
22 | import android.content.Context;
23 |
24 | import com.grarak.kerneladiutor.fragments.ApplyOnBootFragment;
25 | import com.grarak.kerneladiutor.utils.Utils;
26 | import com.grarak.kerneladiutor.utils.root.Control;
27 |
28 | /**
29 | * Created by willi on 03.08.16.
30 | */
31 | public class ZRAM {
32 |
33 | private static final String ZRAM = "/sys/block/zram0";
34 | private static final String BLOCK = "/dev/block/zram0";
35 | private static final String DISKSIZE = "/sys/block/zram0/disksize";
36 | private static final String RESET = "/sys/block/zram0/reset";
37 | private static final String MAX_COMP_STREAMS = "/sys/block/zram0/max_comp_streams";
38 |
39 | public static void setDisksize(final int value, final Context context) {
40 | String maxCompStrems = null;
41 | if (Utils.existFile(MAX_COMP_STREAMS)) {
42 | maxCompStrems = Utils.readFile(MAX_COMP_STREAMS);
43 | }
44 | int size = value * 1024 * 1024;
45 | run("swapoff " + BLOCK + " > /dev/null 2>&1", BLOCK + "swapoff", context);
46 | run(Control.write("1", RESET), RESET, context);
47 | run(Control.write("0", DISKSIZE), DISKSIZE + "reset", context);
48 | if (maxCompStrems != null) {
49 | run(Control.write(maxCompStrems, MAX_COMP_STREAMS), MAX_COMP_STREAMS, context);
50 | }
51 | if (size != 0) {
52 | run(Control.write(String.valueOf(size), DISKSIZE), DISKSIZE, context);
53 | run("mkswap " + BLOCK + " > /dev/null 2>&1", BLOCK + "mkswap", context);
54 | run("swapon " + BLOCK + " > /dev/null 2>&1", BLOCK + "swapon", context);
55 | }
56 | }
57 |
58 | public static int getDisksize() {
59 | return Utils.strToInt(Utils.readFile(DISKSIZE)) / 1024 / 1024;
60 | }
61 |
62 | public static boolean supported() {
63 | return Utils.existFile(ZRAM);
64 | }
65 |
66 | private static void run(String command, String id, Context context) {
67 | Control.runSetting(command, ApplyOnBootFragment.VM, id, context);
68 | }
69 |
70 | }
71 |
--------------------------------------------------------------------------------
/app/src/main/assets/temp.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "board": "apq8084",
4 | "cpu": "/sys/class/thermal/thermal_zone6/temp",
5 | "gpu": "/sys/class/thermal/thermal_zone10/temp",
6 | "cpu-offset": 1,
7 | "gpu-offset": 1
8 | },
9 | {
10 | "board": "baytrail",
11 | "cpu": "/sys/class/thermal/thermal_zone1/temp",
12 | "cpu-offset": 1000
13 | },
14 | {
15 | "board": "msm8226",
16 | "cpu": "/sys/class/thermal/thermal_zone0/temp",
17 | "gpu": "/sys/class/thermal/thermal_zone2/temp",
18 | "cpu-offset": 1,
19 | "gpu-offset": 1
20 | },
21 | {
22 | "board": "msm8228",
23 | "cpu": "/sys/class/thermal/thermal_zone0/temp",
24 | "gpu": "/sys/class/thermal/thermal_zone2/temp",
25 | "cpu-offset": 1,
26 | "gpu-offset": 1
27 | },
28 | {
29 | "board": "msm8610",
30 | "cpu": "/sys/class/thermal/thermal_zone5/temp",
31 | "cpu-offset": 1
32 | },
33 | {
34 | "board": "msm8916",
35 | "cpu": "/sys/class/thermal/thermal_zone0/temp",
36 | "gpu": "/sys/class/thermal/thermal_zone2/temp",
37 | "cpu-offset": 1000,
38 | "gpu-offset": 1
39 | },
40 | {
41 | "board": "msm8960",
42 | "cpu": "/sys/class/thermal/thermal_zone7/temp",
43 | "cpu-offset": 1
44 | },
45 | {
46 | "board": "msm8974",
47 | "cpu": "/sys/class/thermal/thermal_zone5/temp",
48 | "gpu": "/sys/class/thermal/thermal_zone9/temp",
49 | "cpu-offset": 1,
50 | "gpu-offset": 1
51 | },
52 | {
53 | "board": "msm8974pro-ac",
54 | "cpu": "/sys/class/thermal/thermal_zone5/temp",
55 | "gpu": "/sys/class/thermal/thermal_zone9/temp",
56 | "cpu-offset": 1,
57 | "gpu-offset": 1
58 | },
59 | {
60 | "board": "msm8992",
61 | "cpu": "/sys/class/thermal/thermal_zone7/temp",
62 | "gpu": "/sys/class/thermal/thermal_zone11/temp",
63 | "cpu-offset": 1,
64 | "gpu-offset": 1
65 | },
66 | {
67 | "board": "msm8994",
68 | "cpu": "/sys/class/thermal/thermal_zone8/temp",
69 | "gpu": "/sys/class/thermal/thermal_zone13/temp",
70 | "cpu-offset": 1,
71 | "gpu-offset": 1
72 | },
73 | {
74 | "board": "msm8996",
75 | "cpu": "/sys/class/thermal/thermal_zone5/temp",
76 | "gpu": "/sys/class/thermal/thermal_zone16/temp",
77 | "cpu-offset": 10,
78 | "gpu-offset": 10
79 | },
80 | {
81 | "board": "msm8996pro",
82 | "cpu": "/sys/class/thermal/thermal_zone5/temp",
83 | "gpu": "/sys/class/thermal/thermal_zone16/temp",
84 | "cpu-offset": 10,
85 | "gpu-offset": 10
86 | },
87 | {
88 | "board": "msm8998",
89 | "cpu": "/sys/class/thermal/thermal_zone11/temp",
90 | "gpu": "/sys/class/thermal/thermal_zone21/temp",
91 | "cpu-offset": 10,
92 | "gpu-offset": 10
93 | },
94 | {
95 | "board": "mt6735",
96 | "cpu": "/sys/class/thermal/thermal_zone2/temp",
97 | "gpu": "/sys/class/thermal/thermal_zone9/temp",
98 | "cpu-offset": 1000,
99 | "gpu-offset": 1000
100 | }
101 | ]
102 |
--------------------------------------------------------------------------------
/app/src/main/res/values/pageindicator.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 | true
47 | #FFFFFFFF
48 | #00000000
49 | 0
50 | 3dp
51 | false
52 | #FFDDDDDD
53 | 1dp
54 | 0dp
55 |
56 |
--------------------------------------------------------------------------------