├── .github
└── workflows
│ └── release.yml
├── .gitignore
├── LICENSE
├── POLICY.md
├── README.md
├── app
├── .gitignore
├── build.gradle
├── proguard-rules.pro
├── release
│ ├── app-release.apk
│ └── output-metadata.json
└── src
│ └── main
│ ├── AndroidManifest.xml
│ ├── AndroidManifest3.xml
│ ├── AndroidManifest4.xml
│ ├── assets
│ ├── downloads.json
│ ├── gamma_profiles.json
│ ├── temp.json
│ └── update.json
│ ├── java
│ └── com
│ │ ├── bvalosek
│ │ └── cpuspy
│ │ │ ├── CpuSpyApp.java
│ │ │ └── CpuStateMonitor.java
│ │ ├── grx
│ │ └── soundcontrol
│ │ │ ├── GrxEqualizerBandController.java
│ │ │ ├── GrxEqualizerManager.java
│ │ │ ├── GrxVolumeControlView.java
│ │ │ ├── GrxVolumeItemController.java
│ │ │ ├── GrxVolumeManager.java
│ │ │ └── VerticalSeekBar.java
│ │ └── hades
│ │ └── hKtweaks
│ │ ├── activities
│ │ ├── AboutActivity.java
│ │ ├── AboutInfoActivity.java
│ │ ├── BaseActivity.java
│ │ ├── EditorActivity.java
│ │ ├── FilePickerActivity.java
│ │ ├── NavigationActivity.java
│ │ ├── SplashActivity.java
│ │ └── tools
│ │ │ ├── CustomControlsActivity.java
│ │ │ ├── DownloadsActivity.java
│ │ │ └── profile
│ │ │ ├── ProfileActivity.java
│ │ │ ├── ProfileEditActivity.java
│ │ │ └── ProfileTaskerActivity.java
│ │ ├── database
│ │ ├── Provider.java
│ │ ├── Settings.java
│ │ └── tools
│ │ │ ├── customcontrols
│ │ │ ├── Controls.java
│ │ │ ├── ExportControl.java
│ │ │ └── ImportControl.java
│ │ │ └── profiles
│ │ │ ├── ExportProfile.java
│ │ │ ├── ImportProfile.java
│ │ │ └── Profiles.java
│ │ ├── fragments
│ │ ├── ApplyOnBootFragment.java
│ │ ├── BaseFragment.java
│ │ ├── LoadingFragment.java
│ │ ├── kernel
│ │ │ ├── BatteryFragment.java
│ │ │ ├── BoefflaWakelockFragment.java
│ │ │ ├── BusCamFragment.java
│ │ │ ├── BusDispFragment.java
│ │ │ ├── BusIntFragment.java
│ │ │ ├── BusMifFragment.java
│ │ │ ├── CPUFragment.java
│ │ │ ├── CPUHotplugFragment.java
│ │ │ ├── CPUVoltageCl0Fragment.java
│ │ │ ├── CPUVoltageCl1Fragment.java
│ │ │ ├── DvfsFragment.java
│ │ │ ├── EntropyFragment.java
│ │ │ ├── GPUFragment.java
│ │ │ ├── HmpFragment.java
│ │ │ ├── IOFragment.java
│ │ │ ├── KSMFragment.java
│ │ │ ├── LEDFragment.java
│ │ │ ├── LMKFragment.java
│ │ │ ├── MiscFragment.java
│ │ │ ├── PathReaderFragment.java
│ │ │ ├── ScreenFragment.java
│ │ │ ├── SoundFragment.java
│ │ │ ├── SpectrumFragment.java
│ │ │ ├── ThermalFragment.java
│ │ │ ├── VMFragment.java
│ │ │ ├── WakeFragment.java
│ │ │ └── WakelockFragment.java
│ │ ├── other
│ │ │ └── SettingsFragment.java
│ │ ├── recyclerview
│ │ │ ├── LoadAsyncTask.java
│ │ │ └── RecyclerViewFragment.java
│ │ ├── statistics
│ │ │ ├── DeviceFragment.java
│ │ │ ├── InputsFragment.java
│ │ │ ├── MemoryFragment.java
│ │ │ └── OverallFragment.java
│ │ └── tools
│ │ │ ├── BackupFragment.java
│ │ │ ├── BuildpropFragment.java
│ │ │ ├── InitdFragment.java
│ │ │ ├── OnBootFragment.java
│ │ │ ├── ProfileFragment.java
│ │ │ ├── RecoveryFragment.java
│ │ │ ├── customcontrols
│ │ │ ├── CreateFragment.java
│ │ │ └── CustomControlsFragment.java
│ │ │ └── downloads
│ │ │ ├── AboutFragment.java
│ │ │ ├── DownloadKernelFragment.java
│ │ │ ├── DownloadsFragment.java
│ │ │ └── FeaturesFragment.java
│ │ ├── services
│ │ ├── DashClock.java
│ │ ├── boot
│ │ │ ├── ApplyOnBoot.java
│ │ │ ├── ApplyOnBootService.java
│ │ │ └── OnBootReceiver.java
│ │ ├── monitor
│ │ │ └── Monitor.java
│ │ └── profile
│ │ │ ├── Tasker.java
│ │ │ ├── Tile.java
│ │ │ └── Widget.java
│ │ ├── utils
│ │ ├── AppSettings.java
│ │ ├── Device.java
│ │ ├── DownloadTask.java
│ │ ├── FingerprintUiHelper.java
│ │ ├── Log.java
│ │ ├── NotificationId.java
│ │ ├── Prefs.java
│ │ ├── Updater.java
│ │ ├── Utils.java
│ │ ├── ViewUtils.java
│ │ ├── WebpageReader.java
│ │ ├── kernel
│ │ │ ├── Switch.java
│ │ │ ├── battery
│ │ │ │ └── Battery.java
│ │ │ ├── boefflawakelock
│ │ │ │ ├── BoefflaWakelock.java
│ │ │ │ └── WakeLockInfo.java
│ │ │ ├── bus
│ │ │ │ ├── VoltageCam.java
│ │ │ │ ├── VoltageDisp.java
│ │ │ │ ├── VoltageInt.java
│ │ │ │ └── VoltageMif.java
│ │ │ ├── cpu
│ │ │ │ ├── CPUBoost.java
│ │ │ │ ├── CPUFreq.java
│ │ │ │ ├── MSMPerformance.java
│ │ │ │ ├── Misc.java
│ │ │ │ └── Temperature.java
│ │ │ ├── cpuhotplug
│ │ │ │ ├── AiOHotplug.java
│ │ │ │ ├── AlucardHotplug.java
│ │ │ │ ├── AutoSmp.java
│ │ │ │ ├── BluPlug.java
│ │ │ │ ├── ClusterHotplug.java
│ │ │ │ ├── CoreCtl.java
│ │ │ │ ├── Hotplug.java
│ │ │ │ ├── IntelliPlug.java
│ │ │ │ ├── LazyPlug.java
│ │ │ │ ├── MBHotplug.java
│ │ │ │ ├── MPDecision.java
│ │ │ │ ├── MSMHotplug.java
│ │ │ │ ├── MakoHotplug.java
│ │ │ │ ├── QcomBcl.java
│ │ │ │ ├── SamsungPlug.java
│ │ │ │ ├── ThunderPlug.java
│ │ │ │ └── ZenDecision.java
│ │ │ ├── cpuvoltage
│ │ │ │ ├── VoltageCl0.java
│ │ │ │ └── VoltageCl1.java
│ │ │ ├── dvfs
│ │ │ │ └── Dvfs.java
│ │ │ ├── entropy
│ │ │ │ └── Entropy.java
│ │ │ ├── gpu
│ │ │ │ ├── AdrenoBoost.java
│ │ │ │ ├── AdrenoIdler.java
│ │ │ │ ├── GPU.java
│ │ │ │ ├── GPUFreq.java
│ │ │ │ ├── GPUFreqExynos.java
│ │ │ │ ├── GPUFreqTmu.java
│ │ │ │ └── SimpleGPU.java
│ │ │ ├── hmp
│ │ │ │ └── Hmp.java
│ │ │ ├── io
│ │ │ │ └── IO.java
│ │ │ ├── ksm
│ │ │ │ └── KSM.java
│ │ │ ├── led
│ │ │ │ ├── LED.java
│ │ │ │ └── Sec.java
│ │ │ ├── lmk
│ │ │ │ └── LMK.java
│ │ │ ├── misc
│ │ │ │ ├── Misc.java
│ │ │ │ ├── PowerSuspend.java
│ │ │ │ ├── Pwm.java
│ │ │ │ ├── Selinux.java
│ │ │ │ ├── Vibration.java
│ │ │ │ └── Wakelocks.java
│ │ │ ├── screen
│ │ │ │ ├── Calibration.java
│ │ │ │ ├── Gamma.java
│ │ │ │ ├── GammaProfiles.java
│ │ │ │ ├── Misc.java
│ │ │ │ └── Screen.java
│ │ │ ├── sound
│ │ │ │ ├── ArizonaSound.java
│ │ │ │ ├── MoroSound.java
│ │ │ │ └── Sound.java
│ │ │ ├── spectrum
│ │ │ │ ├── ProfileTile.java
│ │ │ │ └── Spectrum.java
│ │ │ ├── thermal
│ │ │ │ ├── MSMThermal.java
│ │ │ │ ├── Thermal.java
│ │ │ │ └── Thermald.java
│ │ │ ├── vm
│ │ │ │ ├── VM.java
│ │ │ │ ├── ZRAM.java
│ │ │ │ └── ZSwap.java
│ │ │ ├── wake
│ │ │ │ ├── Dt2s.java
│ │ │ │ ├── Dt2w.java
│ │ │ │ ├── GestureVibration.java
│ │ │ │ ├── Gestures.java
│ │ │ │ ├── Misc.java
│ │ │ │ ├── S2s.java
│ │ │ │ ├── S2w.java
│ │ │ │ ├── T2w.java
│ │ │ │ └── Wake.java
│ │ │ └── wakelock
│ │ │ │ └── Wakelock.java
│ │ ├── other
│ │ │ └── Contributors.java
│ │ ├── root
│ │ │ ├── Control.java
│ │ │ ├── RootFile.java
│ │ │ └── RootUtils.java
│ │ ├── server
│ │ │ ├── DeviceInfo.java
│ │ │ ├── Server.java
│ │ │ ├── ServerCreateDevice.java
│ │ │ └── ServerSearchDevice.java
│ │ └── tools
│ │ │ ├── Backup.java
│ │ │ ├── Buildprop.java
│ │ │ ├── Initd.java
│ │ │ ├── Recovery.java
│ │ │ ├── SupportedDownloads.java
│ │ │ └── customcontrols
│ │ │ ├── CustomControlException.java
│ │ │ ├── Items.java
│ │ │ └── Values.java
│ │ └── views
│ │ ├── BorderCircleView.java
│ │ ├── ColorTable.java
│ │ ├── NavHeaderView.java
│ │ ├── XYGraph.java
│ │ ├── dialog
│ │ └── Dialog.java
│ │ └── recyclerview
│ │ ├── ApplyOnBootFView.java
│ │ ├── CardView.java
│ │ ├── CheckBoxView.java
│ │ ├── DescriptionFView.java
│ │ ├── DescriptionView.java
│ │ ├── DropDownView.java
│ │ ├── EditTextView.java
│ │ ├── GenericSelectView.java
│ │ ├── GenericSelectView2.java
│ │ ├── ImageView.java
│ │ ├── ProgressBarView.java
│ │ ├── RecyclerViewAdapter.java
│ │ ├── RecyclerViewItem.java
│ │ ├── SeekBarView.java
│ │ ├── SelectView.java
│ │ ├── SelectViewCheckbox.java
│ │ ├── StatsView.java
│ │ ├── SwitchView.java
│ │ ├── SwitcherFView.java
│ │ ├── TitleView.java
│ │ ├── ValueView.java
│ │ ├── ValueView2.java
│ │ ├── XYGraphView.java
│ │ ├── customcontrols
│ │ ├── CodeView.java
│ │ └── ErrorView.java
│ │ ├── downloads
│ │ ├── DownloadAboutView.java
│ │ ├── DownloadKernelView.java
│ │ └── KernelItemView.java
│ │ └── overallstatistics
│ │ ├── FrequencyButtonView.java
│ │ ├── FrequencyTableView.java
│ │ └── TemperatureView.java
│ └── res
│ ├── anim
│ ├── slide_in_bottom.xml
│ └── splash_animation.xml
│ ├── drawable-xxhdpi
│ ├── display_theme_dark.webp
│ └── display_theme_light.webp
│ ├── drawable
│ ├── eq_tick_mark.xml
│ ├── hades_adaptive_logo.xml
│ ├── hades_outline.xml
│ ├── ic_battery.xml
│ ├── ic_blank.xml
│ ├── ic_bolt.xml
│ ├── ic_cpu.xml
│ ├── ic_display.xml
│ ├── ic_dvfs.xml
│ ├── ic_github.png
│ ├── ic_googleplus.png
│ ├── ic_launcher.xml
│ ├── ic_launcher_background.xml
│ ├── ic_launcher_foreground.xml
│ ├── ic_launcher_preview.png
│ ├── ic_merge.xml
│ ├── ic_paypal.png
│ ├── ic_profile_corsicanu.jpeg
│ ├── ic_profile_grarak.webp
│ ├── ic_profile_morogoku.jpeg
│ ├── ic_profile_shape.xml
│ ├── ic_profile_yanndroid.jpg
│ ├── ic_shell.xml
│ ├── ic_spectrum_balanced.xml
│ ├── ic_spectrum_battery.xml
│ ├── ic_spectrum_game.xml
│ ├── ic_spectrum_logo.xml
│ ├── ic_spectrum_performance.xml
│ ├── ic_spectrum_tile_balanced.xml
│ ├── ic_spectrum_tile_battery.xml
│ ├── ic_spectrum_tile_game.xml
│ ├── ic_spectrum_tile_logo.xml
│ ├── ic_spectrum_tile_performance.xml
│ ├── ic_splash_background.xml
│ ├── ic_splash_bg_gradient.xml
│ ├── ic_switch.xml
│ ├── ic_temperature.xml
│ ├── ic_touch.xml
│ ├── ic_xda.png
│ ├── link.png
│ ├── link_a.png
│ ├── logo.png
│ ├── profile_widget_preview.webp
│ ├── ripple_drawable.xml
│ └── unlink.png
│ ├── layout
│ ├── activity_about.xml
│ ├── activity_about_info.xml
│ ├── activity_downloads.xml
│ ├── activity_editor.xml
│ ├── activity_fragments.xml
│ ├── activity_navigation.xml
│ ├── activity_profile.xml
│ ├── activity_splash.xml
│ ├── alertdialog_wakelock_fragment.xml
│ ├── design_navigation_item_separator.xml
│ ├── design_navigation_item_subheader.xml
│ ├── dev_list_item.xml
│ ├── fragment_apply_on_boot.xml
│ ├── fragment_description.xml
│ ├── fragment_linear_layout.xml
│ ├── fragment_loading.xml
│ ├── fragment_profile_details.xml
│ ├── fragment_profile_dialog.xml
│ ├── fragment_recovery_options.xml
│ ├── fragment_recyclerview.xml
│ ├── fragment_switcher.xml
│ ├── fragment_usage_view.xml
│ ├── grx_equalizer.xml
│ ├── grx_equalizer_band.xml
│ ├── grx_volume_controls.xml
│ ├── grx_volume_item.xml
│ ├── lib_list_item.xml
│ ├── nav_header_layout.xml
│ ├── nav_header_view.xml
│ ├── rv_card_view.xml
│ ├── rv_checkbox_view.xml
│ ├── rv_code_view.xml
│ ├── rv_description_view.xml
│ ├── rv_download_about_view.xml
│ ├── rv_download_kernel_view.xml
│ ├── rv_drop_down_item_view.xml
│ ├── rv_drop_down_view.xml
│ ├── rv_edittext_view.xml
│ ├── rv_error_view.xml
│ ├── rv_frequencytable_buttons_view.xml
│ ├── rv_frequencytable_view.xml
│ ├── rv_image_view.xml
│ ├── rv_kernel_item_view.xml
│ ├── rv_progressbar_view.xml
│ ├── rv_seekbar_view.xml
│ ├── rv_stats_view.xml
│ ├── rv_switch_view.xml
│ ├── rv_temperature_view.xml
│ ├── rv_title_view.xml
│ ├── rv_value_view.xml
│ ├── rv_value_view_2.xml
│ ├── rv_xygraph_view.xml
│ ├── sesl_badge.xml
│ ├── widget_profile.xml
│ └── widget_profile_item.xml
│ ├── menu
│ ├── rvf_menu.xml
│ └── save_menu.xml
│ ├── values-af
│ └── strings.xml
│ ├── values-ar
│ └── strings.xml
│ ├── values-ast-rES
│ └── strings.xml
│ ├── values-az
│ └── strings.xml
│ ├── values-bg
│ └── strings.xml
│ ├── values-ca
│ └── strings.xml
│ ├── values-cs
│ └── strings.xml
│ ├── values-da
│ └── strings.xml
│ ├── values-de
│ └── strings.xml
│ ├── values-el
│ └── strings.xml
│ ├── values-es
│ └── strings.xml
│ ├── values-et
│ └── strings.xml
│ ├── values-fi
│ └── strings.xml
│ ├── values-fr
│ └── strings.xml
│ ├── values-he
│ └── strings.xml
│ ├── values-hi
│ └── strings.xml
│ ├── values-hr
│ └── strings.xml
│ ├── values-hu
│ └── strings.xml
│ ├── values-hy-rAM
│ └── strings.xml
│ ├── values-id
│ └── strings.xml
│ ├── values-it
│ └── strings.xml
│ ├── values-ja
│ └── strings.xml
│ ├── values-kn
│ └── strings.xml
│ ├── values-ko
│ └── strings.xml
│ ├── values-nl
│ └── strings.xml
│ ├── values-no
│ └── strings.xml
│ ├── values-pl
│ └── strings.xml
│ ├── values-pt-rBR
│ └── strings.xml
│ ├── values-pt-rPT
│ └── strings.xml
│ ├── values-ro
│ └── strings.xml
│ ├── values-ru
│ └── strings.xml
│ ├── values-sk
│ └── strings.xml
│ ├── values-sl
│ └── strings.xml
│ ├── values-sr
│ └── strings.xml
│ ├── values-sv
│ └── strings.xml
│ ├── values-tr
│ └── strings.xml
│ ├── values-uk
│ └── strings.xml
│ ├── values-v21
│ └── dimens.xml
│ ├── values-vi
│ └── strings.xml
│ ├── values-zh-rCN
│ └── strings.xml
│ ├── values-zh-rTW
│ └── strings.xml
│ ├── values
│ ├── arrays.xml
│ ├── attrs.xml
│ ├── colors.xml
│ ├── dimens.xml
│ └── strings.xml
│ └── xml
│ ├── profile_widget.xml
│ ├── provider_paths.xml
│ ├── settings.xml
│ └── shortcuts.xml
├── build.gradle
├── controls
└── selinux.json
├── download
├── angler.json
├── condor.json
├── desire816.json
├── falcon.json
├── g3.json
├── g3beat_jag3gds.json
├── g3beat_jagnm.json
├── galaxyr.json
├── galaxys5.json
├── galaxys7.json
├── galaxys7edge.json
├── jalebi.json
├── lettuce.json
├── nicki.json
├── oneplusone.json
├── peregrine.json
├── quark.json
├── s2.json
├── sm-g900t.json
├── sprout.json
├── tomato.json
├── wingtech.json
├── x3.json
└── xperiasp.json
├── generateThemes.sh
├── gradle.properties
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── importTranslations.sh
├── readme-res
├── 1.png
├── 2.png
├── 3.png
├── 4.jpg
├── 5.jpg
└── icon.png
├── settings.gradle
├── theme_generator.cpp
└── translation_verifyer.cpp
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: New Release
2 | on:
3 | workflow_dispatch:
4 |
5 | jobs:
6 | release:
7 | runs-on: ubuntu-latest
8 | steps:
9 | - name: Checkout
10 | uses: actions/checkout@v2
11 | - name: Init values
12 | id: values
13 | run: |
14 | version=$(grep -Po -m 1 '(?<=versionName ).*' ./app/build.gradle | tr -d \")
15 | echo ::set-output name=name::hKtweaks v$version
16 | echo ::set-output name=tag::v$(echo $version | tr -d "\- OneUI")
17 | echo ::set-output name=apk::hKtweaks_v$(echo $version | sed -r 's/[- ]+/_/g')
18 | - name: Create release
19 | id: create_release
20 | uses: actions/create-release@v1
21 | env:
22 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23 | with:
24 | release_name: ${{ steps.values.outputs.name }}
25 | tag_name: ${{ steps.values.outputs.tag }}
26 | body: changelog
27 | - name: Add apk
28 | uses: actions/upload-release-asset@v1
29 | env:
30 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 | with:
32 | upload_url: ${{ steps.create_release.outputs.upload_url }}
33 | asset_path: ./app/release/app-release.apk
34 | asset_name: ${{ steps.values.outputs.apk }}.apk
35 | asset_content_type: application/vnd.android.package-archive
36 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | *.properties
4 | .DS_Store
5 | /build
6 | /captures
7 | .idea
8 |
9 | translation_verifyer
10 | theme_generator
11 | /themes
12 | /app/google-services.json
13 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | #
hKtweaks - OneUI
2 |
3 | This is a OneUI-Themed version of Corsicanu's [hKtweaks](https://github.com/corsicanu/hKtweaks).
4 |
5 |
6 |
7 |
8 |
9 | ## Download
10 | [Download apk](https://github.com/Yanndroid/hKtweaks-OneUI/raw/master/app/release/app-release.apk)
11 |
12 | Future updates will be available in the app.
13 |
14 | ## Credits
15 | * Willi Ye: [KernelAdiutor](https://github.com/Grarak/KernelAdiutor)
16 | * MoroGoku: [MTweaks](https://github.com/morogoku/MTweaks-KernelAdiutorMOD)
17 | * Corsicanu: [hKtweaks](https://github.com/corsicanu/hKtweaks)
18 |
19 | Following libraries were used:
20 |
21 | * Yanndroid: [OneUI Design Library](https://github.com/Yanndroid/OneUI-Design-Library)
22 | * Roman Nurik: [DashClock](https://github.com/romannurik/dashclock)
23 | * CyanogenMod: [CyanogenMod Platform SDK](https://github.com/CyanogenMod/cm_platform_sdk)
24 | * Bumptech: [Glide](https://github.com/bumptech/glide)
25 | * Bvalosek: [CpuSpy](https://github.com/bvalosek/cpuspy)
26 | * Grouxho: [Grx SoundControl](https://github.com/Grouxho)
27 | * Google: [Gson](https://github.com/google/gson)
28 | * Google: [Firebase](https://firebase.google.com/)
29 | * Google: [AppCompat](https://developer.android.com/topic/libraries/support-library/features.html#v7)
30 | * Google: [Material](https://github.com/material-components/material-components-android)
31 |
32 | Also code from different people, thank you all:
33 |
34 | * Andrei F. [RootUtils](https://github.com/Grarak/KernelAdiutor/blob/master/app/src/main/java/com/grarak/kerneladiutor/utils/root/RootUtils.java)
35 |
36 | * apbaxel _(Many sys interface paths has been taken from his [UKM-Project](https://github.com/apbaxel/UKM))_
37 |
38 | ## License
39 |
40 | Copyright (C) 2015-2016 Willi Ye
41 | Copyright (C) 2017 morogoku
42 | Copyright (C) 2019-2020 corsicanu
43 |
44 |
45 | hKtweaks is free software: you can redistribute it and/or modify
46 | it under the terms of the GNU General Public License as published by
47 | the Free Software Foundation, either version 3 of the License, or
48 | (at your option) any later version.
49 |
50 | hKtweaks is distributed in the hope that it will be useful,
51 | but WITHOUT ANY WARRANTY; without even the implied warranty of
52 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
53 | GNU General Public License for more details.
54 |
55 | You should have received a copy of the GNU General Public License
56 | along with hKtweaks. If not, see .
57 |
--------------------------------------------------------------------------------
/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | /src/main/gen
3 | /debug
4 |
--------------------------------------------------------------------------------
/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id 'com.android.application'
3 | id 'com.google.gms.google-services'
4 | }
5 |
6 | android {
7 | compileSdkVersion 30
8 | buildToolsVersion '30.0.3'
9 | defaultConfig {
10 | applicationId 'com.hades.hKtweaks'
11 | minSdkVersion 26
12 | targetSdkVersion 30
13 | versionCode 222
14 | versionName "2.2.2 - OneUI"
15 | vectorDrawables.useSupportLibrary = true
16 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
17 | }
18 | buildTypes {
19 | release {
20 | minifyEnabled false
21 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
22 | }
23 | }
24 | lintOptions {
25 | abortOnError false
26 | }
27 | compileOptions {
28 | sourceCompatibility JavaVersion.VERSION_1_8
29 | targetCompatibility JavaVersion.VERSION_1_8
30 | }
31 | }
32 |
33 | repositories {
34 | maven { url "https://jitpack.io" }
35 | }
36 |
37 | dependencies {
38 | implementation 'io.github.yanndroid:oneui:2.2.1'
39 | implementation 'org.cyanogenmod:platform.sdk:6.0'
40 | implementation 'com.github.bumptech.glide:glide:4.12.0'
41 | annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
42 |
43 | implementation 'androidx.constraintlayout:constraintlayout:2.1.2'
44 | implementation 'androidx.appcompat:appcompat:1.3.1'
45 | implementation 'com.google.code.gson:gson:2.8.6'
46 | implementation 'com.google.firebase:firebase-database:20.0.3'
47 | implementation 'com.google.android.material:material:1.4.0'
48 | implementation 'com.google.android.apps.dashclock:dashclock-api:2.0.0'
49 |
50 | testImplementation 'junit:junit:4.+'
51 | androidTestImplementation 'androidx.test.ext:junit:1.1.3'
52 | androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
53 | }
54 |
55 | configurations.all {
56 | resolutionStrategy.eachDependency { DependencyResolveDetails details ->
57 | def requested = details.requested
58 | if (requested.group == "androidx") {
59 | if (!requested.name.startsWith("multidex")) {
60 | details.useVersion "${targetSdk}.+"
61 | }
62 | }
63 | }
64 | }
--------------------------------------------------------------------------------
/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # By default, the flags in this file are appended to flags specified
3 | # in /Users/willi/android/sdk/tools/proguard/proguard-android.txt
4 | # You can edit the include path and order by changing the proguardFiles
5 | # directive in build.gradle.
6 | #
7 | # For more details, see
8 | # http://developer.android.com/guide/developing/tools/proguard.html
9 |
10 | # Add any project specific keep options here:
11 |
12 | # If your project uses WebView with JS, uncomment the following
13 | # and specify the fully qualified class name to the JavaScript interface
14 | # class:
15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16 | # public *;
17 | #}
18 | -keepattributes Signature
19 | -keepattributes *Annotation*
20 | -keep class com.squareup.okhttp.** { *; }
21 | -keep interface com.squareup.okhttp.** { *; }
22 | -dontwarn com.squareup.okhttp.**
23 |
--------------------------------------------------------------------------------
/app/release/app-release.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Yanndroid/hKtweaks-OneUI/578d0d0b7c9e155fbe2e4c0d36a4c27470a600b5/app/release/app-release.apk
--------------------------------------------------------------------------------
/app/release/output-metadata.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 2,
3 | "artifactType": {
4 | "type": "APK",
5 | "kind": "Directory"
6 | },
7 | "applicationId": "com.hades.hKtweaks",
8 | "variantName": "release",
9 | "elements": [
10 | {
11 | "type": "SINGLE",
12 | "filters": [],
13 | "versionCode": 222,
14 | "versionName": "2.2.2 - OneUI",
15 | "outputFile": "app-release.apk"
16 | }
17 | ]
18 | }
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest3.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/app/src/main/AndroidManifest4.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
9 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/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/assets/update.json:
--------------------------------------------------------------------------------
1 | {
2 | "releaseNotes": [
3 | "Changelog - Yanndroid:",
4 | "- sound tab crash fix",
5 | "- single apk for oneui 3/4 themed",
6 | "- dependency update"
7 | ]
8 | }
9 |
--------------------------------------------------------------------------------
/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.hades.hKtweaks.utils.AppSettings;
15 | import com.hades.hKtweaks.utils.Utils;
16 |
17 | /**
18 | * main application class
19 | */
20 | public class CpuSpyApp {
21 |
22 | private final int mCore;
23 | private final Context mContext;
24 |
25 | /**
26 | * the long-living object used to monitor the system frequency states
27 | */
28 | private final CpuStateMonitor mMonitor;
29 |
30 | public CpuSpyApp(int core, Context context) {
31 | mCore = core;
32 | mContext = context;
33 | mMonitor = new CpuStateMonitor(core);
34 | loadOffsets();
35 | }
36 |
37 | /**
38 | * @return the internal CpuStateMonitor object
39 | */
40 | public CpuStateMonitor getCpuStateMonitor() {
41 | return mMonitor;
42 | }
43 |
44 | /**
45 | * Load the saved string of offsets from preferences and put it into the
46 | * state monitor
47 | */
48 | private void loadOffsets() {
49 | String prefs = AppSettings.getCpuSpyOffsets(mCore, mContext);
50 |
51 | if (prefs.isEmpty()) return;
52 | // split the string by peroids and then the info by commas and load
53 | SparseArray offsets = new SparseArray<>();
54 | String[] sOffsets = prefs.split(",");
55 | for (String offset : sOffsets) {
56 | String[] parts = offset.split(" ");
57 | offsets.put(Utils.strToInt(parts[0]), Utils.strToLong(parts[1]));
58 | }
59 |
60 | mMonitor.setOffsets(offsets);
61 | }
62 |
63 | /**
64 | * Save the state-time offsets as a string e.g. "100 24, 200 251, 500 124
65 | * etc
66 | */
67 | public void saveOffsets() {
68 | // build the string by iterating over the freq->duration map
69 | StringBuilder str = new StringBuilder();
70 | SparseArray offsets = mMonitor.getOffsets();
71 | for (int i = 0; i < offsets.size(); i++) {
72 | str.append(offsets.keyAt(i)).append(" ").append(offsets.valueAt(i)).append(",");
73 | }
74 |
75 | AppSettings.saveCpuSpyOffsets(str.toString(), mCore, mContext);
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/activities/AboutActivity.java:
--------------------------------------------------------------------------------
1 | package com.hades.hKtweaks.activities;
2 |
3 | import android.content.Intent;
4 | import android.net.Uri;
5 | import android.os.Bundle;
6 | import android.view.View;
7 |
8 | import com.google.android.material.button.MaterialButton;
9 | import com.hades.hKtweaks.R;
10 | import com.hades.hKtweaks.utils.Updater;
11 |
12 | import de.dlyt.yanndroid.oneui.layout.AboutPage;
13 |
14 | public class AboutActivity extends BaseActivity {
15 |
16 | private AboutPage about_page;
17 | private MaterialButton about_github;
18 |
19 | @Override
20 | protected void onCreate(Bundle savedInstanceState) {
21 | mUseAltTheme = true;
22 | super.onCreate(savedInstanceState);
23 | setContentView(R.layout.activity_about);
24 |
25 | about_page = findViewById(R.id.about_page);
26 | about_github = findViewById(R.id.about_github);
27 |
28 | checkForUpdate();
29 | }
30 |
31 | private void checkForUpdate() {
32 | Updater.checkForUpdate(this, new Updater.UpdateChecker() {
33 | @Override
34 | public void updateAvailable(boolean available, String url, String versionName) {
35 | if (available) {
36 | about_page.setUpdateState(AboutPage.UPDATE_AVAILABLE);
37 | about_page.setUpdateButtonOnClickListener(v -> {
38 | about_page.findViewById(R.id.update_button).setEnabled(false);
39 | Updater.downloadAndInstall(getBaseContext(), url, versionName);
40 | });
41 | } else {
42 | about_page.setUpdateState(AboutPage.NO_UPDATE);
43 | }
44 | }
45 |
46 | @Override
47 | public void githubAvailable(String url) {
48 | about_github.setVisibility(View.VISIBLE);
49 | about_github.setOnClickListener(v -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))));
50 | }
51 |
52 | @Override
53 | public void noConnection() {
54 | about_page.setUpdateState(AboutPage.NO_CONNECTION);
55 | about_page.setRetryButtonOnClickListener(v -> {
56 | about_page.setUpdateState(AboutPage.LOADING);
57 | checkForUpdate();
58 | });
59 | }
60 | });
61 | }
62 |
63 | public void openDevs(View view) {
64 | Intent intent = new Intent().setClass(this, AboutInfoActivity.class);
65 | intent.putExtra("category", "devs");
66 | startActivity(intent);
67 | }
68 |
69 | public void openLibs(View view) {
70 | Intent intent = new Intent().setClass(this, AboutInfoActivity.class);
71 | intent.putExtra("category", "libs");
72 | startActivity(intent);
73 | }
74 | }
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/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.hades.hKtweaks.database.tools.customcontrols;
21 |
22 | import com.hades.hKtweaks.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/hades/hKtweaks/database/tools/profiles/ExportProfile.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.hades.hKtweaks.database.tools.profiles;
21 |
22 | import com.hades.hKtweaks.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 12.07.16.
31 | */
32 | public class ExportProfile {
33 |
34 | private JSONObject mMain;
35 |
36 | public ExportProfile(Profiles.ProfileItem item, int version) {
37 | mMain = new JSONObject();
38 | try {
39 | mMain.put("version", version);
40 | item.getItem().remove("name");
41 | mMain.put("profile", item.getItem());
42 | } catch (JSONException ignored) {
43 | }
44 | }
45 |
46 | public boolean export(String name) {
47 | if (!name.endsWith(".json")) name += ".json";
48 | File exportFiles = new File(Utils.getInternalDataStorage() + "/profiles");
49 | File file = new File(exportFiles.toString() + "/" + name);
50 | if (file.exists()) return false;
51 | exportFiles.mkdirs();
52 | Utils.writeFile(file.toString(), mMain.toString(), false, false);
53 | return true;
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/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.hades.hKtweaks.database.tools.profiles;
21 |
22 | import com.hades.hKtweaks.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/hades/hKtweaks/fragments/LoadingFragment.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 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.hades.hKtweaks.fragments;
21 |
22 | import android.os.Bundle;
23 | import android.view.LayoutInflater;
24 | import android.view.View;
25 | import android.view.ViewGroup;
26 | import android.widget.TextView;
27 |
28 | import androidx.annotation.NonNull;
29 | import androidx.annotation.Nullable;
30 |
31 | import com.hades.hKtweaks.R;
32 |
33 | /**
34 | * Created by willi on 08.03.18.
35 | */
36 |
37 | public class LoadingFragment extends BaseFragment {
38 |
39 | private String mTitle;
40 | private String mSummary;
41 |
42 | private TextView mTitleView;
43 | private TextView mSummaryView;
44 |
45 | @Nullable
46 | @Override
47 | public View onCreateView(@NonNull LayoutInflater inflater,
48 | @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
49 | View rootView = inflater.inflate(R.layout.fragment_loading, container, false);
50 |
51 | mTitleView = rootView.findViewById(R.id.title);
52 | mSummaryView = rootView.findViewById(R.id.summary);
53 |
54 | setup();
55 | return rootView;
56 | }
57 |
58 | public void setTitle(String title) {
59 | mTitle = title;
60 | setup();
61 | }
62 |
63 | public void setSummary(String summary) {
64 | mSummary = summary;
65 | setup();
66 | }
67 |
68 | private void setup() {
69 | if (mTitleView != null) {
70 | if (mTitle == null) {
71 | mTitleView.setVisibility(View.GONE);
72 | } else {
73 | mTitleView.setVisibility(View.VISIBLE);
74 | mTitleView.setText(mTitle);
75 | }
76 |
77 | mSummaryView.setText(mSummary);
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/fragments/recyclerview/LoadAsyncTask.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 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.hades.hKtweaks.fragments.recyclerview;
21 |
22 | import android.os.AsyncTask;
23 |
24 | import androidx.annotation.NonNull;
25 |
26 | import java.lang.ref.WeakReference;
27 |
28 | /**
29 | * Created by willi on 08.03.18.
30 | */
31 |
32 | class LoadAsyncTask extends AsyncTask {
33 |
34 | private WeakReference mRefFragment;
35 | private LoadHandler mListener;
36 |
37 | LoadAsyncTask(T fragment, @NonNull LoadHandler listener) {
38 | mRefFragment = new WeakReference<>(fragment);
39 | mListener = listener;
40 | }
41 |
42 | @Override
43 | protected void onPreExecute() {
44 | super.onPreExecute();
45 | T fragment = mRefFragment.get();
46 | if (fragment != null) {
47 | mListener.onPreExecute(fragment);
48 | }
49 | }
50 |
51 | @Override
52 | protected RESULT doInBackground(Void... voids) {
53 | T fragment = mRefFragment.get();
54 | if (fragment != null) {
55 | return mListener.doInBackground(fragment);
56 | }
57 | return null;
58 | }
59 |
60 | @Override
61 | protected void onPostExecute(RESULT result) {
62 | super.onPostExecute(result);
63 |
64 | T fragment = mRefFragment.get();
65 | if (fragment != null) {
66 | mListener.onPostExecute(fragment, result);
67 | }
68 | }
69 |
70 | public abstract static class LoadHandler {
71 | public void onPreExecute(T fragment) {
72 | }
73 |
74 | public abstract RESULT doInBackground(T fragment);
75 |
76 | public void onPostExecute(T fragment, RESULT result) {
77 | }
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/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.hades.hKtweaks.fragments.statistics;
21 |
22 | import android.content.res.Configuration;
23 |
24 | import com.hades.hKtweaks.R;
25 | import com.hades.hKtweaks.fragments.recyclerview.RecyclerViewFragment;
26 | import com.hades.hKtweaks.utils.Device;
27 | import com.hades.hKtweaks.utils.Utils;
28 | import com.hades.hKtweaks.views.recyclerview.RecyclerViewItem;
29 | import com.hades.hKtweaks.views.recyclerview.StatsView;
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 | private Device.MemInfo mMemInfo;
39 |
40 | @Override
41 | protected void init() {
42 | super.init();
43 | getRecyclerView().setBackgroundResource(R.color.item_background_color);
44 | mMemInfo = Device.MemInfo.getInstance();
45 | }
46 |
47 | @Override
48 | public int getSpanCount() {
49 | int span = Utils.isTablet(getActivity()) ? Utils.getOrientation(getActivity()) ==
50 | Configuration.ORIENTATION_LANDSCAPE ? 6 : 5 : Utils.getOrientation(getActivity()) ==
51 | Configuration.ORIENTATION_LANDSCAPE ? 4 : 3;
52 | if (itemsSize() != 0 && span > itemsSize()) {
53 | span = itemsSize();
54 | }
55 | return span;
56 | }
57 |
58 | @Override
59 | protected void addItems(List items) {
60 | List mems = mMemInfo.getItems();
61 | for (String mem : mems) {
62 | StatsView memView = new StatsView();
63 | memView.setTitle(mem);
64 | memView.setStat(mMemInfo.getItem(mem).replace(" ", "").replace("kB", getString(R.string.kb)));
65 |
66 | items.add(memView);
67 | }
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/fragments/tools/downloads/AboutFragment.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.hades.hKtweaks.fragments.tools.downloads;
21 |
22 | import com.hades.hKtweaks.fragments.recyclerview.RecyclerViewFragment;
23 | import com.hades.hKtweaks.utils.tools.SupportedDownloads;
24 | import com.hades.hKtweaks.views.recyclerview.RecyclerViewItem;
25 | import com.hades.hKtweaks.views.recyclerview.downloads.DownloadAboutView;
26 |
27 | import java.util.List;
28 |
29 | /**
30 | * Created by willi on 07.07.16.
31 | */
32 | public class AboutFragment extends RecyclerViewFragment {
33 |
34 | private SupportedDownloads.KernelContent mKernelContent;
35 |
36 | public static AboutFragment newInstance(SupportedDownloads.KernelContent kernelContent) {
37 | AboutFragment fragment = new AboutFragment();
38 | fragment.mKernelContent = kernelContent;
39 | return fragment;
40 | }
41 |
42 | @Override
43 | protected boolean isForeground() {
44 | return true;
45 | }
46 |
47 | @Override
48 | protected void addItems(List items) {
49 | items.add(new DownloadAboutView(mKernelContent));
50 | }
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/services/boot/OnBootReceiver.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-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.hades.hKtweaks.services.boot;
21 |
22 | import android.content.BroadcastReceiver;
23 | import android.content.Context;
24 | import android.content.Intent;
25 |
26 | import com.hades.hKtweaks.utils.AppSettings;
27 | import com.hades.hKtweaks.utils.Utils;
28 | import com.hades.hKtweaks.utils.root.RootUtils;
29 |
30 | /**
31 | * Created by willi on 03.05.16.
32 | */
33 | public class OnBootReceiver extends BroadcastReceiver {
34 |
35 | @Override
36 | public void onReceive(Context context, Intent intent) {
37 | if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {
38 | RootUtils.SU su = new RootUtils.SU();
39 | su.runCommand("echo /testRoot/");
40 | if (!su.mDenied) {
41 | Utils.startService(context, new Intent(context, ApplyOnBootService.class));
42 | /*if (AppSettings.isDataSharing(context)) {
43 | Utils.startService(context, new Intent(context, Monitor.class));
44 | }*/
45 | }
46 | su.close();
47 | AppSettings.saveBoolean("is_booted", true, context);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/utils/Log.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2018 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.hades.hKtweaks.utils;
21 |
22 | /**
23 | * Created by willi on 22.03.18.
24 | */
25 |
26 | public class Log {
27 |
28 | private static final String TAG = "hKtweaks";
29 |
30 | public static void i(String message) {
31 | android.util.Log.i(TAG, getMessage(message));
32 | }
33 |
34 | public static void e(String message) {
35 | android.util.Log.e(TAG, getMessage(message));
36 | }
37 |
38 | private static String getMessage(String message) {
39 | StackTraceElement element = Thread.currentThread().getStackTrace()[4];
40 | String className = element.getClassName();
41 |
42 | return Utils.strFormat("[%s][%s] %s",
43 | className.substring(className.lastIndexOf(".") + 1),
44 | element.getMethodName(),
45 | message);
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/utils/NotificationId.java:
--------------------------------------------------------------------------------
1 | package com.hades.hKtweaks.utils;
2 |
3 | /**
4 | * Created by willi on 27.11.17.
5 | */
6 |
7 | public class NotificationId {
8 |
9 | public static final int APPLY_ON_BOOT = 1;
10 | public static final int APPLY_ON_BOOT_CONFIRMATION = 2;
11 | public static final int MONITOR = 3;
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/utils/Prefs.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2015-2018 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.hades.hKtweaks.utils;
21 |
22 | import android.content.Context;
23 | import android.preference.PreferenceManager;
24 |
25 | /**
26 | * Created by willi on 01.01.16.
27 | */
28 | class Prefs {
29 |
30 | static void remove(String name, Context context) {
31 | PreferenceManager.getDefaultSharedPreferences(context).edit().remove(name).apply();
32 | }
33 |
34 | static int getInt(String name, int defaults, Context context) {
35 | return PreferenceManager.getDefaultSharedPreferences(context).getInt(name, defaults);
36 | }
37 |
38 | static void saveInt(String name, int value, Context context) {
39 | PreferenceManager.getDefaultSharedPreferences(context).edit().putInt(name, value).apply();
40 | }
41 |
42 | static boolean getBoolean(String name, boolean defaults, Context context) {
43 | return PreferenceManager.getDefaultSharedPreferences(context).getBoolean(name, defaults);
44 | }
45 |
46 | static void saveBoolean(String name, boolean value, Context context) {
47 | PreferenceManager.getDefaultSharedPreferences(context).edit().putBoolean(name, value).apply();
48 | }
49 |
50 | static String getString(String name, String defaults, Context context) {
51 | return PreferenceManager.getDefaultSharedPreferences(context).getString(name, defaults);
52 | }
53 |
54 | static void saveString(String name, String value, Context context) {
55 | PreferenceManager.getDefaultSharedPreferences(context).edit().putString(name, value).apply();
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/utils/kernel/Switch.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.hades.hKtweaks.utils.kernel;
21 |
22 | /**
23 | * Created by willi on 21.08.17.
24 | */
25 |
26 | public class Switch {
27 |
28 | private String mEnable;
29 | private String mDisable;
30 |
31 | public Switch(String enable, String disable) {
32 | mEnable = enable;
33 | mDisable = disable;
34 | }
35 |
36 | public String getEnable() {
37 | return mEnable;
38 | }
39 |
40 | public String getDisable() {
41 | return mDisable;
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/utils/kernel/boefflawakelock/WakeLockInfo.java:
--------------------------------------------------------------------------------
1 | package com.hades.hKtweaks.utils.kernel.boefflawakelock;
2 |
3 | public class WakeLockInfo {
4 |
5 | public String wName = "";
6 | public int wTime = 0;
7 | public int wWakeups = 0;
8 | public boolean wState = true;
9 |
10 | WakeLockInfo(String name, int time, int wakeups) {
11 | wName = name;
12 | wTime = time;
13 | wWakeups = wakeups;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/utils/kernel/cpuhotplug/AiOHotplug.java:
--------------------------------------------------------------------------------
1 | package com.hades.hKtweaks.utils.kernel.cpuhotplug;
2 |
3 | import android.content.Context;
4 |
5 | import com.hades.hKtweaks.fragments.ApplyOnBootFragment;
6 | import com.hades.hKtweaks.utils.Utils;
7 | import com.hades.hKtweaks.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/java/com/hades/hKtweaks/utils/kernel/cpuhotplug/Hotplug.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.hades.hKtweaks.utils.kernel.cpuhotplug;
21 |
22 | import android.content.Context;
23 |
24 | /**
25 | * Created by willi on 07.05.16.
26 | */
27 | public class Hotplug {
28 |
29 | public static void disableAllHotplugs(Context context) {
30 | AlucardHotplug.enableAlucardHotplug(false, context);
31 | AutoSmp.enableAutoSmp(false, context);
32 | BluPlug.enableBluPlug(false, context);
33 | ClusterHotplug.enableClusterHotplug(false, context);
34 | CoreCtl.getInstance().enable(false, context);
35 | IntelliPlug.getInstance().enableIntelliPlug(false, context);
36 | LazyPlug.enable(false, context);
37 | MakoHotplug.enableMakoHotplug(false, context);
38 | MBHotplug.getInstance().enableMBHotplug(false, context);
39 | MPDecision.enableMpdecision(false, context);
40 | MSMHotplug.getInstance().enableMsmHotplug(false, context);
41 | SamsungPlug.enableSamsungPlug(false, context);
42 | ThunderPlug.enableThunderPlug(false, context);
43 | ZenDecision.enableZenDecision(false, context);
44 | }
45 |
46 | public static boolean supported() {
47 | return MPDecision.supported() || IntelliPlug.getInstance().supported() || LazyPlug.supported()
48 | || BluPlug.supported() || MSMHotplug.getInstance().supported() || MakoHotplug.supported()
49 | || MBHotplug.getInstance().supported() || AlucardHotplug.supported() || ThunderPlug.supported()
50 | || ZenDecision.supported() || AutoSmp.supported() || CoreCtl.getInstance().supported()
51 | || AiOHotplug.supported() || SamsungPlug.supported() || ClusterHotplug.supported();
52 | }
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/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.hades.hKtweaks.utils.kernel.cpuhotplug;
21 |
22 | import android.content.Context;
23 |
24 | import com.hades.hKtweaks.fragments.ApplyOnBootFragment;
25 | import com.hades.hKtweaks.utils.Utils;
26 | import com.hades.hKtweaks.utils.kernel.cpu.CPUFreq;
27 | import com.hades.hKtweaks.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 | CPUFreq cpuFreq = CPUFreq.getInstance(context);
41 | run(Control.stopService(HOTPLUG_MPDEC), HOTPLUG_MPDEC, context);
42 | for (int i = 0; i < cpuFreq.getCpuCount(); i++) {
43 | cpuFreq.onlineCpu(i, true, ApplyOnBootFragment.CPU_HOTPLUG, false, context);
44 | }
45 | }
46 | }
47 |
48 | public static boolean isMpdecisionEnabled() {
49 | return Utils.isPropRunning(HOTPLUG_MPDEC);
50 | }
51 |
52 | public static boolean supported() {
53 | return Utils.hasProp(HOTPLUG_MPDEC);
54 | }
55 |
56 | private static void run(String command, String id, Context context) {
57 | Control.runSetting(command, ApplyOnBootFragment.CPU_HOTPLUG, id, context);
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/utils/kernel/cpuhotplug/SamsungPlug.java:
--------------------------------------------------------------------------------
1 | package com.hades.hKtweaks.utils.kernel.cpuhotplug;
2 |
3 | import android.content.Context;
4 |
5 | import com.hades.hKtweaks.fragments.ApplyOnBootFragment;
6 | import com.hades.hKtweaks.utils.Utils;
7 | import com.hades.hKtweaks.utils.root.Control;
8 |
9 | /**
10 | * Created by Morogoku on 25/04/2017.
11 | */
12 |
13 | public class SamsungPlug {
14 |
15 | private static final String HOTPLUG_SAMSUNG = "/sys/power/cpuhotplug";
16 | private static final String HOTPLUG_SAMSUNG_ENABLE = HOTPLUG_SAMSUNG + "/enabled";
17 | private static final String HOTPLUG_SAMSUNG_MAX_ONLINE_CPU = HOTPLUG_SAMSUNG + "/max_online_cpu";
18 | private static final String HOTPLUG_SAMSUNG_MIN_ONLINE_CPU = HOTPLUG_SAMSUNG + "/min_online_cpu";
19 |
20 | public static void enableSamsungPlug(boolean enable, Context context) {
21 | run(Control.write(enable ? "1" : "0", HOTPLUG_SAMSUNG_ENABLE), HOTPLUG_SAMSUNG_ENABLE, context);
22 | }
23 |
24 | public static boolean isSamsungPlugEnabled() {
25 | return Utils.readFile(HOTPLUG_SAMSUNG_ENABLE).equals("1");
26 | }
27 |
28 | public static String getMaxOnlineCpu() {
29 | String value = Utils.readFile(HOTPLUG_SAMSUNG_MAX_ONLINE_CPU);
30 | if (!value.isEmpty()) {
31 | return value.replace("max online cpu : ", "");
32 | }
33 | return null;
34 | }
35 |
36 | public static void setMaxOnlineCpu(int value, Context context) {
37 | run(Control.write(String.valueOf(value), HOTPLUG_SAMSUNG_MAX_ONLINE_CPU), HOTPLUG_SAMSUNG_MAX_ONLINE_CPU, context);
38 | }
39 |
40 | public static String getMinOnlineCpu() {
41 | String value = Utils.readFile(HOTPLUG_SAMSUNG_MIN_ONLINE_CPU);
42 | if (!value.isEmpty()) {
43 | return value.replace("min online cpu : ", "");
44 | }
45 | return null;
46 | }
47 |
48 | public static void setMinOnlineCpu(int value, Context context) {
49 | run(Control.write(String.valueOf(value), HOTPLUG_SAMSUNG_MIN_ONLINE_CPU), HOTPLUG_SAMSUNG_MIN_ONLINE_CPU, context);
50 | }
51 |
52 | public static boolean supported() {
53 | return Utils.existFile(HOTPLUG_SAMSUNG);
54 | }
55 |
56 | private static void run(String command, String id, Context context) {
57 | Control.runSetting(command, ApplyOnBootFragment.CPU_HOTPLUG, id, context);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/utils/kernel/dvfs/Dvfs.java:
--------------------------------------------------------------------------------
1 | package com.hades.hKtweaks.utils.kernel.dvfs;
2 |
3 | import android.content.Context;
4 |
5 | import com.hades.hKtweaks.fragments.ApplyOnBootFragment;
6 | import com.hades.hKtweaks.utils.Utils;
7 | import com.hades.hKtweaks.utils.root.Control;
8 |
9 | /**
10 | * Created by Morogoku on 11/04/2017.
11 | */
12 |
13 | public class Dvfs {
14 |
15 | private static final String DECISION_MODE = "/sys/devices/system/cpu/cpufreq/mp-cpufreq/cpu_dvfs_mode_control";
16 | private static final String THERMAL_CONTROL = "/sys/power/little_thermal_temp";
17 |
18 | public static void setDecisionMode(String value, Context context) {
19 | switch (value) {
20 | case "Battery":
21 | run(Control.write("0", DECISION_MODE), DECISION_MODE, context);
22 | break;
23 | case "Balance":
24 | run(Control.write("1", DECISION_MODE), DECISION_MODE, context);
25 | break;
26 | case "Performance":
27 | run(Control.write("2", DECISION_MODE), DECISION_MODE, context);
28 | break;
29 | }
30 | }
31 |
32 | public static String getDecisionMode() {
33 | if (Utils.readFile(DECISION_MODE) != null) {
34 | String value = Utils.readFile(DECISION_MODE);
35 | switch (value) {
36 | case "0":
37 | return "Battery";
38 | case "1":
39 | return "Balance";
40 | case "2":
41 | return "Performance";
42 | }
43 | }
44 | return null;
45 | }
46 |
47 | public static void setThermalControl(String value, Context context) {
48 | run(Control.write(String.valueOf(value), THERMAL_CONTROL), THERMAL_CONTROL, context);
49 | }
50 |
51 | public static String getThermalControl() {
52 | return Utils.readFile(THERMAL_CONTROL);
53 | }
54 |
55 | private static void run(String command, String id, Context context) {
56 | Control.runSetting(command, ApplyOnBootFragment.DVFS, id, context);
57 | }
58 |
59 |
60 | public static boolean supported() {
61 | return Utils.existFile(DECISION_MODE) && Utils.existFile(THERMAL_CONTROL);
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/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.hades.hKtweaks.utils.kernel.entropy;
21 |
22 | import android.content.Context;
23 |
24 | import com.hades.hKtweaks.fragments.ApplyOnBootFragment;
25 | import com.hades.hKtweaks.utils.Utils;
26 | import com.hades.hKtweaks.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/java/com/hades/hKtweaks/utils/kernel/gpu/AdrenoBoost.java:
--------------------------------------------------------------------------------
1 | package com.hades.hKtweaks.utils.kernel.gpu;
2 |
3 | import android.content.Context;
4 |
5 | import com.hades.hKtweaks.R;
6 | import com.hades.hKtweaks.fragments.ApplyOnBootFragment;
7 | import com.hades.hKtweaks.utils.Utils;
8 | import com.hades.hKtweaks.utils.root.Control;
9 |
10 | public class AdrenoBoost {
11 |
12 | private static final String ADRENOBOOST = "/sys/class/kgsl/kgsl-3d0/devfreq/adrenoboost";
13 |
14 | public static String getAdrenoBoost(Context context) {
15 | int mode = Utils.strToInt(Utils.readFile(ADRENOBOOST));
16 | switch (mode) {
17 | case 0:
18 | return context.getString(R.string.gpu_adreno_boost_off);
19 | case 1:
20 | return context.getString(R.string.gpu_adreno_boost_low);
21 | case 2:
22 | return context.getString(R.string.gpu_adreno_boost_medium);
23 | case 3:
24 | return context.getString(R.string.gpu_adreno_boost_high);
25 | }
26 | return null;
27 | }
28 |
29 | public static void setAdrenoBoost(int value, Context context) {
30 | run(Control.write(String.valueOf(value), ADRENOBOOST), ADRENOBOOST, context);
31 | }
32 |
33 | public static boolean hasAdrenoBoost() {
34 | return Utils.existFile(ADRENOBOOST);
35 | }
36 |
37 | private static void run(String command, String id, Context context) {
38 | Control.runSetting(command, ApplyOnBootFragment.GPU, id, context);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/utils/kernel/gpu/GPU.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.hades.hKtweaks.utils.kernel.gpu;
21 |
22 | /**
23 | * Created by willi on 12.05.16.
24 | */
25 | public class GPU {
26 |
27 | public static boolean supported() {
28 | return GPUFreq.getInstance().supported() || SimpleGPU.supported() || AdrenoIdler.supported()
29 | || GPUFreqExynos.getInstance().supported() || GPUFreqTmu.getInstance().supported();
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/utils/kernel/hmp/Hmp.java:
--------------------------------------------------------------------------------
1 | package com.hades.hKtweaks.utils.kernel.hmp;
2 |
3 | import android.content.Context;
4 |
5 | import com.hades.hKtweaks.fragments.ApplyOnBootFragment;
6 | import com.hades.hKtweaks.utils.Utils;
7 | import com.hades.hKtweaks.utils.root.Control;
8 |
9 | /**
10 | * Created by MoroGoku on 10/10/2017.
11 | */
12 |
13 | public class Hmp {
14 |
15 | private static final String UP_THRESHOLD = "/sys/kernel/hmp/up_threshold";
16 | private static final String DOWN_THRESHOLD = "/sys/kernel/hmp/down_threshold";
17 | private static Hmp sInstance;
18 |
19 | public static Hmp getInstance() {
20 | if (sInstance == null) {
21 | sInstance = new Hmp();
22 | }
23 | return sInstance;
24 | }
25 |
26 | public void setHmpProfile(String value, Context context) {
27 | String hmp[] = value.split(" ");
28 | int up = Utils.strToInt(hmp[0]);
29 | int down = Utils.strToInt(hmp[1]);
30 | setUpThreshold(up, context);
31 | setDownThreshold(down, context);
32 | }
33 |
34 | public String getUpThreshold() {
35 | return Utils.readFile(UP_THRESHOLD);
36 | }
37 |
38 | public void setUpThreshold(int value, Context context) {
39 | run(Control.write(String.valueOf(value), UP_THRESHOLD), UP_THRESHOLD, context);
40 | }
41 |
42 | public boolean hasUpThreshold() {
43 | return Utils.existFile(UP_THRESHOLD);
44 | }
45 |
46 | public String getDownThreshold() {
47 | return Utils.readFile(DOWN_THRESHOLD);
48 | }
49 |
50 | public void setDownThreshold(int value, Context context) {
51 | run(Control.write(String.valueOf(value), DOWN_THRESHOLD), DOWN_THRESHOLD, context);
52 | }
53 |
54 | public boolean hasDownThreshold() {
55 | return Utils.existFile(DOWN_THRESHOLD);
56 | }
57 |
58 | public boolean supported() {
59 | return hasUpThreshold() || hasDownThreshold();
60 | }
61 |
62 | private void run(String command, String id, Context context) {
63 | Control.runSetting(command, ApplyOnBootFragment.HMP, id, context);
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/utils/kernel/misc/PowerSuspend.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.hades.hKtweaks.utils.kernel.misc;
21 |
22 | import android.content.Context;
23 |
24 | import com.hades.hKtweaks.fragments.ApplyOnBootFragment;
25 | import com.hades.hKtweaks.utils.Utils;
26 | import com.hades.hKtweaks.utils.root.Control;
27 |
28 | /**
29 | * Created by willi on 30.06.16.
30 | */
31 | public class PowerSuspend {
32 |
33 | private static final String PARENT = "/sys/kernel/power_suspend";
34 | private static final String MODE = PARENT + "/power_suspend_mode";
35 | private static final String STATE = PARENT + "/power_suspend_state";
36 | private static final String VERSION = PARENT + "/power_suspend_version";
37 |
38 | public static void enableState(boolean enable, Context context) {
39 | run(Control.write(enable ? "1" : "0", STATE), STATE, context);
40 | }
41 |
42 | public static boolean isStateEnabled() {
43 | return Utils.readFile(STATE).equals("1");
44 | }
45 |
46 | public static boolean hasState() {
47 | return Utils.existFile(STATE);
48 | }
49 |
50 | public static void setMode(int value, Context context) {
51 | run(Control.write(String.valueOf(value), MODE), MODE, context);
52 | }
53 |
54 | public static String getVersion() {
55 | return Utils.readFile(VERSION);
56 | }
57 |
58 | public static int getMode() {
59 | return Utils.strToInt(Utils.readFile(MODE));
60 | }
61 |
62 | public static boolean hasMode() {
63 | return Utils.existFile(MODE);
64 | }
65 |
66 | public static boolean supported() {
67 | return hasMode() || hasState();
68 | }
69 |
70 | private static void run(String command, String id, Context context) {
71 | Control.runSetting(command, ApplyOnBootFragment.MISC, id, context);
72 | }
73 |
74 | }
75 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/utils/kernel/misc/Pwm.java:
--------------------------------------------------------------------------------
1 | package com.hades.hKtweaks.utils.kernel.misc;
2 |
3 | import android.content.Context;
4 |
5 | import com.hades.hKtweaks.fragments.ApplyOnBootFragment;
6 | import com.hades.hKtweaks.utils.Utils;
7 | import com.hades.hKtweaks.utils.root.Control;
8 |
9 | /**
10 | * Created by Morogoku on 25/04/2017.
11 | */
12 |
13 | public class Pwm {
14 |
15 | private static final String PWM_ENABLE = "/sys/class/lcd/panel/smart_on";
16 |
17 | public static void enablePwm(boolean enable, Context context) {
18 | run(Control.write(enable ? "1" : "0", PWM_ENABLE), PWM_ENABLE, context);
19 | }
20 |
21 | public static boolean isPwmEnabled() {
22 | return Utils.readFile(PWM_ENABLE).equals("1");
23 | }
24 |
25 | public static boolean supported() {
26 | return Utils.existFile(PWM_ENABLE);
27 | }
28 |
29 | private static void run(String command, String id, Context context) {
30 | Control.runSetting(command, ApplyOnBootFragment.MISC, id, context);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/utils/kernel/misc/Selinux.java:
--------------------------------------------------------------------------------
1 | package com.hades.hKtweaks.utils.kernel.misc;
2 |
3 | import android.content.Context;
4 |
5 | import com.hades.hKtweaks.fragments.ApplyOnBootFragment;
6 | import com.hades.hKtweaks.utils.Utils;
7 | import com.hades.hKtweaks.utils.root.Control;
8 |
9 | /**
10 | * Created by Morogoku on 11/09/2017.
11 | */
12 |
13 | public class Selinux {
14 |
15 | private static final String SELINUX_ENFORCE = "/sys/fs/selinux/enforce";
16 |
17 | public static void setEnforceMode(int mode, Context context) {
18 | run(Control.chmod("644", SELINUX_ENFORCE), SELINUX_ENFORCE, context);
19 | run(Control.write(String.valueOf(mode), SELINUX_ENFORCE), SELINUX_ENFORCE, context);
20 | if (mode == 0) run(Control.chmod("640", SELINUX_ENFORCE), SELINUX_ENFORCE, context);
21 | }
22 |
23 | public static String getStringEnforceMode() {
24 | int mode = Utils.strToInt(Utils.readFile(SELINUX_ENFORCE));
25 | switch (mode) {
26 | case 0:
27 | return "Permissive";
28 | case 1:
29 | return "Enforcing";
30 | }
31 | return null;
32 | }
33 |
34 | public static int getEnforceMode() {
35 | return Utils.strToInt(Utils.readFile(SELINUX_ENFORCE));
36 | }
37 |
38 | public static boolean supported() {
39 | return Utils.existFile(SELINUX_ENFORCE);
40 | }
41 |
42 | private static void run(String command, String id, Context context) {
43 | Control.runSetting(command, ApplyOnBootFragment.MISC, id, context);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/utils/kernel/screen/Screen.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.hades.hKtweaks.utils.kernel.screen;
21 |
22 | /**
23 | * Created by willi on 01.06.16.
24 | */
25 | public class Screen {
26 |
27 | public static boolean supported() {
28 | return Calibration.getInstance().supported() || Gamma.supported()
29 | || Misc.getInstance().supported();
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/app/src/main/java/com/hades/hKtweaks/utils/kernel/spectrum/Spectrum.java:
--------------------------------------------------------------------------------
1 | package com.hades.hKtweaks.utils.kernel.spectrum;
2 |
3 | import android.content.Context;
4 | import android.os.AsyncTask;
5 |
6 | import com.hades.hKtweaks.utils.AppSettings;
7 | import com.hades.hKtweaks.utils.Utils;
8 | import com.hades.hKtweaks.utils.root.RootUtils;
9 |
10 | /**
11 | * Created by Morogoku on 28/07/2017.
12 | */
13 |
14 | public class Spectrum {
15 |
16 | public static int getSuProfile() {
17 | return Utils.strToInt(RootUtils.runCommand("getprop persist.spectrum.profile"));
18 | }
19 |
20 | static int getProfile(Context context) {
21 | return AppSettings.getInt("spectrum_profile", 0, context);
22 | }
23 |
24 | // Method that interprets a profile and sets it
25 | public static void setProfile(int profile, Context context) {
26 | int numProfiles = 3;
27 | if (profile > numProfiles || profile < 0) profile = 0;
28 |
29 | setProp(profile, context);
30 | }
31 |
32 | // Method that sets system property
33 | private static void setProp(final int profile, Context context) {
34 | new AsyncTask