sm6150-common: Update XiaomiParts from sm8450-common
History: commit ab1ba8cc8256c97c288d0aa31931643a8598b761 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sun Apr 14 19:57:23 2024 +0530 sm6150-common: parts: Move dolby to hw/xiaomi Change-Id: Ie7ac39dfc4e69982cd43da019d434ba01f65c787 commit 9bc63a79e1d90af61fb758781040cd08c0de1b8f Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sun Apr 14 18:17:54 2024 +0530 sm6150-common: parts: Get rid of proguard flags This is obsolete. Change-Id: I1b692d3e1a96c49ac6efd54907ea23c4b4494f7e commit 0c64092cb978babffb776c0775e8c5090b3f17d7 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sun Apr 14 18:06:04 2024 +0530 sm6150-common: parts: Move to device encrypted storage Kill unnecessary explicit app version while we're at it. Change-Id: I678e3598b28b57e1920da584102d8c526ab452ef commit 3bb69c1c22dee2d2d0f830c0da08d27b620030d2 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Thu Mar 21 21:35:36 2024 +0530 sm6150-common: parts: Restore dolby profile on audio changes Something keeps resetting back at random times, from what I observed, after resuming media or on a device change, lets workaround that. Change-Id: Id065f2482636194655c2399f0c35ad56b8e7a29d commit bf02a606ceff8b950fa3f9b28031b5078c098a6c Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sun Dec 31 20:36:52 2023 +0530 sm6150-common: parts: Re-enable speaker virtualization after bootup For whatever reason, speaker virtualization isn't automatically restored at bootup unlike the other parameters. It was reported to be fixed by connecting and disconnecting headphones or disabling and enabling the toggle, so let's just automate that at bootup. Change-Id: I091ef403ec6fcdcc382c824b7a2e71e28301d684 commit 9bacc59d19250e4407dbd0509f55f0e902b13ba2 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sun Dec 10 14:49:23 2023 +0530 sm6150-common: parts: Fix thermal profile screen state handling Change-Id: I7c85757e7ee5d1d44c86b5c32834281efa362f93 commit 1ef2c05cc91a6c5dcc8077b1021fe9d69d2c6028 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Tue Nov 7 08:12:46 2023 +0530 sm6150-common: parts: Start services as early as possible on bootup BOOT_COMPLETED intent is broadcast only after the device is unlocked and user data (encrypted storage) is available. Use LOCKED_BOOT_COMPLETED intent for services that don't require accessing data. While we're at it, target latest SDK and uprev the package. Change-Id: I460c1612fd060655fde1f984ed5b025c575acb0e commit f00f985207e60b911400bb4703d1b0f72d9f7a42 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Mon Nov 6 23:53:46 2023 +0530 sm6150-common: parts: Yeet misound and clear speaker Change-Id: Ief9cb1e31ace1cd9505cea1607c917336c5ddf80 commit c1bc213b222a6c785598ed578481dc3fd8fd95e7 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Mon Oct 16 06:44:06 2023 +0530 sm6150-common: parts: Add toggle for Dolby volume leveler Change-Id: I63804773535f290d09724cfc8b1ee58f32ca89ab Signed-off-by: basamaryan <basam.aryan@gmail.com> commit 75544a654056f8605c0777059dc921f463fd3195 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Thu Oct 12 19:30:05 2023 +0530 sm6150-common: parts: Implement Dolby profile-specific settings Change-Id: I779c49bbb1d625628d8af55733e1f8c614cacbfa Signed-off-by: basamaryan <basam.aryan@gmail.com> commit 1af07ceffa521bdc050599c66c4bf7eb3d7bd62e Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Mon Oct 9 21:58:58 2023 +0530 sm6150-common: parts: Remove play/pause hack while toggling Dolby Not required with/fixed by: 35217: audioflinger: Do not allow DAP effect to be suspended | https://gerrit.aospa.co/c/AOSPA/android_frameworks_av/+/35217 Change-Id: I6264cb773b2577c627cfe5a4f52cea5c437ee796 commit c755f396f0bbba06f912ce6cc84a5841b17af7f8 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Tue Oct 10 08:04:31 2023 +0530 sm6150-common: parts: Introduce more Dolby Atmos effects - Bass Enhancer - Dialogue Enhancer - Stereo Widening Change-Id: I9fccea5fd2c391a06af894ca0dad4e73d981bf6f Signed-off-by: basamaryan <basam.aryan@gmail.com> commit a1161a70237183a300aa5eac087177bd640ee6ba Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Wed Sep 13 21:44:46 2023 +0530 sm6150-common: parts: Rename app to Xiaomi Parts This sounds less confusing than "Advanced settings". Change-Id: Ibb34a5a18534ec27563715a00ae452fc50edbaec commit 041b170bf7f1e5baba717ebfe03c4bb05c087cb9 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Wed Sep 13 21:41:20 2023 +0530 sm6150-common: parts: Set proper summary for dolby settings Show the current status in Settings > Sound as well as the QS tile. Change-Id: I85226144494b82c2bf3359ca3831acfa6640a341 commit b41ebe250c7eb930bce616ef11205d3700c17449 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Wed Sep 13 20:22:03 2023 +0530 sm6150-common: parts: Override MusicFX and handle EQ intent Get rid of AOSP equalizer, no one uses it. Instead advertise our Dolby Atmos settings as the system-wide equalizer, allowing apps such as Spotify to open it directly. Change-Id: I4dc4a8d16b68181f5cd0e3d09430f3c4f7ce29e5 commit f027b9c6e09f82b47a5f65e23a138e03ff2bfe07 Author: Fabian Leutenegger <fabian.leutenegger@bluewin.ch> Date: Fri Aug 25 10:26:53 2023 +0200 sm6150-common: parts: Always refresh playback if status changed * otherwise dolby would stay active even if you disable its setting Change-Id: If59d8081fa12da2aa67e5149db97965c0805d76e commit 8a346a31ed0f39aa87beff9ba41bf1fd09c6e6f4 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Mon Aug 21 13:21:18 2023 +0530 sm6150-common: parts: Introduce Dolby Atmos Based on existing dirac implementation and observing stock sound effects app and daxservice. Thanks to jhenrique09 for the hack from old dirac parts "Pause/play music stream to get effects applied". TODO: bring back misound (same as stock) Co-authored-by: Henrique Silva <jhenrique09.mcz@hotmail.com> Change-Id: I528a8c90defe336dcb79fa1c31d3d52b9d39fe14 Signed-off-by: basamaryan <basam.aryan@gmail.com> commit 13e03eaa6a9de6b5b55eb6081e166db403a5b09a Author: Jyotiraditya Panda <jyotiraditya@aospa.co> Date: Sat Jun 3 23:38:59 2023 +0530 sm6150-common: parts: Refactor ClearSpeakerFragment code - Removed unused imports - Proper resource release by using try-finally block - Added null checks for MediaPlayer methods - Remove audio parameter as its unused Change-Id: I7dc2ba7baf6e0193e13583a7454da296254d7333 Signed-off-by: Jyotiraditya Panda <jyotiraditya@aospa.co> Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com> commit 7023c6cec6b5717c9449f09a8f2435eba1b42048 Author: someone5678 <nemui3353@gmail.com> Date: Tue Jan 11 03:23:15 2022 +0900 sm6150-common: parts: Add {navigation,video} thermal profiles * icon taken from https://fonts.google.com Change-Id: Ica3ced4d6fd79ff048f20469d4c4d2082e17ee7b Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com> commit 7c60b8549487bf12a04628e85213b96d0c705c40 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Fri, 31 Dec 2021 12:29:01 +0530 lisa: parts: Cleanup and adapt for lisa * move to system_ext * remove lcd features (we have amoled) * remove thermal profiles for now until we rework it to use touchfeature commit 7e2b229e82988faa9c703020dad6e78d5140860f Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sat, 14 May 2022 19:32:41 +0530 lisa: parts: Enable back thermal settings and service commit be0b6a7c6582de694b583eee4a52c8377af80c1a Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sun May 15 14:02:06 2022 +0530 sm6150-common: sepolicy: Allow system_app to write thermal sysfs * required for xiaomi parts thermal profiles Change-Id: I10c14088b591720801b51e412a8c666ebc53e31e commit 36f226ecc3497437e00c4edbd5679e9dc76bad25 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Thu Oct 13 23:25:05 2022 +0530 sm6150-common: parts: Use S theme in thermal settings The new spinner theme in T (v33) is too large. Ref:da5db6f9db
Change-Id: I6ae59548e1fb417ea681158df844bcd17ef8bf56 commit b717f60b9abf701b1e30c3541ee2a169431448be Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Thu Oct 13 12:06:35 2022 +0530 sm6150-common: parts: Restore MiSound scene on boot complete This seems to be necessary only for scene (and not other parameters). Change-Id: I8bc3f2bd280174a3628dc2458ff969d66c1e79b3 commit 2c378805e55571fa85742e9ba3ae8a06c23eef12 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sat Jul 23 01:29:10 2022 +0530 sm6150-common: parts: Open settings on QS tile long press Since we have only one QS tile, being MiSound, open its settings activity on long presing the tile, instead of the default behavior of opening app info. Change-Id: Ie3b3444a975a471c2d3ee83eac9347d028521c18 commit 98116844a386fa8828ea8d38eb587734c8b35eb1 Author: Lostark13 <tushar9915@gmail.com> Date: Sat Mar 19 21:00:00 2022 +0300 sm6150-common: parts: Update MiSound headset types From lisa V13.0.4.0.SKOMIXM Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com> Change-Id: I59e24d429b948dcf5a57449e4f58fc8db58d7627 commit 9899e5be5aaee7053d8aec545e4788e79711b2cd Author: Lostark13 <tushar9915@gmail.com> Date: Sat Mar 19 19:20:57 2022 +0300 sm6150-common: parts: Add support for MiSound scenes Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com> Change-Id: I7a21568dd7fa1bbfe0974e27bb75e570c80e5bd4 commit d34360fa915270019999c9c0942aefce631937d7 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Wed Jun 29 16:16:58 2022 +0530 sm6150-common: parts: Avoid unsafe boot completed receiver Ref: https://stackoverflow.com/questions/52628780/how-to-fix-unsafeprotectedbroadcastreceiver Reported-by: Jyotiraditya Panda <jyotiraditya@aospa.co> Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com> Change-Id: Ib3d72640eca4eda9277ad5fd1181881f2171bcfc commit 93e16fef831662e60eb020ed6852bd69c433baf5 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sun May 15 13:59:56 2022 +0530 sm6150-common: parts: Sync thermal states with sdm845-common https: //github.com/LineageOS/android_device_xiaomi_sdm845-common/blob/lineage-19.1/parts/src/org/lineageos/settings/thermal/ThermalUtils.java#L35 Change-Id: I21f861dd8d689ce36fcabc6af2cd425b381246a2 commit cbfd42c83606e96905d22ae7337225be9099dcc7 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sat May 14 19:58:54 2022 +0530 sm6150-common: parts: Remove per-app touchscreen settings Our touchscreen driver uses only xiaomi_touch ioctl for configuring touch (gaming) parameters. Until we add xiaomi touchfeature or convert it to sysfs, lets not use touch profiles for now. Change-Id: I6a71b14c95e555b43d71e58a8f6580288e3f2540 commit 4ef9c7bdd8340ad9058db549714351d1d5d2425c Author: Nauval Rizky <enuma.alrizky@gmail.com> Date: Thu Nov 18 00:39:28 2021 +0700 sm6150-common: parts: Improve thermal profiles and touch settings * Migrate from ListView to RecyclerView for better integration with the collapsing toolbar and smoother scrolling * Move touch settings to its own activity * Several UX improvement over the items layout Signed-off-by: Nauval Rizky <enuma.alrizky@gmail.com> Signed-off-by: chrisw444 <wandersonrodriguesf1@gmail.com> Change-Id: I7d843c917b49fe9159dfe89bb38f7bbfed9db48c Co-authored-by: Adithya R <gh0strider.2k18.reborn@gmail.com> Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com> commit 700e79ec79308c3f73283dc7497b271321dbcbb7 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sat Nov 6 19:46:04 2021 +0530 sm6150-common: parts: Update and polish vector drawables Thanks to WSTxda for these icons Co-authored-by: WSTxda <wstxda@gmail.com> Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com> Change-Id: I89b6935ee8e8afd3da0cbbd971b9941aebd935a5 commit 9a64cf52118a2a8bbb6270a8d175dc8640f02480 Author: Volodymyr Zhdanov <wight554@gmail.com> Date: Wed Oct 20 18:04:39 2021 +0300 surya: parts: Fix Clear Speaker IllegalStateException * trace: E AndroidRuntime: java.lang.IllegalStateException E AndroidRuntime: at android.media.MediaPlayer._stop(Native Method) E AndroidRuntime: at android.media.MediaPlayer.stop(MediaPlayer.java:1397) Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com> commit 76a573a110e4022b0f7a24b499ac782a9f160244 Author: TheScarastic <warabhishek@gmail.com> Date: Wed Oct 6 07:25:13 2021 +0000 surya: parts: Adapt UI to Android 12 style * Use Theme.SubSettingsBase for theme * Replace PreferenceActivity with CollapsingToolbarBaseActivity * Add Titles to prefernce screen * Remove onOptionsItemSelected and where neccessary move to activity [ghostrider-reborn] * Adapt to our XiaomiParts (surya) Co-authored-by: Adithya R <gh0strider.2k18.reborn@gmail.com> Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com> commit 9920fd5ff04c393d138b5a04c92d20153050e651 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sun Oct 31 14:43:19 2021 +0530 surya: Initial Android 12 bringup commit ee07247b649074048be64a69928c06c3a7cb0e0b Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sat Sep 4 00:34:25 2021 +0530 surya: parts: Update CABC icon from WSTxda Credits: https://t.me/WSTxda commit bcf02911748ca8ae09b1e0386b51fa74bce3cbac Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Wed Sep 1 00:28:46 2021 +0530 surya: parts: Improve thermal profiles strings commit cad45a279775d988fc3ac9aba6a95d932a52694c Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Wed Aug 18 15:02:38 2021 +0530 surya: parts: Improve game mode and ditch touchfeature * nvt driver exports procfs nodes for all these touch controls, so there's no need of xiaomi's touchfeature bs commit 18291cc124d449881b399f8ad1b506905682f3f8 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Wed Aug 18 12:43:50 2021 +0530 Revert "surya: parts: Remove touchscreen/gaming profiles" This reverts commit 6db0f6f6b7cb061a5888816865e3307251028d08. commit 8ea6cb25efad3c399dd81e5e1660cfe19a3e5996 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sun Aug 15 21:56:27 2021 +0530 surya: parts: Add support for LCD HBM and CABC * write preferences and qs tiles * kang icons from realmeparts * enable cabc by default * address sepolicy denials Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com> commit be56fe58fd2e70ec509adc71eac0514d5e0188c3 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sat Jun 12 15:03:03 2021 +0530 surya: parts: Add headphones warning for clear speaker commit b1fe10a4a155b8ac7d875ed50be8ded8da3cdec0 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sat Jun 12 15:02:54 2021 +0530 surya: parts: Update clear speaker audio from MIUI 12 commit 6db0f6f6b7cb061a5888816865e3307251028d08 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Tue Mar 9 18:43:07 2021 +0530 surya: parts: Remove touchscreen/gaming profiles * we don't use touchfeature hal atm commit 82f9fca1c04da1e90e374912bcb899ba7da4e6f1 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Tue Mar 9 18:39:39 2021 +0530 surya: parts: Remove refresh rate settings * we use dynamic refresh rate + aosp's way of setting min refresh rate commit 2aaeb47b454a7e8d783a919f3d564f92e3e2789c Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Tue Mar 9 18:33:34 2021 +0530 surya: parts: Remove ambient display settings * we use Paranoid Doze commit cfc4d0b82266381cc6c5e7441ff4330bac8061a7 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Tue Mar 9 18:31:36 2021 +0530 surya: Import XiaomiParts from previous device tree History: commit e869b7dd467f1f6c90dfda6b446c15fb8b78b29b Author: Akhil Narang <me@akhilnarang.dev> Date: Thu Apr 2 01:01:09 2020 +0530 devicesettings: refactor to XiaomiParts, update package name * org.lineageos.settings.device -> org.lineageos.settings Signed-off-by: Akhil Narang <me@akhilnarang.dev> commit be555a7d78a54ebae26fb245b3f4a3a6dec4831a Author: Joey <joey@lineageos.org> Date: Fri Dec 28 11:33:30 2018 +0100 phoenix: parts: Introduce Dirac preferences Add a frontend for Dirac sound optimization settings. Inject into sound preferences through settings IA. Change-Id: I37f6e64fa440c43dbe238cc65af5f9b0bbd60d83 Signed-off-by: Joey <joey@lineageos.org> Signed-off-by: Akhil Narang <me@akhilnarang.dev> commit 75e3df970f85ff64c70413e2c07f540cef6c2e2b Author: TheScarastic <warabhishek@gmail.com> Date: Fri Dec 28 15:13:24 2018 -0500 phoenix: parts: Add DiracSound backend Special thanks to vasishath for his base work on mi3 Change-Id: Id81e60a18dc34c991b82a5a2685c9041222a6ea7 Signed-off-by: Akhil Narang <me@akhilnarang.dev> commit 544422c55f632ed6c400f09a60cc0ba3dc83b9c9 Author: TheScarastic <warabhishek@gmail.com> Date: Fri Aug 30 19:00:39 2019 +0530 phoenix: Add support for hifi Signed-off-by: Akhil Narang <me@akhilnarang.dev> commit 39b99cf62950324666b3739ac3c77c78b95fad2d Author: Bruno Martins <bgcngm@gmail.com> Date: Tue Jul 9 22:31:00 2019 +0100 phoenix: parts: dirac: Migrate to androidx Change-Id: Ifaa67283a3437549a2304088a0ce377b399da19f Signed-off-by: Akhil Narang <me@akhilnarang.dev> commit 6c8964e163b32b8c2c4e42bbf95f6ee7cbd067bf Author: Bruno Martins <bgcngm@gmail.com> Date: Mon Sep 2 10:15:57 2019 +0100 phoenix: parts: Clean up proguard flags Change-Id: If0250fb629417d36c2af7286bc0620e682c4576e Signed-off-by: Akhil Narang <me@akhilnarang.dev> commit 7232a6a9d3fd9c1c248812e3f3a8409d7c82bcf7 Author: TheScarastic <warabhishek@gmail.com> Date: Fri Oct 4 12:20:49 2019 +0530 phoenix: Dont restore values on boot * Dirac libs are smart enough to store these values on power-off and restore them on boot. Signed-off-by: Akhil Narang <me@akhilnarang.dev> commit 081aee912efd5c6cde459cfdafbd625087948f34 Author: TheScarastic <warabhishek@gmail.com> Date: Sat Oct 12 17:52:34 2019 +0530 phoenix: Inject doze preference through ia Signed-off-by: Akhil Narang <me@akhilnarang.dev> commit 737c9f7e6543e1f8556f14643158995b100a9c7d Author: Akhil Narang <me@akhilnarang.dev> Date: Thu Apr 2 01:18:53 2020 +0530 phoenix: parts: move cutout and refresh rate settings to display settings Signed-off-by: Akhil Narang <me@akhilnarang.dev> commit 5e7b544adcafc470a18dd0666162ec0758ab2f54 Author: TheScarastic <warabhishek@gmail.com> Date: Sat May 9 08:23:43 2020 +0000 phoenix: Add dynamic thermal profile implementation Also add in FileUtils Change-Id: I4667b24a8a29a418796dc51b245ede0aca51eea6 Signed-off-by: Akhil Narang <me@akhilnarang.dev> commit 682065a64cee408252f42e3cda516e40adb40876 Author: Akhil Narang <me@akhilnarang.dev> Date: Wed May 13 13:04:59 2020 +0530 phoenix: parts: drop support for browser and youtube thermal modes * phoenix doesn't seem to support these Signed-off-by: Akhil Narang <me@akhilnarang.dev> commit 2ff56c485635a998de89bede3b1460be8ea8cf7a Author: Akhil Narang <me@akhilnarang.dev> Date: Fri Jul 31 11:53:31 2020 +0530 phoenix: parts: fix refresh rate switching * Added in a 90hz option - used SurfaceFlinger for this (All credits to DD3Boh for the `RefreshRateUtils.setFPS()` method) * Thanks to Abhishek for helping with fixing the BootCompletedReceiver * Also formatted code in android studio Signed-off-by: Akhil Narang <me@akhilnarang.dev> commit 3e798e7a83037f933dde98591e7a64aec7ee582e Author: Pranav Vashi <neobuddy89@gmail.com> Date: Thu May 21 21:57:18 2020 +0530 phoenix: Set dynamic thermal interval to 5 sec Change-Id: I96a67297645ad9074045e94fce84e664723aa64c Signed-off-by: Akhil Narang <me@akhilnarang.dev> commit 2f037d2bfeebde57f4edde70d84e8b41e944fc0e Author: xyyx <xyyx@mail.ru> Date: Fri Oct 9 09:43:53 2020 +0300 surya: parts: Fix refresh rate values Thanks to akhilnarang for testing commands Signed-off-by: Tushar Mahajan <mahajant99@gmail.com> commit 5487ea615ea362a81d228156ef947c38d9f12890 Author: Thomas Shum <jabashque@gmail.com> Date: Tue Feb 25 11:06:43 2020 +0000 surya: Set config_deviceLightCapabilities Signed-off-by: officialyash007 <officialyash007@gmail.com> commit 50a0b3a2ea4c54b65bbcc59d35c53548774688f8 Author: Pranav Vashi <neobuddy89@gmail.com> Date: Thu May 21 23:43:29 2020 +0530 surya: parts: Add switchbar to disable dynamic thermal * Disabled by default since all profile are set to 0 by default. included Switch back to default thermal profile when screen off Signed-off-by: Tushar Mahajan <mahajant99@gmail.com> commit ac6c96ab4b0cbc3d18e7ae7b7703bbbf11a48c8b Author: TheScarastic <warabhishek@gmail.com> Date: Tue Oct 20 09:26:33 2020 +0000 surya: parts: Switch to TaskStackListener Signed-off-by: Tushar Mahajan <mahajant99@gmail.com> commit cbb83782d5d927b770bb20d4240b6ee3762e6937 Author: xyyx <xyyx@mail.ru> Date: Tue Oct 20 14:06:01 2020 +0300 surya: parts: Add a toggle to hide stock cutout * replacing existing toggle of pill-style notch [filtered from6107871097
] Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com> commit e190f574409155b4d2d966f7d75eb8ba570768e2 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sat Jan 2 13:49:54 2021 +0530 surya: parts: Remove device restart toast from cutout toggle * overlays apply immediately, there's no need for a reboot commit 7ad716a67e7f7f874ad5e96e4e6a62687e300992 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sat Jan 2 14:41:20 2021 +0530 surya: parts: Remove hifi toggle from dirac * we don't support it This reverts commit 544422c55f632ed6c400f09a60cc0ba3dc83b9c9. commit 3620a90cb29f8b3403d6c27b20ebc48865653c42 Author: arian <arian.kulmer@web.de> Date: Sat Dec 15 15:55:55 2018 +0100 surya: parts: Add icons to doze menu Change-Id: Ibbb18065f97ed6f8f5376752495255aeafe1db82 commit 2becd16056a5ed0731ddd5f6bb5ac5006930b685 Author: Arian <arian.kulmer@web.de> Date: Wed Oct 14 23:06:47 2020 +0200 surya: parts: Allow to wake the screen instead of pulsing Co-authored-by: Nauval Rizky <enuma.alrizky@gmail.com> Co-authored-by: Fabian Leutenegger <fabian.leutenegger@bluewin.ch> Change-Id: I1e74f8eafa51843e77d2d8c514c646a4494327cd commit b6fb8d5ce66fb227dc6c7d22fc97c21b45159a56 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sat Jan 2 16:11:54 2021 +0530 surya: parts: Bring back proximity sensor doze setttings commit 37f8097538d092879377216bd96ffc2e5bee2ed2 Author: Jyotiraditya <jyotiraditya@aospa.co> Date: Wed Jun 24 13:07:55 2020 +0200 surya: parts: Implement Clear Speaker Co-authored-by: Adithya R <radithya2002@gmail.com> Signed-off-by: Jyotiraditya <jyotiraditya@aospa.co> Change-Id: I23b8ebd106502e083b6feec9b58efd76e49d3367 commit 2ab1729921024b31e82e171d6cff5aa0432d97f4 Author: AshutoshSundresh <ashutoshsundresh@gmail.com> Date: Tue Aug 11 19:39:00 2020 +0200 surya: parts: Add icon for Clear Speaker * Source:d9d25ff406
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com> commit c8225710b76671ec18088197e4adb9cbd821b079 Author: Henrique Silva <jhenrique09.mcz@hotmail.com> Date: Wed Jan 16 18:35:48 2019 -0200 surya: parts: Add summary for dirac Change-Id: Icf1f2a5e5aadc7515b5a948b0918d9958aab0f2f commit 5b7c2faa82dde494b331b14b50aeed50497c500b Author: Henrique Silva <jhenrique09.mcz@hotmail.com> Date: Wed Jan 16 18:51:22 2019 -0200 surya: parts: Refactor dirac strings * From MIUI Change-Id: I1caab62ffe441bd9bdb18b429849466d868033dc commit e289ccc01f0e7d43522c33eedd39772807184dd4 Author: Henrique Silva <jhenrique09.mcz@hotmail.com> Date: Wed Jan 16 20:06:11 2019 -0200 surya: parts: Import dirac translations from MIUI Signed-off-by: Henrique Silva <jhenrique09.mcz@hotmail.com> Change-Id: I00e015f67d9a01391768a0d07605aea0f6a36765 commit c9360ecca62f61306be6f41f6bece4de7ab1b44f Author: arian <arian.kulmer@web.de> Date: Sat Dec 15 15:55:55 2018 +0530 surya: parts: Add vector icons to dirac * from https://materialdesignicons.com/ with small changes Change-Id: I8eacd97a569ec1a9bcf861ef3bd72c809b611089 commit 43667c3ca8acf72a5a4bcbe071ba9707f8753f9c Author: HarukeyUA <inazarrusnak@gmail.com> Date: Fri Mar 15 18:28:02 2019 +0200 surya: parts: Add dirac QS tile Change-Id: I31759219fc25c8473d52d755eb98f21f5894f691 Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com> commit d597caa99ea756acecb55245cc85a788ea205da4 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sun Jan 3 02:48:48 2021 +0530 surya: parts: Increase BootCompletedReceiver priority * set the priority to SYSTEM_HIGH_PRIORITY to match other system services so our settings are restored faster on bootup * also cleanup BootCompletedReceiver while at it commit 5a99e271ffe8a1f5d617ea429e03894237d7fe4d Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sat Jan 2 16:57:24 2021 +0530 surya: Switch to 90Hz refresh rate by default * a sweet spot between 60Hz (battery life) and 120Hz (smoothness) commit 443a85200ea670ed9b65ea0fb3928d5f99d30b5a Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Mon Jan 4 20:24:38 2021 +0530 surya: parts: Add a summary to ambient display * "Advanced settings" commit 52b70d82fae55aa0db8f66fd05c250107dab2065 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Tue Jan 5 17:12:03 2021 +0530 surya: Implement proper notch masking to hide camera cutout * this shrinks the display till the area below the notch when the toggle is activated, like in MIUI * refactor the toggle to show "Hide camera cutout" instead of "Use camera cutout" * also bring back the toast prompting to reboot, since systemui is in a somewhat unstable state after disabling cutout commit d3e2d40c5158bfe36c291d2e76e30c29c63e341a Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Tue Jan 12 21:15:30 2021 +0530 surya: parts: Move thermal profiles to system settings * let's not pollute our beautiful battery settings menu commit dda07409f7bcca41c8582ce806ecf551226b0b9c Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sat Jan 16 20:13:15 2021 +0530 surya: parts: Display icon beside thermal profiles commit c52d991e4db4313a97a09694d6414cb49d6cd934 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Tue Jan 19 16:34:55 2021 +0530 surya: parts: Implement auto-lowering refresh rate on battery saver commit f8ace799189a5642fd5b9e5a5d2c19848768c18f Author: Bruno Martins <bgcngm@gmail.com> Date: Sat Jan 18 19:04:13 2020 +0000 surya: parts: Fix dark theme issues This brings SwitchBar widget inline with 10 and fixes the theme issues when the dark mode is enabled. Change-Id: I6909b77bc649eb9eb760bf01b46f66570363e9d9 Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com> commit aecbdebae5059890eb7d2d92c78eb1d1a3398bce Author: Bruno Martins <bgcngm@gmail.com> Date: Sat May 16 12:10:14 2020 +0100 surya: parts: Prevent NPE before DiracSound is initialized There can be an edge case where the BOOT_COMPLETED intent is not yet received and user tries to open Dirac sound settings. Avoid letting it crash by making sure init is executed before showing the preference screen. Change-Id: I77e6bdd0c61994338f0dbbce4bfa532d84b8afb7 commit c2b435ddedd4e7999ca2c07257b4e60cb34ac1f2 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sun Jan 24 14:13:23 2021 +0530 surya: parts: Remove switchbar from dynamic thermal This partially reverts commit 50a0b3a2ea4c54b65bbcc59d35c53548774688f8. commit 8decedb02bff5af1132c67b515c7caf06ff68f27 Author: TheScarastic <warabhishek@gmail.com> Date: Tue Oct 20 18:21:03 2020 +0000 surya: parts: Add touch profiles for gaming and benchmarking Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com> commit b7f71a25e0d9c12dd184dd1a56302df9f8bcf5cc Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sun Jan 24 15:33:56 2021 +0530 surya: parts: Adapt gaming profiles for our device commit e38a388c2e710dde58603bbe94d6e1dbfa1a21b6 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sun Jan 31 16:46:03 2021 +0530 surya: parts: Add ACTION_SCREEN_ON intent filter * this should fix thermal/touchscreen profiles not getting restored after turning screen back on commit 9b8cab5982e291d0e116cc4139bcc9b52a9a77e7 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sun Jan 31 17:12:06 2021 +0530 surya: parts: Improve strings for game mode commit 06f75cad29dc704a8ce9fc2d7fd02d9275f449f6 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Fri Feb 12 19:47:12 2021 +0530 surya: parts: Reduce thermal profiles summary length commit 11f468131d4c907142c8462c26a07ba325e602a5 Author: Kuba Wojciechowski <nullbytepl@gmail.com> Date: Fri Feb 12 21:10:28 2021 +0300 surya: parts: Introduce LOCKED_BOOT_COMPLETED handler * sets the fps a little earlier, providing better ux in some cases * note: fps doesn't actually get set until screen is power cycled, I believe this is a bug with our prebuilt display stack (hwc?) Signed-off-by: Kuba Wojciechowski <nullbytepl@gmail.com> commit 85b0ed765f43dab75eaa38c3e808047c96126d72 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Fri Feb 12 22:44:29 2021 +0530 surya: parts: Introduce Refresh Rate QS tile * icon kanged from9dd04b5791 (diff-004f2aace6a940c83c59f0a9311ad0e929b6f0c24cd4ec8049c8c71b42dca70f)
commit 0768837459db74dcf4b09b16f5c3d6070ec27105 Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Sun Feb 14 00:13:57 2021 +0530 surya: parts: Update dirac QS tile title commit 40bce77b65b5b088e7f3bbc984d1beee81dd0453 Author: Anushek <anushekprasal@gmail.com> Date: Fri May 24 09:31:12 2019 +0000 surya: parts: Update dirac QS tile icon Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com> commit aa03d0af1fc9c9810231f414c5f4a727678e5e9c Author: Adithya R <gh0strider.2k18.reborn@gmail.com> Date: Thu Feb 18 22:44:26 2021 +0530 surya: parts: Use headphones icon for dirac QS tile * looks far better than the current "D" icon introduced in 40bce77b65b5b088e7f3bbc984d1beee81dd0453 commit 47ce0a7237bebed46bf0165250eba7814657c8e0 Author: Kuba Wojciechowski <nullbytepl@gmail.com> Date: Thu Feb 4 11:07:21 2021 +0300 surya: parts: Get rid of cutout settings * it doesn't work that great and it should be provided by the system, if desired Signed-off-by: Kuba Wojciechowski <nullbytepl@gmail.com> Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com> Change-Id: I7dc832e725442c4be50ebd84fbdfc11fb4d6589d Signed-off-by: basamaryan <basam.aryan@gmail.com> Signed-off-by: donjohanliebert <donjohanliebert@gmail.com>
This commit is contained in:
parent
18f0fdc582
commit
90580e81c9
@ -8,17 +8,14 @@ android_app {
|
||||
name: "XiaomiParts",
|
||||
|
||||
srcs: ["src/**/*.java"],
|
||||
|
||||
resource_dirs: ["res"],
|
||||
certificate: "platform",
|
||||
platform_apis: true,
|
||||
system_ext_specific: true,
|
||||
privileged: true,
|
||||
|
||||
overrides: ["MusicFX"],
|
||||
static_libs: [
|
||||
"org.lineageos.settings.resources",
|
||||
],
|
||||
|
||||
optimize: {
|
||||
proguard_flags_files: ["proguard.flags"],
|
||||
},
|
||||
|
||||
}
|
||||
|
@ -17,24 +17,25 @@
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.lineageos.settings"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0"
|
||||
android:sharedUserId="android.uid.system">
|
||||
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
||||
<uses-permission android:name="android.permission.DEVICE_POWER" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
|
||||
<protected-broadcast android:name="com.android.systemui.doze.pulse" />
|
||||
|
||||
<application
|
||||
android:label="@string/device_settings_app_name"
|
||||
android:persistent="true">
|
||||
android:allowBackup="true"
|
||||
android:label="@string/app_name"
|
||||
android:persistent="true"
|
||||
android:directBootAware="true"
|
||||
android:defaultToDeviceProtectedStorage="true">
|
||||
|
||||
<receiver android:name=".BootCompletedReceiver"
|
||||
android:exported="false">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<intent-filter android:priority="1000">
|
||||
<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
@ -54,5 +55,30 @@
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".thermal.ThermalSettingsActivity"
|
||||
android:exported="false"
|
||||
android:label="@string/thermal_title"
|
||||
android:icon="@drawable/ic_thermal_settings"
|
||||
android:theme="@style/Theme.SubSettingsBase_v31">
|
||||
<intent-filter>
|
||||
<action android:name="com.android.settings.action.IA_SETTINGS" />
|
||||
</intent-filter>
|
||||
<meta-data
|
||||
android:name="com.android.settings.category"
|
||||
android:value="com.android.settings.category.ia.system" />
|
||||
<meta-data
|
||||
android:name="com.android.settings.summary"
|
||||
android:resource="@string/thermal_summary" />
|
||||
<meta-data
|
||||
android:name="com.android.settings.icon"
|
||||
android:resource="@drawable/ic_thermal_settings" />
|
||||
</activity>
|
||||
|
||||
<service
|
||||
android:name=".thermal.ThermalService"
|
||||
android:permission="ThermalService">
|
||||
</service>
|
||||
|
||||
</application>
|
||||
</manifest>
|
||||
|
@ -1,3 +0,0 @@
|
||||
-keep class org.lineageos.settings.doze.* {
|
||||
*;
|
||||
}
|
12
parts/res/drawable/ic_thermal_benchmark.xml
Normal file
12
parts/res/drawable/ic_thermal_benchmark.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="?android:attr/colorAccent"
|
||||
android:pathData="M21.12 7.88l-1.54 1.54C19.85 10.23 20 11.1 20 12c0 4.41-3.59 8-8 8s-8-3.59-8-8s3.59-8 8-8c0.9 0 1.77 0.15 2.58 0.42l1.53-1.53C14.85 2.32 13.46 2 12 2C6.48 2 2 6.48 2 12s4.48 10 10 10s10-4.48 10-10c0-1.47-0.32-2.86-0.88-4.12z"/>
|
||||
<path
|
||||
android:fillColor="?android:attr/colorAccent"
|
||||
android:pathData="M10.5 13.71c0.18 0.19 0.4 0.33 0.65 0.44c0.24 0.1 0.5 0.15 0.76 0.15c0.27 0 0.53-0.05 0.77-0.15c0.24-0.1 0.46-0.25 0.65-0.44l5.66-8.49l-8.5 5.66c-0.18 0.19-0.33 0.4-0.43 0.65c-0.1 0.24-0.15 0.5-0.15 0.77c0 0.26 0.05 0.52 0.15 0.76c0.1 0.24 0.25 0.47 0.44 0.65z"/>
|
||||
</vector>
|
11
parts/res/drawable/ic_thermal_browser.xml
Normal file
11
parts/res/drawable/ic_thermal_browser.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24">
|
||||
|
||||
<path
|
||||
android:fillColor="?android:attr/colorAccent"
|
||||
android:pathData="M2.546,5.862C4.557,2.772 8.042,0.727 12,0.727C15.958,0.727 19.443,2.772 21.454,5.862C21.584,5.947 21.674,6.086 21.694,6.246C22.697,7.931 23.273,9.899 23.273,12C23.273,18.222 18.222,23.273 12,23.273C5.778,23.273 0.727,18.222 0.727,12C0.727,9.899 1.303,7.931 2.306,6.246C2.326,6.086 2.416,5.947 2.546,5.862ZM7.784,18.049L5.229,18.049C6.602,19.585 8.49,20.651 10.62,20.977C9.503,20.219 8.537,19.221 7.784,18.049ZM18.771,18.049L16.31,18.049C15.564,19.211 14.608,20.202 13.503,20.957C15.583,20.61 17.424,19.555 18.771,18.049ZM13.235,18.049L10.86,18.049C11.207,18.703 11.606,19.307 12.047,19.852C12.488,19.307 12.888,18.703 13.235,18.049ZM6.086,13.083L2.983,13.083C3.101,14.074 3.379,15.016 3.79,15.882L6.713,15.882C6.393,15.001 6.178,14.062 6.086,13.083ZM21.017,13.083L18.008,13.083C17.916,14.062 17.702,15.001 17.382,15.882L20.21,15.882C20.621,15.016 20.899,14.074 21.017,13.083ZM14.67,13.083L9.424,13.083C9.503,14.057 9.689,14.997 9.962,15.882L14.132,15.882C14.406,14.997 14.591,14.057 14.67,13.083ZM6.78,7.939L3.877,7.939C3.418,8.854 3.109,9.858 2.983,10.917L6.086,10.917C6.184,9.872 6.422,8.871 6.78,7.939ZM20.123,7.939L17.315,7.939C17.672,8.871 17.91,9.872 18.008,10.917L21.017,10.917C20.891,9.858 20.582,8.854 20.123,7.939ZM14.076,7.939L10.019,7.939C9.714,8.877 9.509,9.877 9.424,10.917L14.67,10.917C14.585,9.877 14.38,8.877 14.076,7.939ZM10.62,3.023C8.574,3.336 6.751,4.333 5.393,5.772L7.901,5.772C8.637,4.677 9.56,3.742 10.62,3.023ZM13.503,3.043C14.551,3.759 15.465,4.687 16.193,5.772L18.607,5.772C17.276,4.361 15.499,3.376 13.503,3.043ZM12.047,4.148C11.647,4.643 11.281,5.187 10.957,5.772L13.138,5.772C12.814,5.187 12.448,4.643 12.047,4.148Z" />
|
||||
</vector>
|
9
parts/res/drawable/ic_thermal_camera.xml
Normal file
9
parts/res/drawable/ic_thermal_camera.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="?android:attr/colorAccent"
|
||||
android:pathData="M20 5h-3.17L15 3H9L7.17 5H4C2.9 5 2 5.9 2 7v12c0 1.1 0.9 2 2 2h16c1.1 0 2-0.9 2-2V7c0-1.1-0.9-2-2-2zm0 14H4V7h16v12zM12 9c-2.21 0-4 1.79-4 4s1.79 4 4 4s4-1.79 4-4s-1.79-4-4-4z"/>
|
||||
</vector>
|
9
parts/res/drawable/ic_thermal_default.xml
Normal file
9
parts/res/drawable/ic_thermal_default.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="?android:attr/colorAccent"
|
||||
android:pathData="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10s10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8c0-1.85 0.63-3.55 1.69-4.9L16.9 18.31c-1.4 1.1-3.12 1.7-4.9 1.69zm6.31-3.1L7.1 5.69C8.5 4.59 10.22 3.99 12 4c4.42 0 8 3.58 8 8c0 1.85-0.63 3.55-1.69 4.9z"/>
|
||||
</vector>
|
9
parts/res/drawable/ic_thermal_dialer.xml
Normal file
9
parts/res/drawable/ic_thermal_dialer.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="?android:attr/colorAccent"
|
||||
android:pathData="M6.54 5C6.6 5.89 6.75 6.76 6.99 7.59l-1.2 1.2C5.38 7.59 5.12 6.32 5.03 5h1.51zm9.86 12.02c0.85 0.24 1.72 0.39 2.6 0.45v1.49c-1.32-0.09-2.59-0.35-3.8-0.75l1.2-1.19zM7.5 3H4C3.45 3 3 3.45 3 4c0 9.39 7.61 17 17 17c0.55 0 1-0.45 1-1v-3.49c0-0.55-0.45-1-1-1c-1.24 0-2.45-0.2-3.57-0.57c-0.1-0.04-0.2-0.05-0.31-0.05c-0.26 0-0.51 0.1-0.71 0.29l-2.2 2.2c-2.83-1.45-5.14-3.76-6.59-6.59l2.2-2.2C9.1 8.31 9.18 7.92 9.07 7.57C8.69 6.42 8.5 5.21 8.5 4c0-0.55-0.45-1-1-1z"/>
|
||||
</vector>
|
19
parts/res/drawable/ic_thermal_gaming.xml
Normal file
19
parts/res/drawable/ic_thermal_gaming.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24">
|
||||
<group
|
||||
android:scaleX="0.921041"
|
||||
android:scaleY="0.924579"
|
||||
android:translateX="0.752324"
|
||||
android:translateY="0.893459">
|
||||
<path
|
||||
android:fillColor="?android:attr/colorAccent"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M10.228 14.833c-0.006 0 -0.894 0.008 -1.83 1.069 -0.716 0.812 -1.981 2.473 -3.218 3.16 -0.07 0.041 -0.143 0.078 -0.218 0.111 -0.311 0.143 -0.619 0.217 -0.913 0.192l-0.015 0C3.63 19.362 3.252 19.254 2.924 19.066 1.702 18.44 1.782 17.099 1.782 17.099c0 -0.07 0.004 -0.139 0.01 -0.206C1.847 15.696 2.143 9.661 2.563 8.549 3.102 6.316 5.114 4.656 7.51 4.656l9.423 0c2.478 0 4.545 1.775 4.997 4.123 0.383 1.539 0.65 6.984 0.702 8.114 0.006 0.067 0.009 0.136 0.009 0.206 0 0 0.081 1.341 -1.142 1.967 -0.327 0.188 -0.706 0.296 -1.109 0.299l-0.015 0c-0.294 0.025 -0.602 -0.049 -0.914 -0.192 -0.074 -0.033 -0.147 -0.07 -0.218 -0.111 -1.236 -0.687 -2.502 -2.348 -3.217 -3.16 -0.936 -1.061 -1.824 -1.069 -1.83 -1.069l-3.968 0zM8.247 6.379c1.935 0 3.507 1.571 3.507 3.507 0 1.935 -1.572 3.507 -3.507 3.507 -1.936 0 -3.507 -1.572 -3.507 -3.507 0 -1.936 1.571 -3.507 3.507 -3.507zm9.138 4.16c0.454 0 0.823 0.369 0.823 0.823 0 0.454 -0.369 0.823 -0.823 0.823 -0.454 0 -0.823 -0.369 -0.823 -0.823 0 -0.454 0.369 -0.823 0.823 -0.823zm-8.421 0.07l0 0.814c0 0.399 -0.324 0.723 -0.723 0.723 -0.399 0 -0.723 -0.324 -0.723 -0.723l0 -0.814 -0.815 0C6.304 10.609 5.98 10.285 5.98 9.886 5.98 9.487 6.304 9.163 6.703 9.163l0.815 0 0 -0.815c0 -0.399 0.324 -0.723 0.723 -0.723 0.399 0 0.723 0.324 0.723 0.723l0 0.815 0.815 0c0.399 0 0.723 0.324 0.723 0.723 0 0.399 -0.324 0.722 -0.723 0.723l-0.815 0zm10.72 -0.723c0 0.454 -0.369 0.823 -0.823 0.823 -0.454 0 -0.823 -0.369 -0.823 -0.823 0 -0.455 0.369 -0.823 0.823 -0.823 0.454 0 0.823 0.368 0.823 0.823zm-2.952 0c0 0.454 -0.369 0.823 -0.823 0.823 -0.455 0 -0.823 -0.369 -0.823 -0.823 0 -0.455 0.368 -0.823 0.823 -0.823 0.454 0 0.823 0.368 0.823 0.823zm0.653 -2.3c0.454 0 0.823 0.369 0.823 0.824 0 0.454 -0.369 0.823 -0.823 0.823 -0.454 0 -0.823 -0.369 -0.823 -0.823 0 -0.455 0.369 -0.824 0.823 -0.824z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeMiterLimit="1.41421" />
|
||||
</group>
|
||||
</vector>
|
12
parts/res/drawable/ic_thermal_navigation.xml
Normal file
12
parts/res/drawable/ic_thermal_navigation.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="?android:attr/colorAccent"
|
||||
android:pathData="M12,2C8.13,2 5,5.13 5,9c0,5.25 7,13 7,13s7,-7.75 7,-13c0,-3.87 -3.13,-7 -7,-7zM12,11.5c-1.38,0 -2.5,-1.12 -2.5,-2.5s1.12,-2.5 2.5,-2.5 2.5,1.12 2.5,2.5 -1.12,2.5 -2.5,2.5z"
|
||||
android:strokeWidth="1"/>
|
||||
</vector>
|
19
parts/res/drawable/ic_thermal_settings.xml
Normal file
19
parts/res/drawable/ic_thermal_settings.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24">
|
||||
<group
|
||||
android:scaleX="1.05866"
|
||||
android:scaleY="1.05866"
|
||||
android:translateX="-0.652026"
|
||||
android:translateY="-0.703971">
|
||||
<path
|
||||
android:fillColor="?android:attr/colorControlNormal"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M11.066 10.383l0 -2.773 -2.033 -2.033c-0.364 -0.365 -0.364 -0.956 0 -1.321 0.365 -0.364 0.956 -0.364 1.321 0l0.712 0.713 0 -1.111c0 -0.515 0.419 -0.934 0.934 -0.934 0.515 0 0.934 0.419 0.934 0.934l0 1.111 0.712 -0.713c0.365 -0.364 0.956 -0.364 1.321 0 0.364 0.365 0.364 0.956 0 1.321l-2.033 2.033 0 2.773 2.401 -1.387 0.744 -2.777c0.134 -0.498 0.646 -0.794 1.144 -0.66 0.498 0.133 0.794 0.646 0.66 1.143L17.622 7.676 18.584 7.12c0.447 -0.257 1.018 -0.104 1.276 0.342 0.258 0.446 0.104 1.018 -0.342 1.276l-0.962 0.555 0.973 0.261c0.498 0.133 0.794 0.646 0.661 1.144 -0.134 0.497 -0.646 0.793 -1.144 0.66L16.269 10.614 13.868 12l2.401 1.386 2.777 -0.744c0.498 -0.133 1.01 0.163 1.144 0.66 0.133 0.498 -0.163 1.011 -0.661 1.144l-0.973 0.261 0.962 0.555c0.446 0.258 0.6 0.83 0.342 1.276 -0.258 0.446 -0.829 0.599 -1.276 0.342l-0.962 -0.556 0.261 0.974c0.134 0.497 -0.162 1.01 -0.66 1.143 -0.498 0.134 -1.01 -0.162 -1.144 -0.66l-0.744 -2.777 -2.401 -1.387 0 2.886 2.033 2.034c0.364 0.364 0.364 0.956 0 1.32 -0.365 0.365 -0.956 0.365 -1.321 0l-0.712 -0.712 0 0.997c0 0.515 -0.419 0.934 -0.934 0.934 -0.515 0 -0.934 -0.419 -0.934 -0.934l0 -0.997 -0.712 0.712c-0.365 0.365 -0.956 0.365 -1.321 0 -0.364 -0.364 -0.364 -0.956 0 -1.32l2.033 -2.034 0 -2.886 -2.499 1.443 -0.744 2.778C7.689 18.335 7.177 18.631 6.679 18.498 6.181 18.365 5.885 17.852 6.019 17.354L6.28 16.381 5.416 16.88C4.969 17.137 4.398 16.984 4.14 16.538 3.882 16.092 4.036 15.52 4.482 15.262L5.346 14.764 4.372 14.503C3.875 14.369 3.579 13.857 3.712 13.359 3.846 12.861 4.358 12.565 4.856 12.699L7.633 13.443 10.132 12 7.633 10.557 4.856 11.301C4.358 11.435 3.846 11.139 3.712 10.641 3.579 10.143 3.875 9.631 4.372 9.497L5.346 9.236 4.482 8.738C4.036 8.48 3.882 7.908 4.14 7.462 4.398 7.016 4.969 6.863 5.416 7.12L6.28 7.619 6.019 6.646C5.885 6.148 6.181 5.635 6.679 5.502 7.177 5.369 7.689 5.665 7.823 6.162l0.744 2.778 2.499 1.443z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeMiterLimit="1.41421" />
|
||||
</group>
|
||||
</vector>
|
19
parts/res/drawable/ic_thermal_streaming.xml
Normal file
19
parts/res/drawable/ic_thermal_streaming.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportHeight="24"
|
||||
android:viewportWidth="24">
|
||||
<group
|
||||
android:scaleX="1.20862"
|
||||
android:scaleY="1.21327"
|
||||
android:translateX="-0.686496"
|
||||
android:translateY="-0.544151">
|
||||
<path
|
||||
android:fillColor="?android:attr/colorAccent"
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M13.29 18.046l-8.091 0c-1.277 0 -2.315 -1.037 -2.315 -2.315l0 -4.631c0 -1.277 1.038 -2.315 2.315 -2.315l8.091 0c1.272 0 2.305 1.027 2.315 2.296l1.307 -0.754c0.065 -0.038 0.135 -0.067 0.21 -0.086l0.002 0 0 0 0 0 0 0c0.062 -0.015 0.126 -0.023 0.188 -0.023l0.001 0 0.003 0c0.146 0.001 0.283 0.041 0.401 0.11 0.11 0.065 0.205 0.156 0.276 0.272 0.043 0.071 0.076 0.15 0.096 0.233l0 0.002c0.014 0.059 0.02 0.119 0.02 0.178l0 0.001 0 4.803 0 0.001c0 0.059 -0.006 0.119 -0.02 0.178l0 0.001 0 0 0 0 0 0.001c-0.02 0.084 -0.053 0.162 -0.096 0.233 -0.071 0.116 -0.166 0.208 -0.276 0.272 -0.118 0.07 -0.255 0.11 -0.401 0.11l0 0 0 0 -0.003 0 -0.001 0c-0.062 0 -0.126 -0.007 -0.188 -0.023l0 0 0 0 0 0 -0.002 0c-0.075 -0.018 -0.145 -0.047 -0.21 -0.085L15.605 15.75c-0.01 1.269 -1.043 2.296 -2.315 2.296zm-1.773 -4.63c0 -0.107 -0.027 -0.214 -0.083 -0.313l0 0 0 0 -0.001 -0.002 -0.001 0C11.409 13.06 11.381 13.023 11.349 12.988 11.305 12.94 11.254 12.9 11.198 12.869L7.919 10.975C7.867 10.945 7.811 10.922 7.752 10.908l-0.001 -0.001 0 0 0 0 0 0C7.702 10.895 7.652 10.889 7.602 10.889l0 0 -0.002 0 -0.001 0 0 0C7.484 10.89 7.376 10.921 7.283 10.976 7.196 11.027 7.12 11.099 7.064 11.191 7.03 11.247 7.004 11.309 6.989 11.375l0 0.001 0 0 0 0 0 0.001c-0.011 0.046 -0.016 0.094 -0.016 0.141l0 0 0 3.795 0 0.001c0 0.047 0.005 0.094 0.016 0.141l0 0.001c0.015 0.066 0.041 0.128 0.075 0.185 0.056 0.091 0.132 0.163 0.219 0.214 0.093 0.055 0.201 0.087 0.316 0.087l0.003 0 0 0c0.05 0 0.1 -0.006 0.149 -0.018l0 0 0 0 0 0 0.001 0c0.059 -0.015 0.115 -0.038 0.167 -0.068l3.279 -1.893c0.056 -0.032 0.107 -0.072 0.151 -0.119 0.032 -0.035 0.06 -0.073 0.083 -0.113l0.001 -0.001 0.001 -0.001 0 -0.001 0 0c0.056 -0.098 0.083 -0.206 0.083 -0.312zM6.026 4.848c0.955 0 1.731 0.776 1.731 1.731C7.757 7.535 6.981 8.31 6.026 8.31 5.07 8.31 4.295 7.535 4.295 6.579 4.295 5.624 5.07 4.848 6.026 4.848Zm4.986 -2.216c1.567 0 2.839 1.272 2.839 2.839 0 1.567 -1.272 2.839 -2.839 2.839 -1.567 0 -2.839 -1.272 -2.839 -2.839 0 -1.567 1.272 -2.839 2.839 -2.839z"
|
||||
android:strokeLineJoin="round"
|
||||
android:strokeMiterLimit="1.41421" />
|
||||
</group>
|
||||
</vector>
|
12
parts/res/drawable/ic_thermal_video.xml
Normal file
12
parts/res/drawable/ic_thermal_video.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
|
||||
<path
|
||||
android:fillColor="?android:attr/colorAccent"
|
||||
android:pathData="M18,4l2,4h-3l-2,-4h-2l2,4h-3l-2,-4H8l2,4H7L5,4H4c-1.1,0 -1.99,0.9 -1.99,2L2,18c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2V4h-4z"
|
||||
android:strokeWidth="1"/>
|
||||
</vector>
|
22
parts/res/layout/thermal_layout.xml
Normal file
22
parts/res/layout/thermal_layout.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2020 The LineageOS Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/thermal_rv_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:scrollbars="vertical" />
|
66
parts/res/layout/thermal_list_item.xml
Normal file
66
parts/res/layout/thermal_list_item.xml
Normal file
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2020 The LineageOS Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingTop="8dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/app_icon"
|
||||
android:layout_width="@android:dimen/app_icon_size"
|
||||
android:layout_height="@android:dimen/app_icon_size"
|
||||
android:layout_marginEnd="12dp"
|
||||
android:layout_gravity="center"
|
||||
android:contentDescription="@null"
|
||||
android:scaleType="centerInside" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/app_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:ellipsize="marquee"
|
||||
android:singleLine="true"
|
||||
android:textAlignment="viewStart"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||
android:textColor="?android:attr/textColorPrimary" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/app_mode"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/state"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="8dp"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/ic_thermal_default" />
|
||||
</LinearLayout>
|
@ -15,9 +15,25 @@
|
||||
limitations under the License.
|
||||
-->
|
||||
<resources>
|
||||
<!-- Xiaomi Parts -->
|
||||
<string name="app_name">Xiaomi Parts</string>
|
||||
|
||||
<!-- Ambient settings -->
|
||||
<string name="ambient_enable">Use ambient display</string>
|
||||
|
||||
<string name="doze_brightness_title">Always on brightness</string>
|
||||
<string name="doze_brightness_summary">%s mode is enabled</string>
|
||||
|
||||
<!-- Thermal Profiles -->
|
||||
<string name="thermal_title">Thermal profiles</string>
|
||||
<string name="thermal_summary">Per-app thermal profile configuration</string>
|
||||
<string name="thermal_default">Default</string>
|
||||
<string name="thermal_benchmark">Benchmark</string>
|
||||
<string name="thermal_browser">Browser</string>
|
||||
<string name="thermal_camera">Camera</string>
|
||||
<string name="thermal_dialer">Dialer</string>
|
||||
<string name="thermal_gaming">Gaming</string>
|
||||
<string name="thermal_navigation">Navigation</string>
|
||||
<string name="thermal_streaming">Streaming</string>
|
||||
<string name="thermal_video">Video</string>
|
||||
</resources>
|
||||
|
33
parts/res/values/themes.xml
Normal file
33
parts/res/values/themes.xml
Normal file
@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2022 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
|
||||
<!-- Using in SubSettings page including injected settings page -->
|
||||
<style name="Theme.SubSettingsBase_v31" parent="Theme.SettingsBase_v31">
|
||||
<!-- Suppress the built-in action bar -->
|
||||
<item name="android:windowActionBar">false</item>
|
||||
<item name="android:windowNoTitle">true</item>
|
||||
<!-- Set up edge-to-edge configuration for top app bar -->
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
<item name="android:statusBarColor">@android:color/transparent</item>
|
||||
<item name="colorControlNormal">?android:attr/colorControlNormal</item>
|
||||
<!-- For AndroidX AlertDialog -->
|
||||
<item name="alertDialogTheme">@style/Theme.AlertDialog.SettingsLib</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
@ -20,9 +20,11 @@ package org.lineageos.settings;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.util.Log;
|
||||
|
||||
import org.lineageos.settings.doze.DozeUtils;
|
||||
import org.lineageos.settings.thermal.ThermalUtils;
|
||||
|
||||
public class BootCompletedReceiver extends BroadcastReceiver {
|
||||
private static final boolean DEBUG = false;
|
||||
@ -30,8 +32,13 @@ public class BootCompletedReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(final Context context, Intent intent) {
|
||||
if (DEBUG)
|
||||
Log.d(TAG, "Received boot completed intent");
|
||||
DozeUtils.onBootCompleted(context);
|
||||
Log.d(TAG, "Received intent: " + intent.getAction());
|
||||
if (!intent.getAction().equals(Intent.ACTION_LOCKED_BOOT_COMPLETED)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Log.i(TAG, "Boot completed, starting services");
|
||||
DozeUtils.onBootCompleted(context);
|
||||
ThermalUtils.startService(context);
|
||||
}
|
||||
}
|
||||
|
113
parts/src/org/lineageos/settings/thermal/ThermalService.java
Normal file
113
parts/src/org/lineageos/settings/thermal/ThermalService.java
Normal file
@ -0,0 +1,113 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.lineageos.settings.thermal;
|
||||
|
||||
import android.app.ActivityTaskManager;
|
||||
import android.app.TaskStackListener;
|
||||
import android.app.Service;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
public class ThermalService extends Service {
|
||||
|
||||
private static final String TAG = "ThermalService";
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
private boolean mScreenOn = true;
|
||||
private String mCurrentApp = "";
|
||||
private ThermalUtils mThermalUtils;
|
||||
|
||||
private BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
switch (intent.getAction()) {
|
||||
case Intent.ACTION_SCREEN_OFF:
|
||||
mScreenOn = false;
|
||||
setThermalProfile();
|
||||
break;
|
||||
case Intent.ACTION_SCREEN_ON:
|
||||
mScreenOn = true;
|
||||
setThermalProfile();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public void onCreate() {
|
||||
if (DEBUG) Log.d(TAG, "Creating service");
|
||||
try {
|
||||
ActivityTaskManager.getService().registerTaskStackListener(mTaskListener);
|
||||
} catch (RemoteException e) {
|
||||
// Do nothing
|
||||
}
|
||||
mThermalUtils = new ThermalUtils(this);
|
||||
registerReceiver();
|
||||
super.onCreate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
if (DEBUG) Log.d(TAG, "Starting service");
|
||||
return START_STICKY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void registerReceiver() {
|
||||
IntentFilter filter = new IntentFilter();
|
||||
filter.addAction(Intent.ACTION_SCREEN_OFF);
|
||||
filter.addAction(Intent.ACTION_SCREEN_ON);
|
||||
this.registerReceiver(mIntentReceiver, filter);
|
||||
}
|
||||
|
||||
private void setThermalProfile() {
|
||||
if (mScreenOn) {
|
||||
mThermalUtils.setThermalProfile(mCurrentApp);
|
||||
} else {
|
||||
mThermalUtils.setDefaultThermalProfile();
|
||||
}
|
||||
}
|
||||
|
||||
private final TaskStackListener mTaskListener = new TaskStackListener() {
|
||||
@Override
|
||||
public void onTaskStackChanged() {
|
||||
try {
|
||||
final ActivityTaskManager.RootTaskInfo focusedTask =
|
||||
ActivityTaskManager.getService().getFocusedRootTaskInfo();
|
||||
if (focusedTask != null && focusedTask.topActivity != null) {
|
||||
ComponentName taskComponentName = focusedTask.topActivity;
|
||||
String foregroundApp = taskComponentName.getPackageName();
|
||||
if (!foregroundApp.equals(mCurrentApp)) {
|
||||
mCurrentApp = foregroundApp;
|
||||
setThermalProfile();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
};
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (C) 2020-2022 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.lineageos.settings.thermal;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
|
||||
import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity;
|
||||
|
||||
public class ThermalSettingsActivity extends CollapsingToolbarBaseActivity {
|
||||
|
||||
private static final String TAG_THERMAL = "thermal";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getFragmentManager().beginTransaction().replace(
|
||||
com.android.settingslib.collapsingtoolbar.R.id.content_frame,
|
||||
new ThermalSettingsFragment(), TAG_THERMAL).commit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == android.R.id.home) {
|
||||
onBackPressed();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,439 @@
|
||||
/**
|
||||
* Copyright (C) 2020 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.lineageos.settings.thermal;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.SectionIndexer;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.preference.PreferenceFragment;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
|
||||
import com.android.settingslib.applications.ApplicationsState;
|
||||
|
||||
import org.lineageos.settings.R;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ThermalSettingsFragment extends PreferenceFragment
|
||||
implements ApplicationsState.Callbacks {
|
||||
|
||||
private AllPackagesAdapter mAllPackagesAdapter;
|
||||
private ApplicationsState mApplicationsState;
|
||||
private ApplicationsState.Session mSession;
|
||||
private ActivityFilter mActivityFilter;
|
||||
private Map<String, ApplicationsState.AppEntry> mEntryMap =
|
||||
new HashMap<String, ApplicationsState.AppEntry>();
|
||||
|
||||
private ThermalUtils mThermalUtils;
|
||||
private RecyclerView mAppsRecyclerView;
|
||||
|
||||
@Override
|
||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
mApplicationsState = ApplicationsState.getInstance(getActivity().getApplication());
|
||||
mSession = mApplicationsState.newSession(this);
|
||||
mSession.onResume();
|
||||
mActivityFilter = new ActivityFilter(getActivity().getPackageManager());
|
||||
|
||||
mAllPackagesAdapter = new AllPackagesAdapter(getActivity());
|
||||
|
||||
mThermalUtils = new ThermalUtils(getActivity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
return inflater.inflate(R.layout.thermal_layout, container, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
|
||||
mAppsRecyclerView = view.findViewById(R.id.thermal_rv_view);
|
||||
mAppsRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
|
||||
mAppsRecyclerView.setAdapter(mAllPackagesAdapter);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
getActivity().setTitle(getResources().getString(R.string.thermal_title));
|
||||
rebuild();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
|
||||
mSession.onPause();
|
||||
mSession.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPackageListChanged() {
|
||||
mActivityFilter.updateLauncherInfoList();
|
||||
rebuild();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRebuildComplete(ArrayList<ApplicationsState.AppEntry> entries) {
|
||||
if (entries != null) {
|
||||
handleAppEntries(entries);
|
||||
mAllPackagesAdapter.notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoadEntriesCompleted() {
|
||||
rebuild();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAllSizesComputed() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLauncherInfoChanged() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPackageIconChanged() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPackageSizeChanged(String packageName) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRunningStateChanged(boolean running) {
|
||||
}
|
||||
|
||||
private void handleAppEntries(List<ApplicationsState.AppEntry> entries) {
|
||||
final ArrayList<String> sections = new ArrayList<String>();
|
||||
final ArrayList<Integer> positions = new ArrayList<Integer>();
|
||||
final PackageManager pm = getActivity().getPackageManager();
|
||||
String lastSectionIndex = null;
|
||||
int offset = 0;
|
||||
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
final ApplicationInfo info = entries.get(i).info;
|
||||
final String label = (String) info.loadLabel(pm);
|
||||
final String sectionIndex;
|
||||
|
||||
if (!info.enabled) {
|
||||
sectionIndex = "--"; // XXX
|
||||
} else if (TextUtils.isEmpty(label)) {
|
||||
sectionIndex = "";
|
||||
} else {
|
||||
sectionIndex = label.substring(0, 1).toUpperCase();
|
||||
}
|
||||
|
||||
if (lastSectionIndex == null ||
|
||||
!TextUtils.equals(sectionIndex, lastSectionIndex)) {
|
||||
sections.add(sectionIndex);
|
||||
positions.add(offset);
|
||||
lastSectionIndex = sectionIndex;
|
||||
}
|
||||
|
||||
offset++;
|
||||
}
|
||||
|
||||
mAllPackagesAdapter.setEntries(entries, sections, positions);
|
||||
mEntryMap.clear();
|
||||
for (ApplicationsState.AppEntry e : entries) {
|
||||
mEntryMap.put(e.info.packageName, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void rebuild() {
|
||||
mSession.rebuild(mActivityFilter, ApplicationsState.ALPHA_COMPARATOR);
|
||||
}
|
||||
|
||||
private int getStateDrawable(int state) {
|
||||
switch (state) {
|
||||
case ThermalUtils.STATE_BENCHMARK:
|
||||
return R.drawable.ic_thermal_benchmark;
|
||||
case ThermalUtils.STATE_BROWSER:
|
||||
return R.drawable.ic_thermal_browser;
|
||||
case ThermalUtils.STATE_CAMERA:
|
||||
return R.drawable.ic_thermal_camera;
|
||||
case ThermalUtils.STATE_DIALER:
|
||||
return R.drawable.ic_thermal_dialer;
|
||||
case ThermalUtils.STATE_GAMING:
|
||||
return R.drawable.ic_thermal_gaming;
|
||||
case ThermalUtils.STATE_NAVIGATION:
|
||||
return R.drawable.ic_thermal_navigation;
|
||||
case ThermalUtils.STATE_STREAMING:
|
||||
return R.drawable.ic_thermal_streaming;
|
||||
case ThermalUtils.STATE_VIDEO:
|
||||
return R.drawable.ic_thermal_video;
|
||||
case ThermalUtils.STATE_DEFAULT:
|
||||
default:
|
||||
return R.drawable.ic_thermal_default;
|
||||
}
|
||||
}
|
||||
|
||||
private class ViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView title;
|
||||
private Spinner mode;
|
||||
private ImageView icon;
|
||||
private View rootView;
|
||||
private ImageView stateIcon;
|
||||
|
||||
private ViewHolder(View view) {
|
||||
super(view);
|
||||
this.title = view.findViewById(R.id.app_name);
|
||||
this.mode = view.findViewById(R.id.app_mode);
|
||||
this.icon = view.findViewById(R.id.app_icon);
|
||||
this.stateIcon = view.findViewById(R.id.state);
|
||||
this.rootView = view;
|
||||
|
||||
view.setTag(this);
|
||||
}
|
||||
}
|
||||
|
||||
private class ModeAdapter extends BaseAdapter {
|
||||
|
||||
private final LayoutInflater inflater;
|
||||
private final int[] items = {
|
||||
R.string.thermal_default,
|
||||
R.string.thermal_benchmark,
|
||||
R.string.thermal_browser,
|
||||
R.string.thermal_camera,
|
||||
R.string.thermal_dialer,
|
||||
R.string.thermal_gaming,
|
||||
R.string.thermal_navigation,
|
||||
R.string.thermal_streaming,
|
||||
R.string.thermal_video
|
||||
};
|
||||
|
||||
private ModeAdapter(Context context) {
|
||||
inflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return items.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getItem(int position) {
|
||||
return items[position];
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
TextView view;
|
||||
if (convertView != null) {
|
||||
view = (TextView) convertView;
|
||||
} else {
|
||||
view = (TextView) inflater.inflate(android.R.layout.simple_spinner_dropdown_item,
|
||||
parent, false);
|
||||
}
|
||||
|
||||
view.setText(items[position]);
|
||||
view.setTextSize(14f);
|
||||
return view;
|
||||
}
|
||||
}
|
||||
|
||||
private class AllPackagesAdapter extends RecyclerView.Adapter<ViewHolder>
|
||||
implements AdapterView.OnItemSelectedListener, SectionIndexer {
|
||||
|
||||
private List<ApplicationsState.AppEntry> mEntries = new ArrayList<>();
|
||||
private String[] mSections;
|
||||
private int[] mPositions;
|
||||
|
||||
public AllPackagesAdapter(Context context) {
|
||||
mActivityFilter = new ActivityFilter(context.getPackageManager());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return mEntries.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getItemId(int position) {
|
||||
return mEntries.get(position).id;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
return new ViewHolder(LayoutInflater.from(parent.getContext())
|
||||
.inflate(R.layout.thermal_list_item, parent, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ViewHolder holder, int position) {
|
||||
Context context = holder.itemView.getContext();
|
||||
ApplicationsState.AppEntry entry = mEntries.get(position);
|
||||
if (entry == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
holder.mode.setAdapter(new ModeAdapter(context));
|
||||
holder.mode.setOnItemSelectedListener(this);
|
||||
|
||||
holder.title.setText(entry.label);
|
||||
holder.title.setOnClickListener(v -> holder.mode.performClick());
|
||||
|
||||
mApplicationsState.ensureIcon(entry);
|
||||
holder.icon.setImageDrawable(entry.icon);
|
||||
|
||||
int packageState = mThermalUtils.getStateForPackage(entry.info.packageName);
|
||||
holder.mode.setSelection(packageState, false);
|
||||
holder.mode.setTag(entry);
|
||||
holder.stateIcon.setImageResource(getStateDrawable(packageState));
|
||||
}
|
||||
|
||||
private void setEntries(List<ApplicationsState.AppEntry> entries,
|
||||
List<String> sections, List<Integer> positions) {
|
||||
mEntries = entries;
|
||||
mSections = sections.toArray(new String[sections.size()]);
|
||||
mPositions = new int[positions.size()];
|
||||
for (int i = 0; i < positions.size(); i++) {
|
||||
mPositions[i] = positions.get(i);
|
||||
}
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||
final ApplicationsState.AppEntry entry = (ApplicationsState.AppEntry) parent.getTag();
|
||||
int currentState = mThermalUtils.getStateForPackage(entry.info.packageName);
|
||||
if (currentState != position) {
|
||||
mThermalUtils.writePackage(entry.info.packageName, position);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPositionForSection(int section) {
|
||||
if (section < 0 || section >= mSections.length) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return mPositions[section];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSectionForPosition(int position) {
|
||||
if (position < 0 || position >= getItemCount()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
final int index = Arrays.binarySearch(mPositions, position);
|
||||
|
||||
/*
|
||||
* Consider this example: section positions are 0, 3, 5; the supplied
|
||||
* position is 4. The section corresponding to position 4 starts at
|
||||
* position 3, so the expected return value is 1. Binary search will not
|
||||
* find 4 in the array and thus will return -insertPosition-1, i.e. -3.
|
||||
* To get from that number to the expected value of 1 we need to negate
|
||||
* and subtract 2.
|
||||
*/
|
||||
return index >= 0 ? index : -index - 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getSections() {
|
||||
return mSections;
|
||||
}
|
||||
}
|
||||
|
||||
private class ActivityFilter implements ApplicationsState.AppFilter {
|
||||
|
||||
private final PackageManager mPackageManager;
|
||||
private final List<String> mLauncherResolveInfoList = new ArrayList<String>();
|
||||
|
||||
private ActivityFilter(PackageManager packageManager) {
|
||||
this.mPackageManager = packageManager;
|
||||
|
||||
updateLauncherInfoList();
|
||||
}
|
||||
|
||||
public void updateLauncherInfoList() {
|
||||
Intent i = new Intent(Intent.ACTION_MAIN);
|
||||
i.addCategory(Intent.CATEGORY_LAUNCHER);
|
||||
List<ResolveInfo> resolveInfoList = mPackageManager.queryIntentActivities(i, 0);
|
||||
|
||||
synchronized (mLauncherResolveInfoList) {
|
||||
mLauncherResolveInfoList.clear();
|
||||
for (ResolveInfo ri : resolveInfoList) {
|
||||
mLauncherResolveInfoList.add(ri.activityInfo.packageName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean filterApp(ApplicationsState.AppEntry entry) {
|
||||
boolean show = !mAllPackagesAdapter.mEntries.contains(entry.info.packageName);
|
||||
if (show) {
|
||||
synchronized (mLauncherResolveInfoList) {
|
||||
show = mLauncherResolveInfoList.contains(entry.info.packageName);
|
||||
}
|
||||
}
|
||||
return show;
|
||||
}
|
||||
}
|
||||
}
|
196
parts/src/org/lineageos/settings/thermal/ThermalUtils.java
Normal file
196
parts/src/org/lineageos/settings/thermal/ThermalUtils.java
Normal file
@ -0,0 +1,196 @@
|
||||
/*
|
||||
* Copyright (C) 2020 The LineageOS Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.lineageos.settings.thermal;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.RemoteException;
|
||||
import android.os.SystemProperties;
|
||||
import android.os.UserHandle;
|
||||
import android.view.Display;
|
||||
import android.view.Surface;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import org.lineageos.settings.utils.FileUtils;
|
||||
|
||||
public final class ThermalUtils {
|
||||
|
||||
private static final String THERMAL_CONTROL = "thermal_control";
|
||||
|
||||
protected static final int STATE_DEFAULT = 0;
|
||||
protected static final int STATE_BENCHMARK = 1;
|
||||
protected static final int STATE_BROWSER = 2;
|
||||
protected static final int STATE_CAMERA = 3;
|
||||
protected static final int STATE_DIALER = 4;
|
||||
protected static final int STATE_GAMING = 5;
|
||||
protected static final int STATE_NAVIGATION = 6;
|
||||
protected static final int STATE_STREAMING = 7;
|
||||
protected static final int STATE_VIDEO = 8;
|
||||
|
||||
private static final String THERMAL_STATE_DEFAULT = "0";
|
||||
private static final String THERMAL_STATE_BENCHMARK = "10";
|
||||
private static final String THERMAL_STATE_BROWSER = "11";
|
||||
private static final String THERMAL_STATE_CAMERA = "12";
|
||||
private static final String THERMAL_STATE_DIALER = "8";
|
||||
private static final String THERMAL_STATE_GAMING = "13";
|
||||
private static final String THERMAL_STATE_NAVIGATION = "19";
|
||||
private static final String THERMAL_STATE_STREAMING = "14";
|
||||
private static final String THERMAL_STATE_VIDEO = "21";
|
||||
|
||||
private static final String THERMAL_BENCHMARK = "thermal.benchmark=";
|
||||
private static final String THERMAL_BROWSER = "thermal.browser=";
|
||||
private static final String THERMAL_CAMERA = "thermal.camera=";
|
||||
private static final String THERMAL_DIALER = "thermal.dialer=";
|
||||
private static final String THERMAL_GAMING = "thermal.gaming=";
|
||||
private static final String THERMAL_NAVIGATION = "thermal.navigation=";
|
||||
private static final String THERMAL_STREAMING = "thermal.streaming=";
|
||||
private static final String THERMAL_VIDEO = "thermal.video=";
|
||||
|
||||
private static final String THERMAL_SCONFIG = "/sys/class/thermal/thermal_message/sconfig";
|
||||
|
||||
private Display mDisplay;
|
||||
private SharedPreferences mSharedPrefs;
|
||||
|
||||
protected ThermalUtils(Context context) {
|
||||
mSharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
|
||||
WindowManager mWindowManager = context.getSystemService(WindowManager.class);
|
||||
mDisplay = mWindowManager.getDefaultDisplay();
|
||||
}
|
||||
|
||||
public static void startService(Context context) {
|
||||
context.startServiceAsUser(new Intent(context, ThermalService.class),
|
||||
UserHandle.CURRENT);
|
||||
}
|
||||
|
||||
private void writeValue(String profiles) {
|
||||
mSharedPrefs.edit().putString(THERMAL_CONTROL, profiles).apply();
|
||||
}
|
||||
|
||||
private String getValue() {
|
||||
String value = mSharedPrefs.getString(THERMAL_CONTROL, null);
|
||||
|
||||
if (value == null || value.isEmpty()) {
|
||||
value = THERMAL_BENCHMARK + ":" + THERMAL_BROWSER + ":" + THERMAL_CAMERA + ":" + THERMAL_DIALER + ":" +
|
||||
THERMAL_GAMING + ":" + THERMAL_NAVIGATION + ":" + THERMAL_STREAMING + ":" + THERMAL_VIDEO;
|
||||
writeValue(value);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
protected void writePackage(String packageName, int mode) {
|
||||
String value = getValue();
|
||||
value = value.replace(packageName + ",", "");
|
||||
String[] modes = value.split(":");
|
||||
String finalString;
|
||||
|
||||
switch (mode) {
|
||||
case STATE_BENCHMARK:
|
||||
modes[0] = modes[0] + packageName + ",";
|
||||
break;
|
||||
case STATE_BROWSER:
|
||||
modes[1] = modes[1] + packageName + ",";
|
||||
break;
|
||||
case STATE_CAMERA:
|
||||
modes[2] = modes[2] + packageName + ",";
|
||||
break;
|
||||
case STATE_DIALER:
|
||||
modes[3] = modes[3] + packageName + ",";
|
||||
break;
|
||||
case STATE_GAMING:
|
||||
modes[4] = modes[4] + packageName + ",";
|
||||
break;
|
||||
case STATE_NAVIGATION:
|
||||
modes[5] = modes[5] + packageName + ",";
|
||||
break;
|
||||
case STATE_STREAMING:
|
||||
modes[6] = modes[6] + packageName + ",";
|
||||
break;
|
||||
case STATE_VIDEO:
|
||||
modes[7] = modes[7] + packageName + ",";
|
||||
break;
|
||||
}
|
||||
|
||||
finalString = modes[0] + ":" + modes[1] + ":" + modes[2] + ":" + modes[3] + ":" +
|
||||
modes[4] + ":" + modes[5] + ":" + modes[6] + ":" + modes[7];
|
||||
|
||||
writeValue(finalString);
|
||||
}
|
||||
|
||||
protected int getStateForPackage(String packageName) {
|
||||
String value = getValue();
|
||||
String[] modes = value.split(":");
|
||||
int state = STATE_DEFAULT;
|
||||
|
||||
if (modes[0].contains(packageName + ",")) {
|
||||
state = STATE_BENCHMARK;
|
||||
} else if (modes[1].contains(packageName + ",")) {
|
||||
state = STATE_BROWSER;
|
||||
} else if (modes[2].contains(packageName + ",")) {
|
||||
state = STATE_CAMERA;
|
||||
} else if (modes[3].contains(packageName + ",")) {
|
||||
state = STATE_DIALER;
|
||||
} else if (modes[4].contains(packageName + ",")) {
|
||||
state = STATE_GAMING;
|
||||
} else if (modes[5].contains(packageName + ",")) {
|
||||
state = STATE_NAVIGATION;
|
||||
} else if (modes[6].contains(packageName + ",")) {
|
||||
state = STATE_STREAMING;
|
||||
} else if (modes[7].contains(packageName + ",")) {
|
||||
state = STATE_VIDEO;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
protected void setDefaultThermalProfile() {
|
||||
FileUtils.writeLine(THERMAL_SCONFIG, THERMAL_STATE_DEFAULT);
|
||||
}
|
||||
|
||||
protected void setThermalProfile(String packageName) {
|
||||
String value = getValue();
|
||||
String modes[];
|
||||
String state = THERMAL_STATE_DEFAULT;
|
||||
|
||||
if (value != null) {
|
||||
modes = value.split(":");
|
||||
|
||||
if (modes[0].contains(packageName + ",")) {
|
||||
state = THERMAL_STATE_BENCHMARK;
|
||||
} else if (modes[1].contains(packageName + ",")) {
|
||||
state = THERMAL_STATE_BROWSER;
|
||||
} else if (modes[2].contains(packageName + ",")) {
|
||||
state = THERMAL_STATE_CAMERA;
|
||||
} else if (modes[3].contains(packageName + ",")) {
|
||||
state = THERMAL_STATE_DIALER;
|
||||
} else if (modes[4].contains(packageName + ",")) {
|
||||
state = THERMAL_STATE_GAMING;
|
||||
} else if (modes[5].contains(packageName + ",")) {
|
||||
state = THERMAL_STATE_NAVIGATION;
|
||||
} else if (modes[6].contains(packageName + ",")) {
|
||||
state = THERMAL_STATE_STREAMING;
|
||||
} else if (modes[7].contains(packageName + ",")) {
|
||||
state = THERMAL_STATE_VIDEO;
|
||||
}
|
||||
}
|
||||
|
||||
FileUtils.writeLine(THERMAL_SCONFIG, state);
|
||||
}
|
||||
}
|
2
sepolicy/vendor/system_app.te
vendored
2
sepolicy/vendor/system_app.te
vendored
@ -6,6 +6,8 @@ binder_call(system_app, hal_motor)
|
||||
|
||||
allow system_app sysfs_doze:file rw_file_perms;
|
||||
|
||||
allow system_app sysfs_thermal:file rw_file_perms;
|
||||
|
||||
allow system_app { motor_device vendor_sysfs_graphics sysfs_leds }:dir search;
|
||||
allow system_app { cgroup vendor_sysfs_graphics }:file rw_file_perms;
|
||||
allow system_app { motor_device vendor_sysfs_graphics hall_device }:chr_file rw_file_perms;
|
||||
|
Loading…
Reference in New Issue
Block a user