101 Commits

Author SHA1 Message Date
Bruno Martins
11dff39159 dolby: Apply Expressive theme
Change-Id: I03c814b97c8401428f2b358d065a99503df9d1cc
2026-01-20 09:22:03 +09:00
Bruno Martins
3246c3ae3b dolby: Convert for M3E support
Change-Id: Ib4d1088f5be3fc2b5c2ff90d5cd1b86603551037
2026-01-20 09:22:03 +09:00
Bruno Martins
3b8938cda5 dolby: Use new method to listen for preference changes
Usage of addOnSwitchChangeListener(OnCheckedChangeListener) is
deprecated. The Javadoc explicitly says:

  Use setOnPreferenceChangeListener(OnPreferenceChangeListener) instead.

Change-Id: I71e0e3f86ff339a312cac1e09106f6d5d15b7e43
Signed-off-by: basamaryan <basam.aryan@gmail.com>
2026-01-20 09:22:03 +09:00
9e7a9b9d59 dolby: Move to PreferenceFragmentCompat
PreferenceFragment was deprecated in API level 28.

https://developer.android.com/jetpack/androidx/releases/preference#1.1.0

Change-Id: Ie8a4b04bd588afbbbc5882349ddbc05f988f80bf
Signed-off-by: AnierinB <anierin@evolution-x.org>
Signed-off-by: basamaryan <basam.aryan@gmail.com>
2026-01-20 09:22:03 +09:00
pabloescobar-reborn
a030a000a5 dolby: kang dax-defualt from aospa
* Based on Paranoid Android Vauxite (7) [03/08/2025]
2026-01-12 15:12:04 +00:00
Ghosuto
0e03fffcdb dolby: add missing software codec Attribute
Signed-off-by: Ghosuto <clash.raja10@gmail.com>
2026-01-02 08:16:52 +05:30
Yogesh
fe94e80ffa Merge pull request #1 from DqrKnzx/16
dolby: fix attributes and tags in dax_default.xml
2025-11-29 00:41:08 +05:30
DqrKnzx
944a468640 dolby: fix attributes and tags in dax_default.xml
- Typos prevented some audio settings from being applied (gain_left, virtual bass).

Signed-off-by: DqrKnzx <DavidYonatan9@hotmail.com>
2025-11-28 19:00:59 +00:00
chaitanya
63bcd895df dolby: fixup voice profile 2025-09-07 15:55:34 +00:00
chaitanyakm
de23ccc185 dolby: update dax-default.xml 2025-09-07 15:55:25 +00:00
Adithya R
088743af43 dolby: Do not conditionally disable prefs on speaker
We have separate toggles for speaker and headphone virtualizer so
this doesn't really make sense.

Change-Id: I95406f2bb1815146aa52fb49541ffd60541ca05f
2025-09-02 02:26:10 +00:00
Adithya R
0353d1e21f dolby: Allow force disabling volume leveler
Change-Id: Ib70e1f27d8280c8b4ec456e4feaa30522fdc5121
2025-09-02 02:26:10 +00:00
Adithya R
fbb15cb28b dolby: Avoid hardcoded strings for custom preset
Change-Id: I6a2b16cb67bc0bf4def9fbe17aac30664e62f4d7
2025-09-02 02:26:10 +00:00
Adithya R
67eed6a82c dolby: Move to device encrypted storage
Change-Id: I9135755bb79acb2a9f74b040403973b056941827
2025-09-02 02:26:10 +00:00
Adithya R
40fe6856d7 dolby: Move effect strength settings to sliders
Stereo widening and dialogue enhancer.

Change-Id: I3f2eb7d01c11f90e9080d22f8f390f8adddcba14
2025-09-02 02:26:10 +00:00
Adithya R
60ed7e0863 dolby: Hide advanced settings in dynamic profile
This is in line with DaxUI.

Change-Id: I6ea2657c86e5c4cfb1aa6f78d651b330f56ae921
2025-09-02 02:26:10 +00:00
Adithya R
858790df5d dolby: Add a menu button to reset all profiles
Change-Id: I16c4f7e06279bdcb1a1f2977ce48d2487caecac3
2025-09-02 02:26:10 +00:00
Adithya R
31d7175068 fixup! dolby: Add intelligent equalizer setting 2025-09-02 02:26:10 +00:00
Adithya R
d40e763990 fixup! dolby: Use index of value for selecting ieq icon 2025-09-02 02:26:10 +00:00
Pranav Vashi
4920046dbe dolby: Fix compilation error in TooltipIconButton
Fixes: TooltipIconButton.kt:30:44: error: unresolved reference: rememberPlainTooltipPositionProvider

Change-Id: I7554622a406f4a56dc8471a39cbd4ad73c0daede
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
2025-09-02 02:26:10 +00:00
Adithya R
c3f3a11aeb dolby: Use index of value for selecting ieq icon
Otherwise if we alter value ids (dolby_ieq_values) via overlay,
the wrong icon is displayed since the value differs from index.

Change-Id: I4ec55719a31cb22777069b62fa550eadd3d946fb
2025-09-02 02:26:10 +00:00
Adithya R
753b34ec59 dolby: Allow disabling stereo widening levels
On newer dolby tunings, this is unsupported. It can only be turned
on/off (headphone virtualization).

Change-Id: Iffbffd81bb22510fa10418f9247ce89c0513b09e
2025-09-02 02:26:10 +00:00
Adithya R
05ca7c6837 dolby: Enable bass enhancer on loudspeaker too
It is a subtle but noticeable effect.

Change-Id: I385c8474f2423c7496423716448f7480cd6acbf3
2025-09-02 02:26:10 +00:00
Adithya R
a4cd52a83c dolby: Properly update profile preference summary
When profile is changed to known from unknown, the preference didn't
get updated.

Change-Id: Ic5e41f8c853187272d00178c7de02551f16350f9
2025-09-02 02:26:10 +00:00
Adithya R
b8e001e5eb dolby: Add support for Custom profile
This appears to be present in all devices' dolby configurations.

Change-Id: I651a5f0f64144bbda6de863989043f9daf40b213
2025-09-02 02:26:10 +00:00
Fabian Leutenegger
440bb655d2 dolby: Update EqualizerScreen background color for 15
Switch to MaterialTheme settingsBackground for EqualizerScreen background color

Change-Id: I546e3528814276eb857a650cb6c173d914550fb5
2025-09-02 02:26:10 +00:00
Pranav Vashi
b27a259975 dolby: Remove deprecated PlainTooltipBox
Change-Id: I70ffff5ba30c5eeaff431e46c82eaf05d46e4cb0
2025-09-02 02:26:10 +00:00
basamaryan
d43556f426 dolby: Fix build with kotlinc 1.9.0
Change-Id: I4f9fdc9d25eb57240612cff1b3bef3663014f9a8
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2025-09-02 02:26:10 +00:00
Michael Bestas
939088422f dolby: Convert to SwitchPreferenceCompat
Change-Id: Ic1cbaba37d499da1855af9c3930f2df426e2d3af
2025-09-02 02:26:10 +00:00
Chaohui Wang
600851e820 dolby: Migrate to CompoundButton.OnCheckedChangeListener
Switch and SwitchCompat are both CompoundButton.

Using CompoundButton in Java will helps migration in the future.

Bug: 306658427 | AOSP | AOSP
Test: manual - check Settings pages
Test: m RunSettingsLibRoboTests
Change-Id: I85a70d4c504d8584030ea4a058f30d74206ab835
2025-09-02 02:26:10 +00:00
Fabian Leutenegger
ca33c4dd78 dolby: Replace widget.R with collapsingtoolbar.R
Change-Id: I725a3bdb06f2a697791b882c5709f59b6089ba15
2025-09-02 02:26:10 +00:00
Adithya R
6db983af3e dolby: Make sure to persist value after toggling QS tile
Toggling the switch pref automatically sets the shared pref for us, but
toggling the QS tile does no such thing so we gotta do it ourselves.

Change-Id: Iac881ed654bf4eb76b111fc87667f16476d11522
2025-09-02 02:26:10 +00:00
Adithya R
318f0ea617 dolby: Add intelligent equalizer setting
Move preference-related classes to a new package while we're at it,
to reduce code clutter.

Change-Id: I2430e8ab9b6758503ce1777ec985a3e400b55b8e
2025-09-02 02:26:10 +00:00
Adithya R
b44187ef8f dolby: Introduce graphical equalizer
Squashed:

dolby: Refresh preset name on main screen

Change-Id: I96783e2a03c384f031787f4cc9140f7d64dadb2f
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>

Change-Id: I38ee6ce594e5671af42afc3d4bf0f004329482b9
2025-09-02 02:26:10 +00:00
Pranav Vashi
14efd187f8 dolby: Add launcher icon
Change-Id: I4d36842ca96048f9b55604d66cc7741759d657f3
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
[adithya2306: Add monochrome icon as well]
Signed-off-by: Adithya R <gh0strider.2k18.reborn@gmail.com>
2025-09-02 02:26:10 +00:00
Adithya R
4f1393f337 fixup! dolby: Restore all settings upon bootup
Stereo widening dependency on virtualizer was accidentally removed.

Change-Id: I9b1e35aef5037935af3dc18a303408e2a81ca635
2025-09-02 02:26:10 +00:00
Adithya R
4774c82a5b dolby: Restore current profile _after_ resetting profiles
Ensure to end the onBootCompleted routine with the correct profile set.

Change-Id: I2d5f74a7c0145af2f9d064cd98fa2dc70e5a7acd
2025-09-02 02:26:10 +00:00
Adithya R
7a1ef573d6 dolby: Do not set volume leveler amount
This value is set to zero in almost every known dax-default.xml,
including ours.
DaxService also doesn't mess with this value, instead only sets
VolumeLevelerEnabled.

Change-Id: Ib944728d478cff58aebc4f47128bcd5fe32ff9f6
2025-09-02 02:26:10 +00:00
Adithya R
e92669bd12 dolby: Restore all settings upon bootup
Dolby often messes up restoring profile-specific settings after a reboot.
"Fine. I'll do it myself."

Change-Id: Ic255c6922eabae0b522c05110f87e2c10a97fb6c
2025-09-02 02:26:10 +00:00
Adithya R
586755d10b dolby: Rewrite in Kotlin
Some cleanup and restructuring while we're at it.

Change-Id: I2f1fc53c202d91421c7b6af68c814c25398a62e4
2025-09-02 02:26:10 +00:00
Adithya R
863fce3d24 dolby: Revert "Re-enable speaker virtualization after bootup"
No longer necessary

Change-Id: Iac820eafa71ea3e4ccaad2bfa0fb76c37279a22a
2025-09-02 02:26:10 +00:00
Adithya R
5ab1d968be dolby: Introduce Dolby Atmos
Moved from marble/sm8450-common

History:

commit 82fe03168c0402e4cb10d25859c3b398c0ef654a
Author: Adithya R <gh0strider.2k18.reborn@gmail.com>
Date:   Thu Mar 21 21:35:36 2024 +0530

    marble: 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 c4400bd1326f65aeac1d0f26bb830ce7fd079773
Author: Adithya R <gh0strider.2k18.reborn@gmail.com>
Date:   Fri Feb 2 09:29:08 2024 +0530

    marble: parts/keyhandler: Guard debug logging

    Change-Id: I246941f26cd1f71b696eb3c996794c9baa5dbc00

commit f11b70a98a11d0b89673d73002996aed9f11fbd7
Author: Adithya R <gh0strider.2k18.reborn@gmail.com>
Date:   Sun Dec 31 20:36:52 2023 +0530

    marble: 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.

commit abcff4fb947c89b69c1d25bd290fd91b7873af6a
Author: Adithya R <gh0strider.2k18.reborn@gmail.com>
Date:   Fri Oct 20 06:49:19 2023 +0530

    marble: parts: Implement profile-specific Dolby settings

    Some refactoring and cleanup while we're at it.

commit dc54f9ddeff212d017b0cba16e56516e99335bb3
Author: Adithya R <gh0strider.2k18.reborn@gmail.com>
Date:   Mon Oct 9 21:58:58 2023 +0530

    marble: 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

commit dd2acc8e0c10d05f86ff229412cc9f72ea242b44
Author: Adithya R <gh0strider.2k18.reborn@gmail.com>
Date:   Wed Sep 13 21:41:20 2023 +0530

    marble: parts: Set proper summary for dolby settings

    Show the current status in Settings > Sound as well as the QS tile.

commit 92d341ba3d22f323eded525487db4289d6edc0fe
Author: Fabian Leutenegger <fabian.leutenegger@bluewin.ch>
Date:   Fri Aug 25 10:26:53 2023 +0200

    marble: parts: Always refresh playback if status changed

     * otherwise dolby would stay active even if you disable its setting

    Change-Id: If59d8081fa12da2aa67e5149db97965c0805d76e

commit b1944744649b6fddcb7bc3864b92f298b6e78821
Author: Adithya R <gh0strider.2k18.reborn@gmail.com>
Date:   Mon Aug 21 13:21:18 2023 +0530

    marble: 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: I79841c045fe7b92c438177916f756faab72ff0e9
2025-09-02 02:26:10 +00:00
swiitchOFF
1d06c0bd9d dolby: Yeet Motorola Dolby Interface 2025-09-02 02:25:32 +00:00
swiitchOFF
708a47bda4 dolby: Update readme 2025-08-31 04:31:31 +00:00
New Author Name
892caadbe7 dolby: Switch to AOSPA Dolby Atmos
* Based on Paranoid Android Vauxite (7) [03/08/2025]

Co-Authored-By: Adithya R <gh0strider.2k18.reborn@gmail.com>
Signed-off-by: swiitchOFF <120115258+swiitchOFF@users.noreply.github.com>
2025-08-31 04:31:06 +00:00
swiitchOFF
e7dbf443a2 dolby: Update readme 2025-08-31 08:49:41 +05:30
someone5678
6b1bb6b1e8 dolby: Create missing dolby related directory 2025-08-31 08:49:41 +05:30
keosh
0475f7ef37 FCM: moved to dt to fix kernel target issue 2025-08-29 20:27:43 +05:30
pabloescobar-reborn
0e837f8e94 Revert "dolby: Implement DSPVolumeSynchronizer"
This reverts commit 23662b74ac.
2025-08-28 15:52:17 +00:00
Pabloescobar-reborn
263ba11385 dolby: Rework on dax-default 2025-08-28 21:12:21 +05:30
swiitchOFF
54da022d03 dolby: configs: Rework on dax-default
* It's 😍 on my device and I'm use too with it xD
* From e8daa705f0c0cc3e59da9242e84d15cec8cd1d7d
2025-08-28 09:41:03 +00:00
swiitchOFF
4f911ddffa dolby: Update MotoDolbyDax3.apk [White icon] 2025-08-28 09:41:03 +00:00
swiitchOFF
a4f8660263 dolby: Patch vendor.dolby.media.c2@1.0-service with libshim_dolby
08-25 13:26:29.598  1006  1006 F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 1006 (vendor.dolby.me), pid 1006 (vendor.dolby.me)
08-25 13:26:29.731  3084  3084 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
08-25 13:26:29.731  3084  3084 F DEBUG   : crDroid Version: '11.8'
08-25 13:26:29.731  3084  3084 F DEBUG   : Build fingerprint: 'Xiaomi/vili/vili:14/UKQ1.231207.002/V816.0.10.0.UKDMIXM:user/release-keys'
08-25 13:26:29.731  3084  3084 F DEBUG   : Revision: '0'
08-25 13:26:29.731  3084  3084 F DEBUG   : ABI: 'arm64'
08-25 13:26:29.731  3084  3084 F DEBUG   : Timestamp: 2025-08-25 13:26:29.665897496+0530
08-25 13:26:29.731  3084  3084 F DEBUG   : Process uptime: 10s
08-25 13:26:29.731  3084  3084 F DEBUG   : Cmdline: /vendor/bin/hw/vendor.dolby.media.c2@1.0-service
08-25 13:26:29.731  3084  3084 F DEBUG   : pid: 1006, tid: 1006, name: vendor.dolby.me  >>> /vendor/bin/hw/vendor.dolby.media.c2@1.0-service <<<
08-25 13:26:29.731  3084  3084 F DEBUG   : uid: 1046
08-25 13:26:29.731  3084  3084 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0000000000000000
08-25 13:26:29.731  3084  3084 F DEBUG   : Cause: null pointer dereference
08-25 13:26:29.731  3084  3084 F DEBUG   :     x0  b400006f05b52fc0  x1  0000007fc905ed10  x2  0000006f45b59a90  x3  0000007fc905ecd8
08-25 13:26:29.731  3084  3084 F DEBUG   :     x4  0000000000000028  x5  0200006ef5b52470  x6  0000000000000000  x7  0000000000000000
08-25 13:26:29.731  3084  3084 F DEBUG   :     x8  00000000ffffffff  x9  00000000eff00000  x10 0000006fe69e4fa4  x11 0000000012b97fad
08-25 13:26:29.731  3084  3084 F DEBUG   :     x12 0000000000028003  x13 b400006ef5b528e0  x14 0000000000000024  x15 000000000000005f
08-25 13:26:29.731  3084  3084 F DEBUG   :     x16 0000006fe5ebd230  x17 0000006fede1ca84  x18 0000006fef730000  x19 0000000000000000
08-25 13:26:29.731  3084  3084 F DEBUG   :     x20 b400006f05b52eb0  x21 0000006d55852090  x22 0000006fef2fff00  x23 0000000000000000
08-25 13:26:29.731  3084  3084 F DEBUG   :     x24 0000006fef2fff00  x25 b400006d55b59140  x26 0000000000000001  x27 0000000000000000
08-25 13:26:29.731  3084  3084 F DEBUG   :     x28 0000000000000000  x29 0000007fc905ece0
08-25 13:26:29.731  3084  3084 F DEBUG   :     lr  0000006fe5e915f4  sp  0000007fc905ece0  pc  0000006fede1caa0  pst 0000000080001000
08-25 13:26:29.731  3084  3084 F DEBUG   : 7 total frames
08-25 13:26:29.731  3084  3084 F DEBUG   : backtrace:
08-25 13:26:29.731  3084  3084 F DEBUG   :       #00 pc 0000000000010aa0  /vendor/lib64/libutils.so (android::RefBase::decStrong(void const*) const+28) (BuildId: 2fd112063e39cb6f651b185f9e6234f2)
08-25 13:26:29.731  3084  3084 F DEBUG   :       #01 pc 00000000000515f0  /vendor/lib64/android.hardware.media.c2@1.0.so (android::hardware::media::c2::V1_0::BnHwComponentStore::_hidl_createInterface(android::hidl::base::V1_0::BnHwBase*, android::hardware::Parcel const&, android::hardware::Parcel*, std::__1::function<void (android::hardware::Parcel&)>)+376) (BuildId: f0d25f49428387d313920490e7ec7c8c)
08-25 13:26:29.731  3084  3084 F DEBUG   :       #02 pc 00000000000525f0  /vendor/lib64/android.hardware.media.c2@1.0.so (android::hardware::media::c2::V1_0::BnHwComponentStore::onTransact(unsigned int, android::hardware::Parcel const&, android::hardware::Parcel*, unsigned int, std::__1::function<void (android::hardware::Parcel&)>)+1004) (BuildId: f0d25f49428387d313920490e7ec7c8c)
08-25 13:26:29.731  3084  3084 F DEBUG   :       #03 pc 000000000008ab7c  /vendor/lib64/libhidlbase.so (android::hardware::BHwBinder::transact(unsigned int, android::hardware::Parcel const&, android::hardware::Parcel*, unsigned int, std::__1::function<void (android::hardware::Parcel&)>)+92) (BuildId: 1d845c84de7e27fc2c78f04ee8f4aae0)
08-25 13:26:29.731  3084  3084 F DEBUG   :       #04 pc 0000000000042eac  /vendor/lib64/libhidlbase.so (android::hardware::IPCThreadState::joinThreadPool(bool)+1344) (BuildId: 1d845c84de7e27fc2c78f04ee8f4aae0)
08-25 13:26:29.731  3084  3084 F DEBUG   :       #05 pc 000000000000124c  /vendor/bin/hw/vendor.dolby.media.c2@1.0-service (main+500) (BuildId: 394e52c5b5064b9f64c91bd2d615f078)
08-25 13:26:29.731  3084  3084 F DEBUG   :       #06 pc 0000000000055160  /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+116) (BuildId: b310372d5ddccd24fca9f3a465bff80c)

Co-Authored-By: ZiadTamer <ziadtamer150@gmail.com>
Signed-off-by: swiitchOFF <120115258+swiitchOFF@users.noreply.github.com>
2025-08-28 09:41:03 +00:00
swiitchOFF
187c0074e1 dolby: configs: Enable ac4
* Sony Dolby Atmos have working ac4 on Tidal/Hotstar
2025-08-28 09:41:03 +00:00
swiitchOFF
6b8b7bcae4 dolby: Update readme 2025-08-28 09:41:03 +00:00
swiitchOFF
e2df31f5b8 dolby: Enable ELF checks for libspatialaudio 2025-08-28 09:41:03 +00:00
New Author Name
10d3ac30f4 dolby: Link dolby blobs against v33 libstagefright_foundation
* fixes crashes and absurdly high CPU usage while using dolby

Co-authored-by: Woomymy <woomy@woomy.be>
2025-08-28 09:41:03 +00:00
swiitchOFF
0ea2536cf8 dolby: configs: Kang dax-default from https://github.com/reiryuki/Dolby-Atmos-Spatial-Sound-Moto-Edge-30-Ultra-Magisk-Module 2025-08-28 09:41:03 +00:00
swiitchOFF
8995c02d2d dolby: Kang daxService.apk and MotoDolbyDax3.apk
* From https://t.me/AMRGAMAL_STORE/5508
2025-08-28 09:41:02 +00:00
New Author Name
1c967d1859 dolby: permissions: Kang privapp-com.motorola.dolby.dolbyui.xml 2025-08-28 09:41:02 +00:00
swiitchOFF
82e51d2309 dolby: Switch to Motorola Dolby Interface
* kang from https://github.com/swiitch-OFF-Lab/hardware_dolby/tree/A14-moto
2025-08-28 09:41:02 +00:00
swiitchOFF
ee2f65b964 dolby: Enable elf checks
* Properly link dolby libs against v33 libstagefright_foundation
2025-03-26 06:33:10 +05:30
New Author Name
3c550064a0 dolby: configs: Kang dax-default from https://github.com/reiryuki/Dolby-Atmos-Sony-Xperia-5-V-Magisk-Module 2025-03-25 20:00:04 +05:30
swiitchOFF
56dc82a0a8 dolby: Switch to Sony Dolby Interface
* Taken from https://github.com/reiryuki/Dolby-Atmos-Sony-Xperia-5-V-Magisk-Module
2025-03-12 18:46:39 +05:30
swiitchOFF
496446c564 dolby: Kill XiaomiDolby 2025-03-12 18:44:55 +05:30
New Author Name
a6202e7f90 dolby: Switch to Sony Dolby Atmos
* Based on c2 audio decoders

Co-Authored-By: Saku <saku-bruh@proton.me>
Co-Authored-By: ahnet-69 <syedmusicrealise@gmail.com>
Co-Authored-By: HELLBOY017 <abhaygill017@gmail.com>
Signed-off-by: swiitchOFF <120115258+swiitchOFF@users.noreply.github.com>
2025-03-12 18:44:06 +05:30
New Author Name
00d74c76bc dolby: Apply NLSound 4.1
Ref:
https://github.com/Briclyaz/NLSound_module_QCom

Applied with slight modification:
sed -i 's/<mi-dv-leveler-steering-enable value="true"/<mi-dv-leveler-steering-enable value="false"/g' dax-default.xml
sed -i 's/<mi-ieq-steering-enable value="true"/<mi-ieq-steering-enable value="false"/g' dax-default.xml
sed -i 's/<mi-surround-compressor-steering-enable value="true"/<mi-surround-compressor-steering-enable value="false"/g' dax-default.xml
sed -i 's/<mi-adaptive-virtualizer-steering-enable value="true"/<mi-adaptive-virtualizer-steering-enable value="false"/g' dax-default.xml
sed -i 's/<reverb-suppression-enable value="true"/<reverb-suppression-enable value="false"/g' dax-default.xml
sed -i 's/<mi-dialog-enhancer-steering-enable value="true"/<mi-dialog-enhancer-steering-enable value="false"/g' dax-default.xml
sed -i 's/<dialog-enhancer-enable value="true"/<dialog-enhancer-enable value="false"/g' dax-default.xml
sed -i 's/<mi-virtualizer-binaural-steering-enable value="true"/<mi-virtualizer-binaural-steering-enable value="false"/g' dax-default.xml
sed -i 's/<peak-value value=".*"/<peak-value value="256"/g' dax-default.xml
sed -i 's/<surround-decoder-enable value="true"/<surround-decoder-enable value="false"/g' dax-default.xml
sed -i 's/<hearing-protection-enable value="true"/<hearing-protection-enable value="false"/g' dax-default.xml
sed -i 's/<volume-leveler-enable value="true"/<volume-leveler-enable value="false"/g' dax-default.xml
sed -i 's/<height-filter-mode value=".*"/<height-filter-mode value="0"/g' dax-default.xml
sed -i 's/<volume-leveler-compressor-enable value="true"/<volume-leveler-compressor-enable value="false"/g' dax-default.xml
sed -i 's/<complex-equalizer-enable value="true"/<complex-equalizer-enable value="false"/g' dax-default.xml
sed -i 's/<regulator-enable value="true"/<volume-leveler-enable value="false"/g' dax-default.xml
sed -i 's/<regulator-speaker-dist-enable value="true"/<regulator-speaker-dist-enable value="false"/g' dax-default.xml
sed -i 's/<regulator-sibilance-suppress-enable value="true"/<regulator-sibilance-suppress-enable value="false"/g' dax-default.xml
sed -i 's/bass-mbdrc-enable value="true"/bass-mbdrc-enable value="false"/g' dax-default.xml
sed -i 's/threshold_low=".*" threshold_high=".*"/threshold_low="0" threshold_high="0"/g' dax-default.xml
sed -i 's/isolated_band="true"/isolated_band="false"/g' dax-default.xml
sed -i '/endpoint_type="headphone"/,/<\/tuning>/s/<audio-optimizer-enable value="true"/<audio-optimizer-enable value="false"/g' dax-default.xml
sed -i '/<output-mode>/,/<\/output-mode>/d' dax-default.xml
sed -i '/<mix_matrix>/,/<\/output-mode>/d' dax-default.xml

Change-Id: I7d699d38d602abda322b414bdd718857a0bbaaa8
2025-01-29 03:49:45 +05:30
Alcatraz323
23662b74ac dolby: Implement DSPVolumeSynchronizer
Some Xiaomi devices have a speaker that needs a framework to cooperate
with DSP to synchronize volume so that the DSP can limit bass when the
volume is high to prevent distortion.

Change-Id: I750803d94161e1e7482552d2a39566f42e82fc0a
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
2025-01-23 04:50:45 +05:30
Pranav Vashi
65d7336949 dolby: Exempt installing package in clone or private space
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
2025-01-08 06:13:35 +05:30
New Author Name
0befa6aa8c dolby: Update profiles overlay for moto dolby
Change-Id: Ided92625cb73f530656e86929b3ba70fea1e940d
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
2024-12-27 19:30:37 +05:30
New Author Name
6d89341732 dolby: XiaomiDolby: Make bass enhancer available on speakers as well
Signed-off-by: Abhay Singh Gill <abhaygill017@gmail.com>
2024-12-26 15:22:45 +05:30
swiitchOFF
f5fb608d13 dolby: Feels better
[1]: cleanup and organize
[2]: using patched blobs from here 40faff25cd
2024-12-26 15:22:08 +05:30
swiitchOFF
6cc95d2a09 dolby: Update Credits 2024-12-09 22:12:54 +05:30
New Author Name
048d3bfbe3 dolby: Initialized Spatial Audio
Signed-off-by: userariii <abhattacharjee717@gmail.com>
Signed-off-by: swiitchOFF <120115258+swiitchOFF@users.noreply.github.com>
2024-12-06 12:32:59 +05:30
swiitchOFF
fac9089afd dolby: Sorry LDAC & LHDC
mistake beef2e28a1
2024-12-06 12:32:53 +05:30
swiitchOFF
724f607cb8 dolby: configs: Switch back to CN dax-default
[1]: Also Forcefully disable volume leveler
2024-12-03 05:39:47 +05:30
johnmart19
da758a7873 dolby: configs: Enable bass-enhancer for Headphones, Speakers, and "Other" devices
Original commit:
d6e99e9cd1

Change-Id: If32d0e1c2ddad5d8668c83bfbfcd04c36fa80552
Signed-off-by: someone5678 <nemui3353@gmail.com>
2024-11-25 19:20:34 +05:30
New Author Name
a54c599e2b dolby: configs: Forcefully disable volume leveler
sed -i "/volume-leveler-enable/ s/true/false/g" configs/audio/dax-default.xml

Change-Id: I7ceb29291a9e55036d57975f5a28a149c7fcb435
2024-11-25 17:31:31 +05:30
New Author Name
9c8b952778 dolby: Replace nuwa libs with Moto
* Also Kill nuwa Dolby spatial audio support
2024-11-25 17:31:09 +05:30
New Author Name
9bce0718c3 dolby: overlay: Add empty Dolby specific frameworks overlay 2024-11-24 13:52:15 +05:30
New Author Name
4401819065 dolby: Update readme 2024-11-22 01:05:46 +05:30
New Author Name
6fe60d867d dolby: Update from nuwa V14.0.9.0.UMBEUXM
* Also Import 32-bit blobs
2024-11-22 01:05:32 +05:30
Mudit200408
beef2e28a1 dolby: Add LDAC & LHDC codecs
* I know it's Placebo xD
2024-11-19 23:47:29 +05:30
Sarthak Roy
efb871f672 dolby: DolbyManager: Fix building in Android 15
Change-Id: Ie4e312bce0232c7a55ed2c29c8442f886f5aabd9
2024-11-09 19:24:26 +05:30
New Author Name
1f2bc3d255 dolby: Switch to XiaomiDolby
Based on hardware/xiaomi

History -
- Enable TARGET_USES_DOLBY
- Add intelligent equalizer setting
- Remove deprecated PlainTooltipBox
- Introduce graphical equalizer
- Add launcher icon
- fixup! Restore all settings upon bootup
- Override AudioFx
- Use all shared resources from devicesettings
- Fix build with kotlinc 1.9.0
- Restore current profile _after_ resetting profiles
- Do not set volume leveler amount
- Restore all settings upon bootup
- Rewrite in Kotlin
- Revert "Re-enable speaker virtualization after bootup"
- Convert to SwitchPreferenceCompat
- Migrate to CompoundButton.OnCheckedChangeListener
- Enable use_resource_processor for all sysui deps
- Introduce Dolby Atmos

Co-authored-by: Henrique Silva <jhenrique09.mcz@hotmail.com>
Co-authored-by: Pranav Vashi <neobuddy89@gmail.com>
Co-authored-by: Fabian Leutenegger <fabian.leutenegger@bluewin.ch>
Co-authored-by: basamaryan <basam.aryan@gmail.com>
2024-10-28 13:33:07 +05:30
Abhay Singh Gill
7870b8a0c7 dolby: Remove owner from soong modules
* also kill OnePlus DaxUI

Signed-off-by: Abhay Singh Gill <abhaygill017@gmail.com>
2024-10-28 13:32:36 +05:30
New Author Name
6ad0f598e9 dolby: Add dolby volume listener 2024-10-24 18:41:42 +05:30
New Author Name
174e52ec51 dolby: Add support for Dolby spatial audio 2024-10-24 18:41:34 +05:30
New Author Name
881bb90ebe dolby: Build some libs for QPR3 2024-10-24 13:01:00 +05:30
swiitchOFF
3fa57e3935 dolby: update from MIUI CN 14 2024-10-24 13:00:54 +05:30
swiitchOFF
07b0a125fd dolby: Update readme 2024-03-16 18:58:29 +05:30
New Author Name
fe709e060d dolby: update dax-default from stock
* Extract From vili-user 13 TKQ1.220829.002 V14.0.16.0.TKDEUXM release-keys
2024-03-16 18:48:10 +05:30
Lunarixus
e96e8c76fd dolby: Add Remove Packages for Dolby Environment 2024-03-16 09:38:34 +05:30
Abhay Singh Gill
31843fb4e7 dolby: DaxUI: Fix clipped dialogue enhancer seekbar thumb 2024-03-16 01:33:37 +05:30
New Author Name
f167291caf dolby: Link dolby blobs against v33 libstagefright_foundation
* fixes crashes and absurdly high CPU usage while using dolby

Co-authored-by: Woomymy <woomy@woomy.be>
2024-03-16 01:32:39 +05:30
swiitchOFF
773b6cba9e dolby: Import vili blobs
* Extract From vili-user 13 TKQ1.220829.002 V14.0.16.0.TKDEUXM release-keys
2024-03-16 01:23:06 +05:30
swiitchOFF
04bec17707 dolby: cleanup for Re-Base 2024-03-16 01:12:21 +05:30
swiitchOFF
a952ccb07b dolby: oneplus>xiaomi 2024-03-15 14:06:50 +05:30
Abhay Singh Gill
d2d27807cc dolby: Add path variable 2024-03-15 14:02:46 +05:30
Abhay Singh Gill
667b4721be dolby: Update readme 2024-03-15 14:02:41 +05:30
Abhay Singh Gill
258557eec9 dolby: DaxUI: Add more switches
For:-
• volume leveler
• surround virtualizer
• bass enhancer

Signed-off-by: Abhay Singh Gill <abhaygill017@gmail.com>
2024-03-15 14:02:31 +05:30
111 changed files with 4522 additions and 960 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.vscode/

View File

@@ -15,26 +15,299 @@
soong_namespace {
}
android_app_import {
name: "daxService",
owner: "oneplus",
apk: "proprietary/system_ext/priv-app/daxService/daxService.apk",
certificate: "platform",
dex_preopt: {
enabled: false,
cc_prebuilt_library_shared {
name: "libdapparamstorage",
owner: "xiaomi",
strip: {
none: true,
},
privileged: true,
system_ext_specific: true,
target: {
android_arm64: {
srcs: ["proprietary/vendor/lib64/libdapparamstorage.so"],
shared_libs: ["libcutils", "libutils", "liblog", "libc++", "libc", "libm", "libdl", ],
},
},
compile_multilib: "64",
prefer: true,
soc_specific: true,
}
android_app_import {
name: "DaxUI",
owner: "oneplus",
apk: "proprietary/system_ext/priv-app/DaxUI/DaxUI.apk",
certificate: "platform",
dex_preopt: {
enabled: false,
cc_prebuilt_library_shared {
name: "libdlbdsservice",
owner: "xiaomi",
strip: {
none: true,
},
privileged: true,
system_ext_specific: true,
target: {
android_arm64: {
srcs: ["proprietary/vendor/lib64/libdlbdsservice.so"],
shared_libs: ["libutils", "libcutils", "libstagefright_foundation-v33", "liblog", "libxml2", "libcrypto", "libdapparamstorage", "libsqlite", "libhidlbase", "vendor.dolby.hardware.dms@2.0", "libc++", "libc", "libm", "libdl", ],
},
},
compile_multilib: "64",
prefer: true,
soc_specific: true,
}
cc_prebuilt_library_shared {
name: "libdlbpreg",
owner: "xiaomi",
strip: {
none: true,
},
target: {
android_arm64: {
srcs: ["proprietary/vendor/lib64/libdlbpreg.so"],
shared_libs: ["liblog", "libutils", "libcutils", "libaudioutils", "libstagefright_foundation-v33", "libc++", "libc", "libm", "libdl", ],
},
},
compile_multilib: "64",
prefer: true,
soc_specific: true,
}
cc_prebuilt_library_shared {
name: "libspatializerparamstorage",
owner: "xiaomi",
strip: {
none: true,
},
target: {
android_arm64: {
srcs: ["proprietary/vendor/lib64/libspatializerparamstorage.so"],
shared_libs: ["libcutils", "libutils", "liblog", "libxml2", "libdapparamstorage", "libc++", "libc", "libm", "libdl", ],
},
},
compile_multilib: "64",
prefer: true,
soc_specific: true,
}
cc_prebuilt_library_shared {
name: "vendor.dolby.hardware.dms@2.0-impl",
owner: "xiaomi",
strip: {
none: true,
},
target: {
android_arm64: {
srcs: ["proprietary/vendor/lib64/vendor.dolby.hardware.dms@2.0-impl.so"],
shared_libs: ["libhidlbase", "libutils", "liblog", "libdapparamstorage", "libdlbdsservice", "vendor.dolby.hardware.dms@2.0", "libc++", "libc", "libm", "libdl", ],
},
},
compile_multilib: "64",
prefer: true,
soc_specific: true,
}
cc_prebuilt_library_shared {
name: "vendor.dolby.hardware.dms@2.0",
owner: "xiaomi",
strip: {
none: true,
},
target: {
android_arm64: {
srcs: ["proprietary/vendor/lib64/vendor.dolby.hardware.dms@2.0.so"],
shared_libs: ["libhidlbase", "liblog", "libutils", "libcutils", "libc++", "libc", "libm", "libdl", ],
},
},
compile_multilib: "64",
prefer: true,
soc_specific: true,
}
cc_prebuilt_binary {
name: "vendor.dolby.hardware.dms@2.0-service",
owner: "xiaomi",
target: {
android_arm64: {
srcs: ["proprietary/vendor/bin/hw/vendor.dolby.hardware.dms@2.0-service"],
shared_libs: ["liblog", "libutils", "libhidlbase", "libdapparamstorage", "libdlbdsservice", "vendor.dolby.hardware.dms@2.0", "vendor.dolby.hardware.dms@2.0-impl", "libc++", "libc", "libm", "libdl", ],
},
},
compile_multilib: "64",
strip: {
none: true,
},
prefer: true,
relative_install_path: "hw",
soc_specific: true,
}
cc_prebuilt_library_shared {
name: "libcodec2_soft_ac4dec",
owner: "xiaomi",
strip: {
none: true,
},
target: {
android_arm64: {
srcs: ["proprietary/vendor/lib64/libcodec2_soft_ac4dec.so"],
shared_libs: ["libhidlbase", "vendor.dolby.hardware.dms@2.0", "libdeccfg", "libbase", "libcodec2", "libcodec2_vndk", "libutils", "libcodec2_soft_common", "libcutils", "liblog", "libsfplugin_ccodec_utils", "libstagefright_foundation-v33", "libcodec2_store_dolby", "libc++", "libc", "libm", "libdl", ],
},
},
compile_multilib: "64",
prefer: true,
soc_specific: true,
}
cc_prebuilt_library_shared {
name: "libcodec2_soft_ddpdec",
owner: "xiaomi",
strip: {
none: true,
},
target: {
android_arm64: {
srcs: ["proprietary/vendor/lib64/libcodec2_soft_ddpdec.so"],
shared_libs: ["libhidlbase", "vendor.dolby.hardware.dms@2.0", "libdeccfg", "libbase", "libcodec2", "libcodec2_vndk", "libutils", "libcodec2_soft_common", "libcutils", "liblog", "libsfplugin_ccodec_utils", "libstagefright_foundation-v33", "libcodec2_store_dolby", "libc++", "libc", "libm", "libdl", ],
},
},
compile_multilib: "64",
prefer: true,
soc_specific: true,
}
cc_prebuilt_library_shared {
name: "libcodec2_store_dolby",
owner: "xiaomi",
strip: {
none: true,
},
target: {
android_arm64: {
srcs: ["proprietary/vendor/lib64/libcodec2_store_dolby.so"],
shared_libs: ["libdmabufheap", "libbase", "liblog", "libcodec2", "libcodec2_vndk", "libutils", "libc++", "libc", "libm", "libdl", ],
},
},
compile_multilib: "64",
prefer: true,
soc_specific: true,
}
cc_prebuilt_library_shared {
name: "libdeccfg",
owner: "xiaomi",
strip: {
none: true,
},
target: {
android_arm64: {
srcs: ["proprietary/vendor/lib64/libdeccfg.so"],
shared_libs: ["libhidlbase", "vendor.dolby.hardware.dms@2.0", "libdapparamstorage", "libcutils", "libutils", "liblog", "libc++", "libc", "libm", "libdl", ],
},
},
compile_multilib: "64",
prefer: true,
soc_specific: true,
}
cc_prebuilt_binary {
name: "vendor.dolby.media.c2@1.0-service",
owner: "xiaomi",
target: {
android_arm64: {
srcs: ["proprietary/vendor/bin/hw/vendor.dolby.media.c2@1.0-service"],
shared_libs: ["libbase", "liblog", "libcodec2", "libutils", "android.hardware.media.c2@1.0", "android.hardware.media.c2@1.1", "android.hardware.media.c2@1.2", "libcodec2_hidl@1.0", "libcodec2_hidl@1.1", "libcodec2_hidl@1.2", "libcodec2_vndk", "libhidlbase", "libavservices_minijail", "libbinder", "libcodec2_store_dolby", "libc++", "libc", "libm", "libdl", ],
},
},
compile_multilib: "64",
strip: {
none: true,
},
prefer: true,
relative_install_path: "hw",
soc_specific: true,
}
cc_prebuilt_library_shared {
name: "libdlbvol",
owner: "xiaomi",
strip: {
none: true,
},
target: {
android_arm64: {
srcs: ["proprietary/vendor/lib64/soundfx/libdlbvol.so"],
shared_libs: ["liblog", "libutils", "libcutils", "libaudioutils", "libstagefright_foundation-v33", "libdlbpreg", "vendor.dolby.hardware.dms@2.0", "libc++", "libc", "libm", "libdl", ],
},
},
compile_multilib: "64",
relative_install_path: "soundfx",
prefer: true,
soc_specific: true,
}
cc_prebuilt_library_shared {
name: "libhwdap",
owner: "xiaomi",
strip: {
none: true,
},
target: {
android_arm64: {
srcs: ["proprietary/vendor/lib64/soundfx/libhwdap.so"],
shared_libs: ["libspatializerparamstorage", "liblog", "libutils", "libcutils", "libaudioutils", "libdapparamstorage", "libhidlbase", "libdlbpreg", "vendor.dolby.hardware.dms@2.0", "libstagefright_foundation-v33", "libc++", "libc", "libm", "libdl", ],
},
},
compile_multilib: "64",
relative_install_path: "soundfx",
prefer: true,
soc_specific: true,
}
cc_prebuilt_library_shared {
name: "libswgamedap",
owner: "xiaomi",
strip: {
none: true,
},
target: {
android_arm64: {
srcs: ["proprietary/vendor/lib64/soundfx/libswgamedap.so"],
shared_libs: ["libspatializerparamstorage", "liblog", "libutils", "libcutils", "libaudioutils", "libdapparamstorage", "libhidlbase", "vendor.dolby.hardware.dms@2.0", "libc++", "libc", "libm", "libdl", ],
},
},
compile_multilib: "64",
relative_install_path: "soundfx",
prefer: true,
soc_specific: true,
}
cc_prebuilt_library_shared {
name: "libswspatializer",
owner: "xiaomi",
strip: {
none: true,
},
target: {
android_arm64: {
srcs: ["proprietary/vendor/lib64/soundfx/libswspatializer.so"],
shared_libs: ["liblog", "libutils", "libcutils", "libaudioutils", "libdapparamstorage", "libspatializerparamstorage", "libhidlbase", "libstagefright_foundation-v33", "libdlbpreg", "vendor.dolby.hardware.dms@2.0", "libc++", "libc", "libm", "libdl", ],
},
},
compile_multilib: "64",
relative_install_path: "soundfx",
prefer: true,
soc_specific: true,
}
cc_prebuilt_library_shared {
name: "libswvqe",
owner: "xiaomi",
strip: {
none: true,
},
target: {
android_arm64: {
srcs: ["proprietary/vendor/lib64/soundfx/libswvqe.so"],
shared_libs: ["libspatializerparamstorage", "liblog", "libutils", "libcutils", "libaudioutils", "libdapparamstorage", "libhidlbase", "vendor.dolby.hardware.dms@2.0", "libc++", "libc", "libm", "libdl", ],
},
},
compile_multilib: "64",
relative_install_path: "soundfx",
prefer: true,
soc_specific: true,
}

View File

@@ -1,9 +1,9 @@
OnePlus Dolby
AOSPA Dolby
==============
Getting Started
---------------
Make sure you are not using any audio effect configuration in your device trees. Also for dolby media codecs to work add this line in your media codecs config (should be in vendor partition) :-
For dolby media codecs to work add this line in your media codecs config (should be in vendor partition) :-
```bash
<Include href="media_codecs_dolby_audio.xml" />
@@ -15,3 +15,47 @@ To build, add the dolby effects in your device's audio effects config then inher
$(call inherit-product, hardware/dolby/dolby.mk)
```
Now, moving hidl definitions in manifest to device trees is completely absurd so stop overriding manifest in your device trees an example for such would be :-
Changing these in BoardConfig makefile of your device tree:-
```bash
DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE :=
```
And
```bash
DEVICE_MANIFEST_FILE :=
```
To:-
```bash
DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE +=
```
And
```bash
DEVICE_MANIFEST_FILE +=
```
The only change done above is changing := symbol to += so that manifest can't be overriden from device tree in BoardConfig makefile.
At the end an example commit to properly implement it in your device tree could be :-
[**1**] https://github.com/Spanish-or-Vanish/android_device_xiaomi_sm8350-common/commit/8ece9a976087ed03f1adb447d0ac2a3f5f1a0d3c
[**2**] https://github.com/Spanish-or-Vanish/android_device_xiaomi_sm8350-common/commit/2bdd047bfb5f23bd02e6d4db601a97c27e1506f9
#### Tip pick anyone for Reference:
https://dumps.tadiphone.dev/dumps/xiaomi/vili/-/blob/missi_phone_global-user-14-UKQ1.231207.002-V816.0.5.0.UKDMIXM-release-keys/aosp-device-tree/proprietary-files.txt#L2072
https://github.com/Spanish-or-Vanish/android_device_xiaomi_sm8350-common/commit/6a8f6aae347f9f864f17f2dfa5d541f83ab5b170
https://github.com/Spanish-or-Vanish/android_device_xiaomi_sm8350-common/commit/5c593cbd2c19d571b7e62ea4bd6b8c864a4e1d9e
# Credits:
* [**HELLBOY017**](https://github.com/HELLBOY017)
* [**adithya2306**](https://github.com/adithya2306)
* [**johnmart19**](https://github.com/johnmart19)
* [**userariii**](https://github.com/userariii)
* [**saku-bruh**](https://github.com/saku-bruh)
* [**ahnet-69 · he/him**](https://github.com/ahnet-69)

View File

@@ -0,0 +1,10 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := RemovePackagesDolby
LOCAL_MODULE_CLASS := APPS
LOCAL_MODULE_TAGS := optional
LOCAL_OVERRIDES_PACKAGES += Music MusicFX AudioFX
LOCAL_UNINSTALLABLE_MODULE := true
LOCAL_CERTIFICATE := PRESIGNED
LOCAL_SRC_FILES := /dev/null
include $(BUILD_PREBUILT)

View File

@@ -0,0 +1,20 @@
<?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.
-->
<!-- Feature for devices with a head tracker sensor. -->
<permissions>
<feature name="android.hardware.sensor.dynamic.head_tracker" />
</permissions>

1840
configs/dax-default.xml Executable file → Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,50 +1,48 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2016 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.
This file was modified by Dolby Laboratories, Inc. The portions of the
code that are surrounded by "DOLBY..." are copyrighted and
licensed separately, as follows:
(C) 2018 Dolby Laboratories, Inc.
All rights reserved.
This program is protected under international and U.S. Copyright laws as
This program is protected under international and U.S. copyright laws as
an unpublished work. This program is confidential and proprietary to the
copyright owners. Reproduction or disclosure, in whole or in part, or the
production of derivative works therefrom without the express permission of
the copyright owners is prohibited.
Copyright (C) 2020-2021 by Dolby Laboratories,
All rights reserved.
-->
<Included>
<Decoders>
<!-- DOLBY_UDC -->
<MediaCodec name="OMX.dolby.ac3.decoder" type="audio/ac3">
<Limit name="channel-count" max="6" />
<Limit name="sample-rate" ranges="32000,44100,48000" />
<Limit name="bitrate" range="32000-640000" />
</MediaCodec>
<MediaCodec name="OMX.dolby.eac3.decoder" type="audio/eac3">
<Limit name="channel-count" max="8" />
<Limit name="sample-rate" ranges="32000,44100,48000" />
<Limit name="bitrate" range="32000-6144000" />
</MediaCodec>
<MediaCodec name="OMX.dolby.eac3-joc.decoder" type="audio/eac3-joc">
<Limit name="channel-count" max="8" />
<Limit name="sample-rate" ranges="48000" />
<Limit name="bitrate" range="32000-6144000" />
<MediaCodec name="c2.dolby.eac3.decoder" >
<Type name="audio/ac3">
<Alias name="OMX.dolby.ac3.decoder" />
<Limit name="channel-count" max="6" />
<Limit name="sample-rate" ranges="32000,44100,48000" />
<Limit name="bitrate" range="32000-640000" />
</Type>
<Type name="audio/eac3">
<Alias name="OMX.dolby.eac3.decoder" />
<Limit name="channel-count" max="8" />
<Limit name="sample-rate" ranges="32000,44100,48000" />
<Limit name="bitrate" range="32000-6144000" />
</Type>
<Type name="audio/eac3-joc">
<Alias name="OMX.dolby.eac3-joc.decoder" />
<Limit name="channel-count" max="16" />
<Limit name="sample-rate" ranges="48000" />
<Limit name="bitrate" range="32000-6144000" />
</Type>
<Attribute name="software-codec" />
</MediaCodec>
<!-- DOLBY_UDC END -->
<!-- DOLBY_AC4 -->
<!-- <MediaCodec name="c2.dolby.ac4.decoder" type="audio/ac4">
<Alias name="OMX.dolby.ac4.decoder" />
<Limit name="channel-count" max="16" />
<Limit name="sample-rate" ranges="48000" />
<Limit name="bitrate" range="16000-2688000" />
</MediaCodec> -->
<!-- DOLBY_AC4 END -->
</Decoders>
</Included>

153
dolby.mk
View File

@@ -14,67 +14,118 @@
# limitations under the License.
#
# Dolby path
DOLBY_PATH := hardware/dolby
# Soong Namespace
PRODUCT_SOONG_NAMESPACES += \
hardware/dolby
$(DOLBY_PATH)
# Enable codec support
AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := true
# SEPolicy
BOARD_VENDOR_SEPOLICY_DIRS += hardware/dolby/sepolicy/vendor
# HIDL
DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE += hardware/dolby/dolby_framework_matrix.xml
DEVICE_MANIFEST_FILE += hardware/dolby/vendor.dolby.hardware.dms@2.0-service.xml
BOARD_VENDOR_SEPOLICY_DIRS += $(DOLBY_PATH)/sepolicy/vendor
# Configs
PRODUCT_COPY_FILES += \
hardware/dolby/configs/dax-default.xml:$(TARGET_COPY_OUT_VENDOR)/etc/dolby/dax-default.xml \
hardware/dolby/configs/media_codecs_dolby_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_dolby_audio.xml
$(DOLBY_PATH)/configs/dax-default.xml:$(TARGET_COPY_OUT_VENDOR)/etc/dolby/dax-default.xml \
$(DOLBY_PATH)/configs/media_codecs_dolby_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_dolby_audio.xml
# Dolby
PRODUCT_VENDOR_PROPERTIES += \
ro.vendor.dolby.dax.version=DAX3_3.6.0.12_r1 \
ro.vendor.product.device.db=OP_DEVICE \
ro.vendor.product.manufacturer.db=OP_PHONE \
vendor.product.device=OP_PHONE \
vendor.product.manufacturer=OPD
# DaxUI and daxService
# Dolby VNDK libs
PRODUCT_PACKAGES += \
DaxUI \
daxService
# Proprietary blobs
libstagefright_foundation-v33
PRODUCT_PACKAGES += \
libshim_dolby
# Init
PRODUCT_PACKAGES += \
init.dolby.rc
# Overlays
PRODUCT_PACKAGES += \
DolbyFrameworksResCommon
# Dolby Spatial Audio
PRODUCT_COPY_FILES += \
hardware/dolby/proprietary/system/lib64/vendor.dolby.hardware.dms@2.0.so:$(TARGET_COPY_OUT_SYSTEM)/lib64/vendor.dolby.hardware.dms@2.0.so \
hardware/dolby/proprietary/system_ext/etc/sysconfig/config-com.dolby.daxappui.xml:$(TARGET_COPY_OUT_SYSTEM_EXT)/etc/sysconfig/config-com.dolby.daxappui.xml \
hardware/dolby/proprietary/system_ext/etc/sysconfig/config-com.dolby.daxservice.xml:$(TARGET_COPY_OUT_SYSTEM_EXT)/etc/sysconfig/config-com.dolby.daxservice.xml \
hardware/dolby/proprietary/system_ext/etc/sysconfig/hiddenapi-com.dolby.daxservice.xml:$(TARGET_COPY_OUT_SYSTEM_EXT)/etc/sysconfig/hiddenapi-com.dolby.daxservice.xml \
hardware/dolby/proprietary/system_ext/etc/permissions/privapp-com.dolby.daxappui.xml:$(TARGET_COPY_OUT_SYSTEM_EXT)/etc/permissions/privapp-com.dolby.daxappui.xml \
hardware/dolby/proprietary/system_ext/etc/permissions/privapp-com.dolby.daxservice.xml:$(TARGET_COPY_OUT_SYSTEM_EXT)/etc/permissions/privapp-com.dolby.daxservice.xml \
hardware/dolby/proprietary/vendor/bin/hw/vendor.dolby.hardware.dms@2.0-service:$(TARGET_COPY_OUT_VENDOR)/bin/hw/vendor.dolby.hardware.dms@2.0-service \
hardware/dolby/proprietary/vendor/etc/init/vendor.dolby.hardware.dms@2.0-service.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/vendor.dolby.hardware.dms@2.0-service.rc \
hardware/dolby/proprietary/vendor/lib/libdapparamstorage.so:$(TARGET_COPY_OUT_VENDOR)/lib/libdapparamstorage.so \
hardware/dolby/proprietary/vendor/lib/libdeccfg.so:$(TARGET_COPY_OUT_VENDOR)/lib/libdeccfg.so \
hardware/dolby/proprietary/vendor/lib/libqtigef.so:$(TARGET_COPY_OUT_VENDOR)/lib/libqtigef.so \
hardware/dolby/proprietary/vendor/lib/libstagefright_soft_ddpdec.so:$(TARGET_COPY_OUT_VENDOR)/lib/libstagefright_soft_ddpdec.so \
hardware/dolby/proprietary/vendor/lib/libstagefrightdolby.so:$(TARGET_COPY_OUT_VENDOR)/lib/libstagefrightdolby.so \
hardware/dolby/proprietary/vendor/lib/soundfx/libeffectproxy.so:$(TARGET_COPY_OUT_VENDOR)/lib/soundfx/libeffectproxy.so \
hardware/dolby/proprietary/vendor/lib/soundfx/libhwdap.so:$(TARGET_COPY_OUT_VENDOR)/lib/soundfx/libhwdap.so \
hardware/dolby/proprietary/vendor/lib/soundfx/libswdap.so:$(TARGET_COPY_OUT_VENDOR)/lib/soundfx/libswdap.so \
hardware/dolby/proprietary/vendor/lib/soundfx/libswvqe.so:$(TARGET_COPY_OUT_VENDOR)/lib/soundfx/libswvqe.so \
hardware/dolby/proprietary/vendor/lib/vendor.dolby.hardware.dms@2.0.so:$(TARGET_COPY_OUT_VENDOR)/lib/vendor.dolby.hardware.dms@2.0.so \
hardware/dolby/proprietary/vendor/lib64/libdapparamstorage.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libdapparamstorage.so \
hardware/dolby/proprietary/vendor/lib64/libdeccfg.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libdeccfg.so \
hardware/dolby/proprietary/vendor/lib64/libqtigef.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libqtigef.so \
hardware/dolby/proprietary/vendor/lib64/libdlbdsservice.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libdlbdsservice.so \
hardware/dolby/proprietary/vendor/lib64/libstagefright_soft_ddpdec.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libstagefright_soft_ddpdec.so \
hardware/dolby/proprietary/vendor/lib64/libstagefrightdolby.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libstagefrightdolby.so \
hardware/dolby/proprietary/vendor/lib64/soundfx/libeffectproxy.so:$(TARGET_COPY_OUT_VENDOR)/lib64/soundfx/libeffectproxy.so \
hardware/dolby/proprietary/vendor/lib64/soundfx/libhwdap.so:$(TARGET_COPY_OUT_VENDOR)/lib64/soundfx/libhwdap.so \
hardware/dolby/proprietary/vendor/lib64/soundfx/libswdap.so:$(TARGET_COPY_OUT_VENDOR)/lib64/soundfx/libswdap.so \
hardware/dolby/proprietary/vendor/lib64/soundfx/libswvqe.so:$(TARGET_COPY_OUT_VENDOR)/lib64/soundfx/libswvqe.so \
hardware/dolby/proprietary/vendor/lib64/vendor.dolby.hardware.dms@2.0-impl.so:$(TARGET_COPY_OUT_VENDOR)/lib64/vendor.dolby.hardware.dms@2.0-impl.so \
hardware/dolby/proprietary/vendor/lib64/vendor.dolby.hardware.dms@2.0.so:$(TARGET_COPY_OUT_VENDOR)/lib64/vendor.dolby.hardware.dms@2.0.so
$(DOLBY_PATH)/configs/android.hardware.sensor.dynamic.head_tracker.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/android.hardware.sensor.dynamic.head_tracker.xml \
# Dolby Spatial Audio: optimize spatializer effect
PRODUCT_PROPERTY_OVERRIDES += \
audio.spatializer.effect.util_clamp_min=300
# Dolby Spatial Audio: declare use of spatial audio
PRODUCT_PROPERTY_OVERRIDES += \
ro.audio.spatializer_enabled=true \
ro.audio.headtracking_enabled=true \
ro.audio.spatializer_transaural_enabled_default=false \
persist.vendor.audio.spatializer.speaker_enabled=true \
# Dolby Spatial Audio Proprietary blobs
PRODUCT_PACKAGES += \
libspatializerparamstorage \
libswspatializer
# Media (C2)
PRODUCT_PACKAGES += \
android.hardware.media.c2@1.0.vendor \
android.hardware.media.c2@1.1.vendor \
android.hardware.media.c2@1.2.vendor \
libcodec2_hidl@1.2.vendor \
libsfplugin_ccodec_utils.vendor \
libcodec2_soft_common.vendor
# Codec2 Props
PRODUCT_VENDOR_PROPERTIES += \
vendor.audio.c2.preferred=true \
debug.c2.use_dmabufheaps=1 \
vendor.qc2audio.suspend.enabled=true \
vendor.qc2audio.per_frame.flac.dec.enabled=true
# Dolby Props
PRODUCT_VENDOR_PROPERTIES += \
ro.vendor.dolby.dax.version=DAX3_3.7.0.8_r1 \
vendor.audio.dolby.ds2.hardbypass=false \
vendor.audio.dolby.ds2.enabled=false
# Remove Packages for Dolby Support
PRODUCT_PACKAGES += \
RemovePackagesDolby
# XiaomiDolby
PRODUCT_PACKAGES += \
XiaomiDolby
# Dolby Proprietary blobs
PRODUCT_COPY_FILES += \
$(DOLBY_PATH)/proprietary/vendor/etc/init/vendor.dolby.hardware.dms@2.0-service.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/vendor.dolby.hardware.dms@2.0-service.rc
PRODUCT_PACKAGES += \
libdapparamstorage \
libdlbdsservice \
libdlbpreg \
vendor.dolby.hardware.dms@2.0-impl \
vendor.dolby.hardware.dms@2.0 \
vendor.dolby.hardware.dms@2.0-service
# Codec2 (Dolby)
PRODUCT_COPY_FILES += \
$(DOLBY_PATH)/proprietary/vendor/etc/init/vendor.dolby.media.c2@1.0-service.rc:$(TARGET_COPY_OUT_VENDOR)/etc/init/vendor.dolby.media.c2@1.0-service.rc
PRODUCT_PACKAGES += \
libcodec2_soft_ac4dec \
libcodec2_soft_ddpdec \
libcodec2_store_dolby \
libdeccfg \
vendor.dolby.media.c2@1.0-service
# Dolby SoundFX Blobs
PRODUCT_PACKAGES += \
libdlbvol \
libhwdap \
libswgamedap \
libswvqe

27
dolby/Android.bp Normal file
View File

@@ -0,0 +1,27 @@
//
// Copyright (C) 2017-2021 The LineageOS Project
// (C) 2023-24 Paranoid Android
//
// SPDX-License-Identifier: Apache-2.0
//
android_app {
name: "XiaomiDolby",
srcs: ["src/**/*.kt"],
resource_dirs: ["res"],
certificate: "platform",
platform_apis: true,
system_ext_specific: true,
privileged: true,
overrides: ["MusicFX"],
static_libs: [
"SettingsLib",
"SpaLib",
"androidx.activity_activity-compose",
"androidx.compose.material3_material3",
"androidx.compose.runtime_runtime",
"androidx.preference_preference",
],
}

81
dolby/AndroidManifest.xml Normal file
View File

@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2023-24 Paranoid Android
SPDX-License-Identifier: Apache-2.0
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="co.aospa.dolby.xiaomi"
android:sharedUserId="android.uid.system">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:icon="@mipmap/ic_launcher"
android:allowBackup="false"
android:label="@string/dolby_title"
android:persistent="true"
android:directBootAware="true"
android:defaultToDeviceProtectedStorage="true"
android:theme="@style/Theme.SubSettingsBase.Expressive">
<receiver
android:name=".BootCompletedReceiver"
android:exported="true">
<intent-filter android:priority="1000">
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
</intent-filter>
</receiver>
<activity
android:name=".DolbySettingsActivity"
android:label="@string/dolby_title"
android:exported="true">
<intent-filter>
<action android:name="com.android.settings.action.IA_SETTINGS" />
<action android:name="android.service.quicksettings.action.QS_TILE_PREFERENCES"/>
</intent-filter>
<intent-filter>
<action android:name="android.media.action.DISPLAY_AUDIO_EFFECT_CONTROL_PANEL" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.CATEGORY_CONTENT_MUSIC" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data android:name="com.android.settings.category"
android:value="com.android.settings.category.ia.sound" />
<meta-data android:name="com.android.settings.summary_uri"
android:value="content://co.aospa.dolby.xiaomi.summary/dolby" />
</activity>
<activity
android:name=".geq.EqualizerActivity"
android:label="@string/dolby_preset"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<service
android:name=".DolbyTileService"
android:icon="@drawable/ic_dolby_qs"
android:label="@string/dolby_title"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE"
android:exported="true">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE"/>
</intent-filter>
</service>
<provider
android:name=".SummaryProvider"
android:authorities="co.aospa.dolby.xiaomi.summary">
</provider>
</application>
</manifest>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24" android:tint="?android:attr/colorControlNormal">
<path android:fillColor="#000000" android:pathData="M1,4.0214C2.2767,4.0743 3.5798,3.9866 4.8252,4.2063C8.8352,4.9133 11.4129,8.3489 11.0507,12.3402C10.7124,16.0695 7.3661,18.9511 3.3484,18.9651C2.5657,18.9678 1.7827,18.9441 1,18.9324L1,4.0214Z" android:strokeColor="#00000000" android:strokeWidth="1" android:fillType="evenOdd"/>
<group>
<clip-path android:pathData="M12.9332,4l10.0668,0l0,15l-10.0668,0z"/>
<path android:fillColor="#000000" android:pathData="M23,4.0924L23,18.8825C19.4973,19.298 16.399,18.6968 14.3366,15.6947C12.5148,13.043 12.4594,10.2265 14.2129,7.5241C16.244,4.394 19.3953,3.7204 23,4.0924" android:strokeColor="#00000000" android:strokeWidth="1" android:fillType="evenOdd"/>
</group>
</vector>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="24dp" android:width="24dp" android:viewportWidth="24" android:viewportHeight="24">
<path android:fillColor="#191c1e" android:pathData="M1,4.0214C2.2767,4.0743 3.5798,3.9866 4.8252,4.2063C8.8352,4.9133 11.4129,8.3489 11.0507,12.3402C10.7124,16.0695 7.3661,18.9511 3.3484,18.9651C2.5657,18.9678 1.7827,18.9441 1,18.9324L1,4.0214Z" android:strokeColor="#00000000" android:strokeWidth="1" android:fillType="evenOdd"/>
<group>
<clip-path android:pathData="M12.9332,4l10.0668,0l0,15l-10.0668,0z"/>
<path android:fillColor="#191c1e" android:pathData="M23,4.0924L23,18.8825C19.4973,19.298 16.399,18.6968 14.3366,15.6947C12.5148,13.043 12.4594,10.2265 14.2129,7.5241C16.244,4.394 19.3953,3.7204 23,4.0924" android:strokeColor="#00000000" android:strokeWidth="1" android:fillType="evenOdd"/>
</group>
</vector>

View File

@@ -0,0 +1,24 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="192dp"
android:height="192dp"
android:viewportWidth="192"
android:viewportHeight="192"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#000000"
android:pathData="M 69.584 66.547 L 63.792 70.797 L 38.646 71.697 L 13.5 72.597 L 13.5 89.723 C 13.5 99.143 13.865 111.999 14.313 118.292 L 15.124 129.734 L 178.5 129.734 L 178.5 102.234 L 121.248 102.234 L 99.203 82.234 C 87.078 71.234 76.756 62.248 76.266 62.266 C 75.776 62.282 72.769 64.209 69.584 66.547"
android:strokeWidth="1.25"/>
<path
android:fillColor="#000000"
android:pathData="M 69.125 67.065 L 62.875 71.921 L 38.188 71.99 L 13.5 72.06 L 13.504 81.122 C 13.506 86.106 13.876 99.044 14.325 109.872 L 15.141 129.56 L 178.5 129.56 L 178.5 103.31 L 122.126 103.31 L 99.675 82.997 C 87.326 71.826 76.808 62.577 76.299 62.446 C 75.791 62.315 72.563 64.394 69.125 67.065"
android:strokeWidth="1.25"/>
<path
android:fillColor="#000000"
android:pathData="M 69.854 67.249 L 63.237 72.187 L 13.311 72.187 L 14.119 84.374 C 14.562 91.077 14.929 104.016 14.932 113.124 L 14.939 129.687 L 178.689 129.687 L 178.689 103.437 L 150.251 103.428 L 121.814 103.418 L 99.143 82.865 L 76.471 62.313 L 69.854 67.249"
android:strokeWidth="1.25"/>
<path
android:fillColor="#000000"
android:pathData="M 69.141 67.266 L 63.221 71.609 L 45.888 71.609 C 36.354 71.609 25.238 71.956 21.184 72.378 L 13.813 73.147 L 14.115 93.316 C 14.281 104.408 14.748 117.001 15.151 121.297 L 15.886 129.109 L 178.188 129.109 L 178.188 102.859 L 120.703 102.859 L 98.696 82.859 C 86.594 71.859 76.324 62.873 75.876 62.891 C 75.429 62.907 72.399 64.876 69.141 67.266"
android:strokeWidth="1.25"/>
</vector>

View File

@@ -0,0 +1,24 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="192dp"
android:height="192dp"
android:viewportWidth="192"
android:viewportHeight="192"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#000000"
android:pathData="M 126.625 63.749 C 120.886 65.812 115.12 69.774 103.5 79.643 C 85.566 94.873 77.207 98.716 62.179 98.637 C 51.344 98.582 42.841 96.091 34.946 90.659 C 29.282 86.763 22.25 77.097 22.25 73.209 C 22.25 71.466 21.259 70.954 17.875 70.954 L 13.5 70.954 L 13.5 129.704 L 178.5 129.704 L 178.5 86.329 L 174.915 81.381 C 169.567 73.999 161.404 67.534 153.865 64.714 C 146.447 61.939 132.988 61.463 126.625 63.749"
android:strokeWidth="1.25"/>
<path
android:fillColor="#000000"
android:pathData="M 128.493 63.479 C 122.229 65.384 117.026 68.819 104.59 79.26 C 89.19 92.189 83.945 95.359 73.54 98.024 C 60.438 101.381 44.281 98.268 33.966 90.4 C 28.19 85.994 22.25 77.679 22.25 73.999 C 22.25 71.475 21.634 71.061 17.875 71.061 L 13.5 71.061 L 13.5 129.811 L 178.5 129.811 L 178.494 108.249 L 178.488 86.686 L 173.807 80.541 C 163.119 66.51 143.193 59.008 128.493 63.479"
android:strokeWidth="1.25"/>
<path
android:fillColor="#000000"
android:pathData="M 129.75 63.348 C 122.865 65.451 115.829 70.014 103.442 80.413 C 96.136 86.547 86.969 92.947 82.48 95.048 C 60.304 105.426 32.044 97.046 23.267 77.492 C 21.242 72.979 20.328 72.179 17.191 72.179 L 13.5 72.179 L 13.5 129.679 L 178.5 129.679 L 178.456 108.742 C 178.41 86.981 178.329 86.587 172.313 78.669 C 163.463 67.022 142.469 59.466 129.75 63.348"
android:strokeWidth="1.25"/>
<path
android:fillColor="#000000"
android:pathData="M 131.184 63.546 C 123.825 64.992 117.559 68.919 103.5 80.894 C 96.969 86.458 87.98 92.824 83.526 95.043 C 75.941 98.821 74.591 99.077 62.25 99.077 C 49.875 99.077 48.564 98.827 40.714 94.962 C 31.655 90.503 24.469 83.298 22.19 76.396 C 21.04 72.909 20.19 72.202 17.152 72.202 L 13.5 72.202 L 13.5 129.702 L 178.5 129.702 L 178.5 87.577 L 174.965 82.702 C 170.49 76.532 163.525 70.403 157.488 67.323 C 153.545 65.312 139.684 61.884 137.333 62.339 C 136.944 62.414 134.176 62.957 131.184 63.546"
android:strokeWidth="1.25"/>
</vector>

View File

@@ -0,0 +1,13 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="192dp"
android:height="192dp"
android:viewportWidth="192"
android:viewportHeight="192"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#000000"
android:pathData="M 13.5 96 L 13.5 103.5 L 178.5 103.5 L 178.5 88.5 L 13.5 88.5 L 13.5 96"
android:strokeWidth="1.25"
android:fillType="evenOdd"/>
</vector>

View File

@@ -0,0 +1,28 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:width="192dp"
android:height="192dp"
android:viewportWidth="192"
android:viewportHeight="192"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#000000"
android:pathData="M 48.789 64.919 C 45.865 66.366 40.885 70.429 37.721 73.948 C 28.465 84.243 13.479 116.446 13.479 126.041 L 13.479 129.786 L 95.979 129.786 C 141.354 129.786 178.479 129.486 178.479 129.12 C 178.479 128.753 177.131 125.8 175.483 122.558 C 170.413 112.579 162.723 104.006 155.705 100.509 C 149.673 97.503 148.053 97.286 131.582 97.286 C 105.944 97.286 102.89 95.881 86.335 76.454 C 74.977 63.124 61.056 58.848 48.789 64.919"
android:strokeWidth="1.25"
android:fillType="evenOdd"/>
<path
android:fillColor="#000000"
android:pathData="M 49.712 64.871 C 40.942 68.842 33.167 78.157 25.45 93.941 C 18.063 109.047 13.462 121.585 13.462 126.604 L 13.462 129.769 L 178.496 129.769 L 176.673 125.407 C 171.895 113.971 159.81 101.317 151.203 98.739 C 148.476 97.921 138.591 97.264 128.942 97.256 C 107.671 97.241 102.106 95.265 93.347 84.617 C 76.128 63.684 64.227 58.297 49.712 64.871"
android:strokeWidth="1.25"
android:fillType="evenOdd"/>
<path
android:fillColor="#000000"
android:pathData="M 52.781 63.452 C 47.321 65.482 40.256 70.907 35.792 76.496 C 27.971 86.29 13.406 119.09 13.406 126.91 L 13.406 129.502 L 178.552 129.502 L 174.586 122.06 C 169.31 112.162 163.213 105.23 156.113 101.056 C 150.453 97.729 149.705 97.625 130.807 97.53 C 107.81 97.414 103.646 96.04 94.012 85.387 C 80.912 70.9 77.898 68.045 73.171 65.632 C 67.157 62.565 57.846 61.569 52.781 63.452"
android:strokeWidth="1.25"
android:fillType="evenOdd"/>
<path
android:fillColor="#000000"
android:pathData="M 56.078 63.069 C 44.607 65.852 35.711 75.314 26.246 94.802 C 19.707 108.263 16.537 116.731 14.817 125.334 L 14.005 129.397 L 95.98 129.397 C 165.857 129.397 177.953 129.136 177.953 127.627 C 177.953 124.146 165.22 106.857 160.048 103.314 C 152.515 98.156 150.572 97.791 129.828 97.641 C 111.478 97.507 110.935 97.424 104.33 93.776 C 99.905 91.331 95.316 87.208 91 81.798 C 80.578 68.737 74.351 64.324 64.203 62.812 C 61.797 62.453 58.141 62.568 56.078 63.069"
android:strokeWidth="1.25"
android:fillType="evenOdd"/>
</vector>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<vector android:height="108.0dip" android:width="108.0dip" android:viewportWidth="108.0" android:viewportHeight="108.0"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt">
<group android:scaleX="1.3544992" android:scaleY="1.3544992" android:translateX="-23.22" android:translateY="-23.22">
<group>
<clip-path android:pathData="M57.01,57.01m-54,0a54,54 0,1 1,108 0a54,54 0,1 1,-108 0" />
<path android:fillColor="#ffeaedef" android:pathData="M-1.9,-1.9h117.82v117.82h-117.82z" />
<path android:fillColor="@drawable/ic_launcher_background__0" android:pathData="M-1.9,115.92l0,-117.82l117.82,0l-117.82,117.82z" />
<path android:fillColor="@drawable/ic_launcher_background__1" android:pathData="M-1.9,-1.9h117.82v117.82h-117.82z" android:strokeAlpha="0.2" android:fillAlpha="0.2" />
</group>
</group>
</vector>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<gradient android:angle="0.0" android:type="linear" android:startX="57.01" android:startY="56.4" android:endX="57.01" android:endY="-1.58"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt">
<item android:color="#ffffffff" android:offset="0.0" />
<item android:color="#fff3f5f6" android:offset="1.0" />
</gradient>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<gradient android:angle="0.0" android:type="linear" android:startX="-1.9" android:startY="115.92" android:endX="115.92" android:endY="-1.9"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt">
<item android:color="#ff80d0ce" android:offset="0.0" />
<item android:color="#ff9fa8da" android:offset="1.0" />
</gradient>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<vector android:height="108.0dip" android:width="108.0dip" android:viewportWidth="108.0" android:viewportHeight="108.0"
xmlns:android="http://schemas.android.com/apk/res/android">
<group android:scaleX="0.84" android:scaleY="0.84" android:translateX="23.76" android:translateY="23.76">
<path android:fillColor="#ff465461" android:pathData="M12,19.13h5a16.87,16.87 0,0 1,0 33.74H12Z" />
<path android:fillColor="#ff465461" android:pathData="M60,52.87H55a16.87,16.87 0,0 1,0 -33.74h5Z" />
</group>
</vector>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="108dp" android:width="108dp" android:viewportWidth="108" android:viewportHeight="108">
<path android:fillColor="#000000" android:pathData="M36.6305484,38 C45.6078241,38.1592687 52.837468,45.7082857 52.837468,54.9974325 C52.837468,64.2865794 45.6078241,71.8355964 36.6307694,71.9948651 L32,72 L32,38 L36.6305484,38 Z M36.999,43.017 L36.999,66.977 L37.1225728,66.9701894 C42.9872179,66.559014 47.6837958,61.5395304 47.8337726,55.3050128 L47.837468,54.9974325 C47.837468,48.6211219 43.0833381,43.4425908 37.1223719,43.0246757 L36.999,43.017 Z M71.3694516,38 C62.3921759,38.1592687 55.162532,45.7082857 55.162532,54.9974325 C55.162532,64.2865794 62.3921759,71.8355964 71.3692306,71.9948651 L76,72 L76,38 L71.3694516,38 Z M71.000532,43.017 L71.000532,66.977 L70.8774272,66.9701894 C65.0127821,66.559014 60.3162042,61.5395304 60.1662274,55.3050128 L60.162532,54.9974325 C60.162532,48.6211219 64.9166619,43.4425908 70.8776281,43.0246757 L71.000532,43.017 Z" android:strokeWidth="1"/>
</vector>

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="?android:attr/colorControlNormal"
android:pathData="M520,630L520,570L680,570L680,630L520,630ZM580,840L580,790L520,790L520,730L580,730L580,680L640,680L640,840L580,840ZM680,790L680,730L840,730L840,790L680,790ZM720,680L720,520L780,520L780,570L840,570L840,630L780,630L780,680L720,680ZM831,400L748,400Q722,312 649,256Q576,200 480,200Q363,200 281.5,281.5Q200,363 200,480Q200,552 232.5,612Q265,672 320,710L320,600L400,600L400,840L160,840L160,760L254,760Q192,710 156,637.5Q120,565 120,480Q120,405 148.5,339.5Q177,274 225.5,225.5Q274,177 339.5,148.5Q405,120 480,120Q609,120 706.5,199.5Q804,279 831,400Z" />
</vector>

View File

@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M653,752L565,840L480,755L568,667Q564,656 562,644Q560,632 560,620Q560,562 601,521Q642,480 700,480Q718,480 735,484.5Q752,489 767,497L672,592L728,648L823,554Q831,569 835.5,585.5Q840,602 840,620Q840,678 799,719Q758,760 700,760Q687,760 675.5,758Q664,756 653,752ZM831,400L748,400Q722,312 649,256Q576,200 480,200Q363,200 281.5,281.5Q200,363 200,480Q200,552 232.5,612Q265,672 320,710L320,600L400,600L400,840L160,840L160,760L254,760Q192,710 156,637.5Q120,565 120,480Q120,405 148.5,339.5Q177,274 225.5,225.5Q274,177 339.5,148.5Q405,120 480,120Q609,120 706.5,199.5Q804,279 831,400Z"/>
</vector>

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960">
<path
android:fillColor="?android:attr/colorControlNormal"
android:pathData="M200,840Q167,840 143.5,816.5Q120,793 120,760L120,200Q120,167 143.5,143.5Q167,120 200,120L680,120L840,280L840,492Q821,484 800.5,481.5Q780,479 760,482L760,313L647,200L200,200Q200,200 200,200Q200,200 200,200L200,760Q200,760 200,760Q200,760 200,760L440,760L440,764L440,840L200,840ZM200,200L200,313L200,482Q200,485 200,494.5Q200,504 200,519L200,760L200,760L200,760Q200,760 200,760Q200,760 200,760L200,200Q200,200 200,200Q200,200 200,200ZM520,920L520,797L741,577Q750,568 761,564Q772,560 783,560Q795,560 806,564.5Q817,569 826,578L863,615Q871,624 875.5,635Q880,646 880,657Q880,668 876,679.5Q872,691 863,700L643,920L520,920ZM820,657L820,657L783,620L783,620L820,657ZM580,860L618,860L739,738L721,719L702,701L580,822L580,860ZM721,719L702,701L702,701L739,738L739,738L721,719ZM240,400L600,400L600,240L240,240L240,400ZM480,720Q481,720 482,720Q483,720 484,720L600,605Q600,603 600,602.5Q600,602 600,600Q600,550 565,515Q530,480 480,480Q430,480 395,515Q360,550 360,600Q360,650 395,685Q430,720 480,720Z"/>
</vector>

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2021 The Android Open Source Project
(C) 2024 Paranoid Android
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"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@android:id/widget_frame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="56dp"
android:gravity="end|center_vertical"
android:orientation="horizontal"
android:paddingLeft="8dp"
android:paddingStart="8dp"
android:paddingRight="0dp"
android:paddingEnd="0dp"
android:paddingTop="4dp"
android:paddingBottom="4dp">
<androidx.preference.internal.PreferenceImageView
android:id="@+id/ieq_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:maxWidth="56dp"
app:maxHeight="56dp"/>
</LinearLayout>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon
xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
<monochrome android:drawable="@drawable/ic_launcher_mono" />
</adaptive-icon>

View File

@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2023-24 Paranoid Android
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<!-- Dolby Atmos -->
<string-array name="dolby_profile_entries">
<item>@string/dolby_profile_dynamic</item>
<item>@string/dolby_profile_video</item>
<item>@string/dolby_profile_music</item>
<item>@string/dolby_profile_voice</item>
<item>@string/dolby_profile_custom</item>
</string-array>
<string-array name="dolby_profile_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>8</item>
<item>3</item>
</string-array>
<string-array name="dolby_preset_entries" translatable="false">
<item>@string/dolby_preset_default</item>
<item>@string/dolby_preset_rock</item>
<item>@string/dolby_preset_jazz</item>
<item>@string/dolby_preset_pop</item>
<item>@string/dolby_preset_classical</item>
<item>@string/dolby_preset_hiphop</item>
<item>@string/dolby_preset_blues</item>
<item>@string/dolby_preset_electronic</item>
<item>@string/dolby_preset_metal</item>
</string-array>
<string-array name="dolby_preset_values">
<!--
<item>0,0,0,0,0,0,0,0,0,0</item>
<item>4,1,-2,-0.25,0,-2,0,-2,0.5,4</item>
<item>0,0,0,-1,-1,-3,-0.5,0,0,0</item>
<item>-2,-0.5,-5,-1,0,0,-0.5,-3,-0.5,0</item>
<item>0,0,0,0,0.5,3,1,6,2,6</item>
<item>3,0,-3,-0.5,-0.5,-3,-0.5,0,0,2</item>
<item>2,2,-6,-2,3,1,0,1,0,2</item>
<item>3,1,-1,0,-0.5,-3,-0.5,0,0,0</item>
<item>2,0,0,-1.25,-1,-4,0,0,0,0</item>
-->
<item>0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</item>
<item>60,36,12,-12,-36,-24,-12,-8,-4,-20,-36,-20,-4,-20,-36,-16,4,32,60,60</item>
<item>8,8,8,8,8,0,-8,-8,-8,-24,-40,-20,0,4,8,8,8,8,8,8</item>
<item>-13,-1,11,-25,-61,-29,3,11,19,19,19,15,11,-9,-29,-9,11,15,19,19</item>
<item>-32,-32,-32,-32,-32,-32,-32,-28,-24,-4,16,0,-16,24,64,32,0,32,64,64</item>
<item>52,28,4,-20,-44,-24,-4,-4,-4,-24,-44,-24,-4,0,4,4,4,20,36,36</item>
<item>28,28,28,-36,-100,-68,-36,4,44,28,12,4,-4,4,12,4,-4,12,28,28</item>
<item>50,34,18,2,-14,-6,2,-2,-6,-26,-46,-26,-6,-2,2,2,2,2,2,2</item>
<item>40,24,8,8,8,-4,-16,-12,-8,-32,-56,-24,8,8,8,8,8,8,8,8</item>
</string-array>
<string-array name="dolby_ieq_entries">
<item>@string/dolby_off</item>
<item>@string/dolby_detailed</item>
<item>@string/dolby_balanced</item>
<item>@string/dolby_warm</item>
</string-array>
<string-array name="dolby_ieq_values">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>
</resources>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2023-25 Paranoid Android
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<!-- Whether stereo widening levels are supported -->
<bool name="dolby_stereo_widening_supported">true</bool>
<!-- Whether volume leveler is supported -->
<bool name="dolby_volume_leveler_supported">true</bool>
</resources>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2025 Paranoid Android
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<!-- Stereo widening amount -->
<integer name="stereo_widening_min">4</integer>
<integer name="stereo_widening_max">64</integer>
<!-- Dialogue enhancer amount -->
<integer name="dialogue_enhancer_min">1</integer>
<integer name="dialogue_enhancer_max">12</integer>
</resources>

View File

@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2023-25 Paranoid Android
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<!-- Dolby Atmos -->
<string name="dolby_title">Dolby Atmos</string>
<string name="dolby_enable">Use Dolby Atmos</string>
<string name="dolby_profile_title">Choose a profile</string>
<string name="dolby_preset">Graphic equalizer</string>
<string name="dolby_off">Off</string>
<string name="dolby_on">On</string>
<string name="dolby_low">Low</string>
<string name="dolby_medium">Medium</string>
<string name="dolby_high">High</string>
<string name="dolby_max">Max</string>
<string name="dolby_unknown">Unknown</string>
<string name="dolby_on_with_profile">On (%1$s)</string>
<string name="dolby_category_settings">Settings</string>
<string name="dolby_category_adv_settings">Advanced settings</string>
<string name="dolby_adv_settings_footer">Choose a different profile to show advanced settings.</string>
<string name="dolby_bass_enhancer">Bass enhancer</string>
<string name="dolby_dialogue_enhancer">Dialogue enhancer</string>
<string name="dolby_spk_virtualizer">Speaker surround virtualizer</string>
<string name="dolby_hp_virtualizer">Headphone surround virtualizer</string>
<string name="dolby_volume_leveler">Volume leveler</string>
<string name="dolby_connect_headphones">Connect headphones</string>
<string name="dolby_reset_all">Reset profiles</string>
<string name="dolby_reset_all_message">This will reset all profiles to factory defaults.</string>
<string name="dolby_reset_all_toast">Succesfully reset all profiles</string>
<string name="dolby_strength">Strength</string>
<!-- Dolby profiles -->
<string name="dolby_profile_dynamic">Dynamic</string>
<string name="dolby_profile_video">Movie/Video</string>
<string name="dolby_profile_music">Music</string>
<string name="dolby_profile_voice">Voice</string>
<string name="dolby_profile_custom">Custom</string>
<!-- Dolby equalizer presets -->
<string name="dolby_preset_default">Flat (off)</string>
<string name="dolby_preset_rock">Rock</string>
<string name="dolby_preset_jazz">Jazz</string>
<string name="dolby_preset_pop">Pop</string>
<string name="dolby_preset_classical">Classical</string>
<string name="dolby_preset_hiphop">Hip Hop</string>
<string name="dolby_preset_blues">Blues</string>
<string name="dolby_preset_electronic">Electronic</string>
<string name="dolby_preset_country">Country</string>
<string name="dolby_preset_dance">Dance</string>
<string name="dolby_preset_metal">Metal</string>
<string name="dolby_preset_custom">Custom</string>
<!-- Dolby equalizer UI -->
<string name="dolby_geq_slider_label_gain">Gain</string>
<string name="dolby_geq_preset">Preset</string>
<string name="dolby_geq_preset_name">Preset name</string>
<string name="dolby_geq_new_preset">New preset</string>
<string name="dolby_geq_rename_preset">Rename preset</string>
<string name="dolby_geq_delete_preset">Delete preset</string>
<string name="dolby_geq_delete_preset_prompt">Do you want to delete this preset?</string>
<string name="dolby_geq_reset_gains">Reset gains</string>
<string name="dolby_geq_reset_gains_prompt">Do you want to reset this preset to defaults?</string>
<string name="dolby_geq_preset_name_exists">Preset name already exists!</string>
<string name="dolby_geq_preset_name_too_long">Preset name is too long!</string>
<!-- Dolby intelligent EQ -->
<string name="dolby_ieq">Intelligent equalizer</string>
<string name="dolby_balanced">Balanced</string>
<string name="dolby_warm">Warm</string>
<string name="dolby_detailed">Detailed</string>
</resources>

View File

@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2023-25 Paranoid Android
SPDX-License-Identifier: Apache-2.0
-->
<PreferenceScreen
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:title="@string/dolby_title">
<com.android.settingslib.widget.MainSwitchPreference
android:defaultValue="true"
android:key="dolby_enable"
android:title="@string/dolby_enable" />
<ListPreference
android:key="dolby_profile"
android:dependency="dolby_enable"
android:entries="@array/dolby_profile_entries"
android:entryValues="@array/dolby_profile_values"
android:defaultValue="0"
android:title="@string/dolby_profile_title"
android:summary="%s"
android:icon="@drawable/ic_dolby" />
<PreferenceCategory
android:key="dolby_category_settings"
android:title="@string/dolby_category_settings"
android:dependency="dolby_enable">
<Preference
android:key="dolby_preset"
android:title="@string/dolby_preset">
<intent
android:action="android.intent.action.MAIN"
android:targetPackage="co.aospa.dolby.xiaomi"
android:targetClass="co.aospa.dolby.xiaomi.geq.EqualizerActivity" />
</Preference>
<SwitchPreferenceCompat
android:key="dolby_bass"
android:title="@string/dolby_bass_enhancer" />
</PreferenceCategory>
<PreferenceCategory
android:key="dolby_category_adv_settings"
android:title="@string/dolby_category_adv_settings"
android:dependency="dolby_enable">
<co.aospa.dolby.xiaomi.preference.DolbyIeqPreference
android:key="dolby_ieq"
android:entries="@array/dolby_ieq_entries"
android:entryValues="@array/dolby_ieq_values"
android:title="@string/dolby_ieq" />
<SwitchPreferenceCompat
android:key="dolby_spk_virtualizer"
android:title="@string/dolby_spk_virtualizer" />
<SwitchPreferenceCompat
android:key="dolby_virtualizer"
android:title="@string/dolby_hp_virtualizer" />
<SeekBarPreference
android:key="dolby_stereo_widening"
android:title="@string/dolby_strength"
android:dependency="dolby_virtualizer"
android:min="@integer/stereo_widening_min"
android:max="@integer/stereo_widening_max"/>
<SwitchPreferenceCompat
android:key="dolby_dialogue_enabled"
android:title="@string/dolby_dialogue_enhancer" />
<SeekBarPreference
android:key="dolby_dialogue_amount"
android:title="@string/dolby_strength"
android:dependency="dolby_dialogue_enabled"
android:min="@integer/dialogue_enhancer_min"
android:max="@integer/dialogue_enhancer_max"/>
<SwitchPreferenceCompat
android:key="dolby_volume"
android:title="@string/dolby_volume_leveler" />
</PreferenceCategory>
<com.android.settingslib.widget.FooterPreference
android:key="dolby_adv_settings_footer"
android:title="@string/dolby_adv_settings_footer"
android:selectable="false" />
</PreferenceScreen>

View File

@@ -0,0 +1,31 @@
/*
* Copyright (C) 2023-24 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.util.Log
private const val TAG = "XiaomiDolby-Boot"
class BootCompletedReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
Log.d(TAG, "Received intent: ${intent.action}")
when (intent.action) {
Intent.ACTION_LOCKED_BOOT_COMPLETED -> {
// we perform everything in the initializer
DolbyController.getInstance(context)
}
Intent.ACTION_BOOT_COMPLETED -> {
DolbyController.getInstance(context).onBootCompleted()
}
else -> Log.e(TAG, "unhandled intent action")
}
}
}

View File

@@ -0,0 +1,136 @@
/*
* Copyright (C) 2023-24 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi
import android.media.audiofx.AudioEffect
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.dlog
import co.aospa.dolby.xiaomi.DolbyConstants.DsParam
import java.util.UUID
class DolbyAudioEffect(priority: Int, audioSession: Int) : AudioEffect(
EFFECT_TYPE_NULL, EFFECT_TYPE_DAP, priority, audioSession
) {
var dsOn: Boolean
get() = getIntParam(EFFECT_PARAM_ENABLE) == 1
set(value) {
setIntParam(EFFECT_PARAM_ENABLE, if (value) 1 else 0)
enabled = value
}
var profile: Int
get() = getIntParam(EFFECT_PARAM_PROFILE)
set(value) {
setIntParam(EFFECT_PARAM_PROFILE, value)
}
private fun setIntParam(param: Int, value: Int) {
dlog(TAG, "setIntParam($param, $value)")
val buf = ByteArray(12)
int32ToByteArray(param, buf, 0)
int32ToByteArray(1, buf, 4)
int32ToByteArray(value, buf, 8)
checkStatus(setParameter(EFFECT_PARAM_CPDP_VALUES, buf))
}
private fun getIntParam(param: Int): Int {
val buf = ByteArray(12)
int32ToByteArray(param, buf, 0)
checkStatus(getParameter(EFFECT_PARAM_CPDP_VALUES + param, buf))
return byteArrayToInt32(buf).also {
dlog(TAG, "getIntParam($param): $it")
}
}
fun resetProfileSpecificSettings(profile: Int = this.profile) {
dlog(TAG, "resetProfileSpecificSettings: profile=$profile")
setIntParam(EFFECT_PARAM_RESET_PROFILE_SETTINGS, profile)
}
fun setDapParameter(param: DsParam, values: IntArray, profile: Int = this.profile) {
dlog(TAG, "setDapParameter: profile=$profile param=$param")
val length = values.size
val buf = ByteArray((length + 4) * 4)
int32ToByteArray(EFFECT_PARAM_SET_PROFILE_PARAMETER, buf, 0)
int32ToByteArray(length + 1, buf, 4)
int32ToByteArray(profile, buf, 8)
int32ToByteArray(param.id, buf, 12)
int32ArrayToByteArray(values, buf, 16)
checkStatus(setParameter(EFFECT_PARAM_CPDP_VALUES, buf))
}
fun setDapParameter(param: DsParam, enable: Boolean, profile: Int = this.profile) =
setDapParameter(param, intArrayOf(if (enable) 1 else 0), profile)
fun setDapParameter(param: DsParam, value: Int, profile: Int = this.profile) =
setDapParameter(param, intArrayOf(value), profile)
fun getDapParameter(param: DsParam, profile: Int = this.profile): IntArray {
dlog(TAG, "getDapParameter: profile=$profile param=$param")
val length = param.length
val buf = ByteArray((length + 2) * 4)
val p = (param.id shl 16) + (profile shl 8) + EFFECT_PARAM_GET_PROFILE_PARAMETER
checkStatus(getParameter(p, buf))
return byteArrayToInt32Array(buf, length)
}
fun getDapParameterBool(param: DsParam, profile: Int = this.profile): Boolean =
getDapParameter(param, profile)[0] == 1
fun getDapParameterInt(param: DsParam, profile: Int = this.profile): Int =
getDapParameter(param, profile)[0]
companion object {
private const val TAG = "DolbyAudioEffect"
private val EFFECT_TYPE_DAP =
UUID.fromString("9d4921da-8225-4f29-aefa-39537a04bcaa")
private const val EFFECT_PARAM_ENABLE = 0
private const val EFFECT_PARAM_CPDP_VALUES = 5
private const val EFFECT_PARAM_PROFILE = 0xA000000
private const val EFFECT_PARAM_SET_PROFILE_PARAMETER = 0x1000000
private const val EFFECT_PARAM_GET_PROFILE_PARAMETER = 0x1000005
private const val EFFECT_PARAM_RESET_PROFILE_SETTINGS = 0xC000000
private fun int32ToByteArray(value: Int, dst: ByteArray, index: Int) {
var idx = index
dst[idx++] = (value and 0xff).toByte()
dst[idx++] = ((value ushr 8) and 0xff).toByte()
dst[idx++] = ((value ushr 16) and 0xff).toByte()
dst[idx] = ((value ushr 24) and 0xff).toByte()
}
private fun byteArrayToInt32(ba: ByteArray): Int {
return ((ba[3].toInt() and 0xff) shl 24) or
((ba[2].toInt() and 0xff) shl 16) or
((ba[1].toInt() and 0xff) shl 8) or
(ba[0].toInt() and 0xff)
}
private fun int32ArrayToByteArray(src: IntArray, dst: ByteArray, index: Int) {
var idx = index
for (x in src) {
dst[idx++] = (x and 0xff).toByte()
dst[idx++] = ((x ushr 8) and 0xff).toByte()
dst[idx++] = ((x ushr 16) and 0xff).toByte()
dst[idx++] = ((x ushr 24) and 0xff).toByte()
}
}
private fun byteArrayToInt32Array(ba: ByteArray, dstLength: Int): IntArray {
val srcLength = ba.size shr 2
val dst = IntArray(dstLength.coerceAtMost(srcLength))
for (i in dst.indices) {
dst[i] = ((ba[i * 4 + 3].toInt() and 0xff) shl 24) or
((ba[i * 4 + 2].toInt() and 0xff) shl 16) or
((ba[i * 4 + 1].toInt() and 0xff) shl 8) or
(ba[i * 4].toInt() and 0xff)
}
return dst
}
}
}

View File

@@ -0,0 +1,62 @@
/*
* Copyright (C) 2023-24 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi
import android.util.Log
class DolbyConstants {
enum class DsParam(val id: Int, val length: Int = 1) {
HEADPHONE_VIRTUALIZER(101),
SPEAKER_VIRTUALIZER(102),
VOLUME_LEVELER_ENABLE(103),
IEQ_PRESET(104),
DIALOGUE_ENHANCER_ENABLE(105),
DIALOGUE_ENHANCER_AMOUNT(108),
GEQ_BAND_GAINS(110, 20),
BASS_ENHANCER_ENABLE(111),
STEREO_WIDENING_AMOUNT(113);
override fun toString(): String {
return "${name}(${id})"
}
}
companion object {
const val TAG = "XiaomiDolby"
const val PREF_ENABLE = "dolby_enable"
const val PREF_PROFILE = "dolby_profile"
const val PREF_PRESET = "dolby_preset"
const val PREF_IEQ = "dolby_ieq"
const val PREF_HP_VIRTUALIZER = "dolby_virtualizer"
const val PREF_SPK_VIRTUALIZER = "dolby_spk_virtualizer"
const val PREF_STEREO_WIDENING = "dolby_stereo_widening"
const val PREF_DIALOGUE = "dolby_dialogue_enabled"
const val PREF_DIALOGUE_AMOUNT = "dolby_dialogue_amount"
const val PREF_BASS = "dolby_bass"
const val PREF_VOLUME = "dolby_volume"
const val PREF_RESET = "dolby_reset"
val PROFILE_SPECIFIC_PREFS = setOf(
PREF_PRESET,
PREF_IEQ,
PREF_HP_VIRTUALIZER,
PREF_SPK_VIRTUALIZER,
PREF_STEREO_WIDENING,
PREF_DIALOGUE,
PREF_DIALOGUE_AMOUNT,
PREF_BASS,
PREF_VOLUME
)
fun dlog(tag: String, msg: String) {
if (Log.isLoggable(TAG, Log.DEBUG) || Log.isLoggable(tag, Log.DEBUG)) {
Log.d("$TAG-$tag", msg)
}
}
}
}

View File

@@ -0,0 +1,389 @@
/*
* Copyright (C) 2023-25 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi
import android.content.Context
import android.media.AudioDeviceCallback
import android.media.AudioDeviceInfo
import android.media.AudioManager
import android.media.AudioManager.AudioPlaybackCallback
import android.media.AudioPlaybackConfiguration
import android.os.Handler
import android.util.Log
import androidx.preference.PreferenceManager
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.dlog
import co.aospa.dolby.xiaomi.DolbyConstants.DsParam
import co.aospa.dolby.xiaomi.R
internal class DolbyController private constructor(
private val context: Context
) {
private var dolbyEffect = DolbyAudioEffect(EFFECT_PRIORITY, audioSession = 0)
private val audioManager = context.getSystemService(AudioManager::class.java)!!
private val handler = Handler(context.mainLooper)
private val stereoWideningSupported =
context.getResources().getBoolean(R.bool.dolby_stereo_widening_supported)
private val volumeLevelerSupported =
context.getResources().getBoolean(R.bool.dolby_volume_leveler_supported)
// Restore current profile on every media session
private val playbackCallback = object : AudioPlaybackCallback() {
override fun onPlaybackConfigChanged(configs: List<AudioPlaybackConfiguration>) {
val isPlaying = configs.any {
it.playerState == AudioPlaybackConfiguration.PLAYER_STATE_STARTED
}
dlog(TAG, "onPlaybackConfigChanged: isPlaying=$isPlaying")
if (isPlaying)
setCurrentProfile()
}
}
// Restore current profile on audio device change
private val audioDeviceCallback = object : AudioDeviceCallback() {
override fun onAudioDevicesAdded(addedDevices: Array<AudioDeviceInfo>) {
dlog(TAG, "onAudioDevicesAdded")
setCurrentProfile()
}
override fun onAudioDevicesRemoved(removedDevices: Array<AudioDeviceInfo>) {
dlog(TAG, "onAudioDevicesRemoved")
setCurrentProfile()
}
}
private var registerCallbacks = false
set(value) {
if (field == value) return
field = value
dlog(TAG, "setRegisterCallbacks($value)")
if (value) {
audioManager.registerAudioPlaybackCallback(playbackCallback, handler)
audioManager.registerAudioDeviceCallback(audioDeviceCallback, handler)
} else {
audioManager.unregisterAudioPlaybackCallback(playbackCallback)
audioManager.unregisterAudioDeviceCallback(audioDeviceCallback)
}
}
var dsOn: Boolean
get() =
dolbyEffect.dsOn.also {
dlog(TAG, "getDsOn: $it")
}
set(value) {
dlog(TAG, "setDsOn: $value")
checkEffect()
dolbyEffect.dsOn = value
registerCallbacks = value
if (value)
setCurrentProfile()
}
var profile: Int
get() =
dolbyEffect.profile.also {
dlog(TAG, "getProfile: $it")
}
set(value) {
dlog(TAG, "setProfile: $value")
checkEffect()
dolbyEffect.profile = value
}
init {
// Restore our main settings
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
dsOn = prefs.getBoolean(DolbyConstants.PREF_ENABLE, true)
context.resources.getStringArray(R.array.dolby_profile_values)
.map { it.toInt() }
.forEach { profile ->
// Reset dolby first to prevent it from loading bad settings
dolbyEffect.resetProfileSpecificSettings(profile)
// Now restore our profile-specific settings
restoreSettings(profile)
}
// Finally restore the current profile.
setCurrentProfile()
dlog(TAG, "initialized")
}
fun onBootCompleted () {
dlog(TAG, "onBootCompleted()")
// Migrate presets from credential protected storage if needed
maybeMigratePresets()
}
private fun restoreSettings(profile: Int) {
dlog(TAG, "restoreSettings(profile=$profile)")
val prefs = context.getSharedPreferences("profile_$profile", Context.MODE_PRIVATE)
setPreset(
prefs.getString(DolbyConstants.PREF_PRESET, getPreset(profile))!!,
profile
)
setBassEnhancerEnabled(
prefs.getBoolean(DolbyConstants.PREF_BASS, getBassEnhancerEnabled(profile)),
profile
)
setVolumeLevelerEnabled(
// force disable if unsupported, else force enable on dynamic profile
volumeLevelerSupported && (profile == 0 ||
prefs.getBoolean(DolbyConstants.PREF_VOLUME, getVolumeLevelerEnabled(profile))),
profile
)
if (profile == 0) {
// below settings are not applicable for dynamic
return
}
setIeqPreset(
prefs.getString(
DolbyConstants.PREF_IEQ,
getIeqPreset(profile).toString()
)!!.toInt(),
profile
)
setHeadphoneVirtEnabled(
prefs.getBoolean(DolbyConstants.PREF_HP_VIRTUALIZER, getHeadphoneVirtEnabled(profile)),
profile
)
setSpeakerVirtEnabled(
prefs.getBoolean(DolbyConstants.PREF_SPK_VIRTUALIZER, getSpeakerVirtEnabled(profile)),
profile
)
setStereoWideningAmount(
prefs.getInt(
DolbyConstants.PREF_STEREO_WIDENING,
getStereoWideningAmount(profile)
)!!.toInt(),
profile
)
setDialogueEnhancerEnabled(
prefs.getBoolean(
DolbyConstants.PREF_DIALOGUE,
getDialogueEnhancerEnabled(profile)
),
profile
)
setDialogueEnhancerAmount(
prefs.getInt(
DolbyConstants.PREF_DIALOGUE_AMOUNT,
getDialogueEnhancerAmount(profile)
)!!.toInt(),
profile
)
}
private fun maybeMigratePresets() {
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
if (prefs.getBoolean(PREF_KEY_PRESETS_MIGRATED, false)) {
return
}
val ceContext = context.createCredentialProtectedStorageContext()
val cePrefs = ceContext.getSharedPreferences(PREF_PRESETS, Context.MODE_PRIVATE)
if (cePrefs.all.isEmpty()) {
dlog(TAG, "no presets to migrate")
return
}
if (context.moveSharedPreferencesFrom(ceContext, PREF_PRESETS)) {
prefs.edit().putBoolean(PREF_KEY_PRESETS_MIGRATED, true).apply()
dlog(TAG, "presets migrated successfully")
} else {
Log.w(TAG, "failed to migrate presets")
}
}
private fun checkEffect() {
if (!dolbyEffect.hasControl()) {
Log.w(TAG, "lost control, recreating effect")
dolbyEffect.release()
dolbyEffect = DolbyAudioEffect(EFFECT_PRIORITY, audioSession = 0)
}
}
private fun setCurrentProfile() {
dlog(TAG, "setCurrentProfile")
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
profile = prefs.getString(DolbyConstants.PREF_PROFILE, "0" /*dynamic*/)!!.toInt()
}
fun setDsOnAndPersist(dsOn: Boolean) {
this.dsOn = dsOn
PreferenceManager.getDefaultSharedPreferences(context).edit()
.putBoolean(DolbyConstants.PREF_ENABLE, dsOn)
.apply()
}
fun getProfileName(): String? {
val profile = dolbyEffect.profile.toString()
val profiles = context.resources.getStringArray(R.array.dolby_profile_values)
val profileIndex = profiles.indexOf(profile)
dlog(TAG, "getProfileName: profile=$profile index=$profileIndex")
return if (profileIndex == -1) null else context.resources.getStringArray(
R.array.dolby_profile_entries
)[profileIndex]
}
fun resetProfileSpecificSettings(profile: Int = this.profile) {
dlog(TAG, "resetProfileSpecificSettings($profile)")
checkEffect()
dolbyEffect.resetProfileSpecificSettings(profile)
context.deleteSharedPreferences("profile_$profile")
}
fun resetAllProfiles() {
dlog(TAG, "resetAllProfiles")
checkEffect()
// Reset profile-specific settings
context.resources.getStringArray(R.array.dolby_profile_values)
.map { it.toInt() }
.forEach { resetProfileSpecificSettings(it) }
// Set default dynamic profile
profile = 0
PreferenceManager.getDefaultSharedPreferences(context).edit()
.putString(DolbyConstants.PREF_PROFILE, "0")
.apply()
}
fun getPreset(profile: Int = this.profile): String {
val gains = dolbyEffect.getDapParameter(DsParam.GEQ_BAND_GAINS, profile)
return gains.joinToString(separator = ",").also {
dlog(TAG, "getPreset: $it")
}
}
fun setPreset(value: String, profile: Int = this.profile) {
dlog(TAG, "setPreset: $value")
checkEffect()
val gains = value.split(",")
.map { it.toInt() }
.toIntArray()
dolbyEffect.setDapParameter(DsParam.GEQ_BAND_GAINS, gains, profile)
}
fun getPresetName(): String {
val preset = getPreset()
val presets = context.resources.getStringArray(R.array.dolby_preset_values)
val userPresets = context.getSharedPreferences(PREF_PRESETS, Context.MODE_PRIVATE)
return if (presets.contains(preset)) {
context.resources.getStringArray(R.array.dolby_preset_entries)[presets.indexOf(preset)]
} else {
userPresets.all.entries.firstOrNull { it.value == preset }?.key
?: context.getString(R.string.dolby_preset_custom)
}
}
fun getHeadphoneVirtEnabled(profile: Int = this.profile) =
dolbyEffect.getDapParameterBool(DsParam.HEADPHONE_VIRTUALIZER, profile).also {
dlog(TAG, "getHeadphoneVirtEnabled: $it")
}
fun setHeadphoneVirtEnabled(value: Boolean, profile: Int = this.profile) {
dlog(TAG, "setHeadphoneVirtEnabled: $value")
checkEffect()
dolbyEffect.setDapParameter(DsParam.HEADPHONE_VIRTUALIZER, value, profile)
}
fun getSpeakerVirtEnabled(profile: Int = this.profile) =
dolbyEffect.getDapParameterBool(DsParam.SPEAKER_VIRTUALIZER, profile).also {
dlog(TAG, "getSpeakerVirtEnabled: $it")
}
fun setSpeakerVirtEnabled(value: Boolean, profile: Int = this.profile) {
dlog(TAG, "setSpeakerVirtEnabled: $value")
checkEffect()
dolbyEffect.setDapParameter(DsParam.SPEAKER_VIRTUALIZER, value, profile)
}
fun getBassEnhancerEnabled(profile: Int = this.profile) =
dolbyEffect.getDapParameterBool(DsParam.BASS_ENHANCER_ENABLE, profile).also {
dlog(TAG, "getBassEnhancerEnabled: $it")
}
fun setBassEnhancerEnabled(value: Boolean, profile: Int = this.profile) {
dlog(TAG, "setBassEnhancerEnabled: $value")
checkEffect()
dolbyEffect.setDapParameter(DsParam.BASS_ENHANCER_ENABLE, value, profile)
}
fun getVolumeLevelerEnabled(profile: Int = this.profile) =
dolbyEffect.getDapParameterBool(DsParam.VOLUME_LEVELER_ENABLE, profile).also {
dlog(TAG, "getVolumeLevelerEnabled: $it")
}
fun setVolumeLevelerEnabled(value: Boolean, profile: Int = this.profile) {
dlog(TAG, "setVolumeLevelerEnabled: $value")
checkEffect()
dolbyEffect.setDapParameter(DsParam.VOLUME_LEVELER_ENABLE, value, profile)
}
fun getStereoWideningAmount(profile: Int = this.profile) =
if (!stereoWideningSupported) {
0
} else {
dolbyEffect.getDapParameterInt(DsParam.STEREO_WIDENING_AMOUNT, profile).also {
dlog(TAG, "getStereoWideningAmount: $it")
}
}
fun setStereoWideningAmount(value: Int, profile: Int = this.profile) {
if (!stereoWideningSupported) return
dlog(TAG, "setStereoWideningAmount: $value")
checkEffect()
dolbyEffect.setDapParameter(DsParam.STEREO_WIDENING_AMOUNT, value, profile)
}
fun getDialogueEnhancerEnabled(profile: Int = this.profile) =
dolbyEffect.getDapParameterBool(DsParam.DIALOGUE_ENHANCER_ENABLE, profile).also {
dlog(TAG, "getDialogueEnhancerEnabled: $it")
}
fun setDialogueEnhancerEnabled(value: Boolean, profile: Int = this.profile) {
dlog(TAG, "setDialogueEnhancerEnabled: $value")
checkEffect()
dolbyEffect.setDapParameter(DsParam.DIALOGUE_ENHANCER_ENABLE, value, profile)
}
fun getDialogueEnhancerAmount(profile: Int = this.profile) =
dolbyEffect.getDapParameterInt(DsParam.DIALOGUE_ENHANCER_AMOUNT, profile).also {
dlog(TAG, "getDialogueEnhancerAmount: $it")
}
fun setDialogueEnhancerAmount(value: Int, profile: Int = this.profile) {
dlog(TAG, "setDialogueEnhancerAmount: $value")
checkEffect()
dolbyEffect.setDapParameter(DsParam.DIALOGUE_ENHANCER_AMOUNT, value, profile)
}
fun getIeqPreset(profile: Int = this.profile) =
dolbyEffect.getDapParameterInt(DsParam.IEQ_PRESET, profile).also {
dlog(TAG, "getIeqPreset: $it")
}
fun setIeqPreset(value: Int, profile: Int = this.profile) {
dlog(TAG, "setIeqPreset: $value")
checkEffect()
dolbyEffect.setDapParameter(DsParam.IEQ_PRESET, value, profile)
}
companion object {
private const val TAG = "DolbyController"
private const val EFFECT_PRIORITY = 100
private const val PREF_PRESETS = "presets"
private const val PREF_KEY_PRESETS_MIGRATED = "presets_migrated"
@Volatile
private var instance: DolbyController? = null
fun getInstance(context: Context) =
instance ?: synchronized(this) {
instance ?: DolbyController(context).also { instance = it }
}
}
}

View File

@@ -0,0 +1,69 @@
/*
* Copyright (C) 2023-25 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi
import android.app.AlertDialog
import android.os.Bundle
import android.view.Menu
import android.view.MenuItem
import android.widget.Toast
import co.aospa.dolby.xiaomi.preference.DolbySettingsFragment
import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity
class DolbySettingsActivity : CollapsingToolbarBaseActivity() {
private lateinit var dolbyController: DolbyController
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
supportFragmentManager
.beginTransaction()
.replace(
com.android.settingslib.collapsingtoolbar.R.id.content_frame,
DolbySettingsFragment(),
TAG
)
.commit()
dolbyController = DolbyController.getInstance(this)
}
override fun onCreateOptionsMenu(menu: Menu): Boolean {
menu
.add(Menu.NONE, MENU_RESET, Menu.NONE, R.string.dolby_reset_all)
.setIcon(R.drawable.reset_wrench_24px)
.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM)
return super.onCreateOptionsMenu(menu)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean =
when (item.itemId) {
MENU_RESET -> {
confirmReset()
true
}
else -> super.onOptionsItemSelected(item)
}
private fun confirmReset() {
AlertDialog.Builder(this)
.setTitle(R.string.dolby_reset_all)
.setMessage(R.string.dolby_reset_all_message)
.setPositiveButton(android.R.string.yes) { _, _ ->
dolbyController.resetAllProfiles()
recreate()
Toast.makeText(this, getString(R.string.dolby_reset_all_toast), Toast.LENGTH_SHORT)
.show()
}
.setNegativeButton(android.R.string.no, null)
.show()
}
companion object {
private const val TAG = "DolbySettingsActivity"
private const val MENU_RESET = 1001
}
}

View File

@@ -0,0 +1,36 @@
/*
* Copyright (C) 2023-24 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi
import android.service.quicksettings.Tile
import android.service.quicksettings.TileService
private const val TAG = "DolbyTileService"
class DolbyTileService : TileService() {
private val dolbyController by lazy { DolbyController.getInstance(applicationContext) }
override fun onStartListening() {
qsTile.apply {
state = if (dolbyController.dsOn) Tile.STATE_ACTIVE else Tile.STATE_INACTIVE
subtitle = dolbyController.getProfileName() ?: getString(R.string.dolby_unknown)
updateTile()
}
super.onStartListening()
}
override fun onClick() {
val isDsOn = dolbyController.dsOn
dolbyController.setDsOnAndPersist(!isDsOn) // toggle
qsTile.apply {
state = if (isDsOn) Tile.STATE_INACTIVE else Tile.STATE_ACTIVE
updateTile()
}
super.onClick()
}
}

View File

@@ -0,0 +1,71 @@
/*
* Copyright (C) 2019 The Android Open Source Project
* (C) 2023-24 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi
import android.content.ContentProvider
import android.content.ContentValues
import android.database.Cursor
import android.net.Uri
import android.os.Bundle
import co.aospa.dolby.xiaomi.R
import com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_SUMMARY
private const val KEY_DOLBY = "dolby"
/** Provide preference summary for injected items. */
class SummaryProvider : ContentProvider() {
override fun call(
method: String,
arg: String?,
extras: Bundle?
): Bundle? {
val summary = when (method) {
KEY_DOLBY -> getDolbySummary()
else -> return null
}
return Bundle().apply {
putString(META_DATA_PREFERENCE_SUMMARY, summary)
}
}
override fun onCreate(): Boolean = true
override fun query(
uri: Uri,
projection: Array<String>?,
selection: String?,
selectionArgs: Array<String>?,
sortOrder: String?
): Cursor? = null
override fun getType(uri: Uri): String? = null
override fun insert(uri: Uri, values: ContentValues?): Uri? = null
override fun delete(uri: Uri, selection: String?, selectionArgs: Array<String>?): Int = 0
override fun update(
uri: Uri,
values: ContentValues?,
selection: String?,
selectionArgs: Array<String>?
): Int = 0
private fun getDolbySummary(): String {
val context = context!!
val dolbyController = DolbyController.getInstance(context)
if (!dolbyController.dsOn) {
return context.getString(R.string.dolby_off)
}
return dolbyController.getProfileName()?.let {
context.getString(R.string.dolby_on_with_profile, it)
} ?: context.getString(R.string.dolby_on)
}
}

View File

@@ -0,0 +1,53 @@
/*
* Copyright (C) 2024 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi.geq
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.viewModels
import androidx.compose.foundation.layout.padding
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.navigation.compose.rememberNavController
import co.aospa.dolby.xiaomi.R
import co.aospa.dolby.xiaomi.geq.ui.EqualizerScreen
import co.aospa.dolby.xiaomi.geq.ui.EqualizerViewModel
import com.android.settingslib.spa.framework.compose.localNavController
import com.android.settingslib.spa.framework.theme.SettingsTheme
import com.android.settingslib.spa.widget.scaffold.SettingsScaffold
class EqualizerActivity : ComponentActivity() {
private val viewModel: EqualizerViewModel by viewModels { EqualizerViewModel.Factory }
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
SettingsTheme {
MainContent()
}
}
}
@Composable
private fun MainContent() {
val navController = rememberNavController()
CompositionLocalProvider(navController.localNavController()) {
SettingsScaffold(
title = stringResource(id = R.string.dolby_preset)
) { paddingValues ->
EqualizerScreen(
viewModel = viewModel,
modifier = Modifier.padding(paddingValues)
)
}
}
}
}

View File

@@ -0,0 +1,12 @@
/*
* Copyright (C) 2024 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi.geq.data
data class BandGain(
val band: Int,
var gain: Int = 0
)

View File

@@ -0,0 +1,183 @@
/*
* Copyright (C) 2024 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi.geq.data
import android.content.Context
import android.content.SharedPreferences
import android.util.Log
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.PREF_PRESET
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.dlog
import co.aospa.dolby.xiaomi.DolbyController
import co.aospa.dolby.xiaomi.R
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.callbackFlow
import kotlinx.coroutines.withContext
class EqualizerRepository(
private val context: Context
) {
private val dolbyController by lazy { DolbyController.getInstance(context) }
// Preset is saved as a string of comma separated gains in SharedPreferences
// and is unique to each profile ID
private val profile = dolbyController.profile
private val profileSharedPrefs by lazy {
context.getSharedPreferences(
"profile_$profile",
Context.MODE_PRIVATE
)
}
private val presetsSharedPrefs by lazy {
context.getSharedPreferences(
"presets",
Context.MODE_PRIVATE
)
}
val builtInPresets: List<Preset> by lazy {
val names = context.resources.getStringArray(
R.array.dolby_preset_entries
)
val presets = context.resources.getStringArray(
R.array.dolby_preset_values
)
List(names.size) { index ->
Preset(
name = names[index],
bandGains = deserializeGains(presets[index]),
)
}
}
val defaultPreset by lazy { builtInPresets[0] } // Flat
// User defined presets are stored in a SharedPreferences as
// key - preset name
// value - comma separated string of gains
val userPresets: Flow<List<Preset>> = callbackFlow {
val listener = SharedPreferences.OnSharedPreferenceChangeListener { _, _ ->
dlog(TAG, "presetsSharedPrefs changed")
trySend(
presetsSharedPrefs.all.map { (key, value) ->
Preset(
name = key,
bandGains = deserializeGains(value.toString()),
isUserDefined = true
)
}
)
}
presetsSharedPrefs.registerOnSharedPreferenceChangeListener(listener)
dlog(TAG, "presetsSharedPrefs registered listener")
// trigger an initial emission
listener.onSharedPreferenceChanged(presetsSharedPrefs, null)
awaitClose {
presetsSharedPrefs.unregisterOnSharedPreferenceChangeListener(listener)
dlog(TAG, "presetsSharedPrefs unregistered listener")
}
}
suspend fun getBandGains(): List<BandGain> = withContext(Dispatchers.IO) {
val gains = profileSharedPrefs.getString(PREF_PRESET, dolbyController.getPreset())
return@withContext if (gains.isNullOrEmpty()) {
defaultPreset.bandGains
} else {
deserializeGains(gains)
}.also {
dlog(TAG, "getBandGains: $it")
}
}
suspend fun setBandGains(bandGains: List<BandGain>) = withContext(Dispatchers.IO) {
dlog(TAG, "setBandGains($bandGains)")
val gains = serializeGains(bandGains)
dolbyController.setPreset(gains)
profileSharedPrefs.edit()
.putString(PREF_PRESET, gains)
.apply()
}
suspend fun addPreset(preset: Preset) = withContext(Dispatchers.IO) {
dlog(TAG, "addPreset($preset)")
presetsSharedPrefs.edit()
.putString(preset.name, serializeGains(preset.bandGains))
.apply()
}
suspend fun removePreset(preset: Preset) = withContext(Dispatchers.IO) {
dlog(TAG, "removePreset($preset)")
presetsSharedPrefs.edit()
.remove(preset.name)
.apply()
}
private companion object {
const val TAG = "EqRepository"
val tenBandFreqs = intArrayOf(
32,
64,
125,
250,
500,
1000,
2000,
4000,
8000,
16000
)
fun deserializeGains(bandGains: String): List<BandGain> {
val gains: List<Int> =
bandGains.split(",").runCatching {
require(size == 20) {
"Preset must have 20 elements, has only $size!"
}
map { it.toInt() }
.twentyToTenBandGains()
}.onFailure { exception ->
Log.e(TAG, "Failed to parse preset", exception)
}.getOrDefault(
// fallback to flat
List<Int>(10) { 0 }
)
return List(10) { index ->
BandGain(
band = tenBandFreqs[index],
gain = gains[index]
)
}
}
fun serializeGains(bandGains: List<BandGain>): String {
return bandGains.map { it.gain }
.tenToTwentyBandGains()
.joinToString(",")
}
// we show only 10 bands in UI however backend requires 20 bands
fun List<Int>.tenToTwentyBandGains() =
List<Int>(20) { index ->
if (index % 2 == 1 && index < 19) {
// every odd element is the average of its surrounding elements
(this[(index - 1) / 2] + this[(index + 1) / 2]) / 2
} else {
this[index / 2]
}
}
fun List<Int>.twentyToTenBandGains() =
// skip every odd element
filterIndexed { index, _ -> index % 2 == 0 }
}
}

View File

@@ -0,0 +1,14 @@
/*
* Copyright (C) 2024 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi.geq.data
data class Preset(
var name: String? = null,
val bandGains: List<BandGain>,
var isUserDefined: Boolean = false,
var isMutated: Boolean = false
)

View File

@@ -0,0 +1,101 @@
/*
* Copyright (C) 2024 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi.geq.ui
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.material3.Slider
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableFloatStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.TransformOrigin
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.layout
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import co.aospa.dolby.xiaomi.geq.data.BandGain
@Composable
fun BandGainSlider(
bandGain: BandGain,
onValueChangeFinished: (Int) -> Unit
) {
// Gain range is of -1->1 in UI, -100->100 in backend, but actually is -10->10 dB.
// Ensure we update the slider when gain is changed,
// for eg. when changing the preset
var sliderPosition by remember(bandGain.gain) {
mutableFloatStateOf(bandGain.gain / 100f)
}
Column(
horizontalAlignment = Alignment.CenterHorizontally,
) {
SliderText(
"%.1f".format(sliderPosition * 10f)
)
Slider(
value = sliderPosition,
onValueChange = { sliderPosition = it },
onValueChangeFinished = {
onValueChangeFinished((sliderPosition * 100f).toInt())
},
valueRange = -1f..1f,
modifier = Modifier
.graphicsLayer {
rotationZ = 270f
transformOrigin = TransformOrigin(0f, 0f)
}
.layout { measurable, constraints ->
val placeable = measurable.measure(
Constraints(
minWidth = constraints.minHeight,
maxWidth = constraints.maxHeight,
minHeight = constraints.minWidth,
maxHeight = constraints.maxHeight,
)
)
layout(placeable.height, placeable.width) {
placeable.place(-placeable.width, 0)
}
}
// horizontal and vertical dimensions are inverted due to rotation
.width(200.dp)
.height(40.dp)
.padding(8.dp)
)
SliderText(
with(bandGain.band) {
if (this >= 1000) {
"${this / 1000}k"
} else {
"$this"
}
}
)
}
}
@Composable
fun SliderText(
text: String,
modifier: Modifier = Modifier
) {
Text(
text = text,
modifier = modifier,
fontSize = 12.sp
)
}

View File

@@ -0,0 +1,71 @@
/*
* Copyright (C) 2024 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi.geq.ui
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import co.aospa.dolby.xiaomi.R
@Composable
fun BandGainSliderLabels() {
Column(
horizontalAlignment = Alignment.End,
modifier = Modifier.padding(end = 8.dp)
) {
LabelText(
stringResource(id = R.string.dolby_geq_slider_label_gain)
)
Column(
modifier = Modifier.height(200.dp),
horizontalAlignment = Alignment.End
) {
LabelText(
"+10 dB",
modifier = Modifier.padding(
top = 10.dp
)
)
Spacer(
modifier = Modifier.weight(1f)
)
LabelText("0 dB")
Spacer(
modifier = Modifier.weight(1f)
)
LabelText(
"-10 dB",
modifier = Modifier.padding(
bottom = 10.dp
)
)
}
LabelText("Hz")
}
}
@Composable
fun LabelText(
text: String,
modifier: Modifier = Modifier
) {
Text(
text = text,
modifier = modifier,
color = MaterialTheme.colorScheme.secondary,
fontSize = 12.sp
)
}

View File

@@ -0,0 +1,58 @@
/*
* Copyright (C) 2024 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi.geq.ui
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.res.stringResource
@Composable
fun ConfirmationDialog(
text: String,
onConfirm: () -> Unit,
onDismiss: () -> Unit
) {
var showDialog by remember { mutableStateOf(true) }
if (!showDialog) {
onDismiss()
return
}
AlertDialog(
onDismissRequest = { showDialog = false },
confirmButton = {
TextButton(
onClick = {
showDialog = false
onConfirm()
}
) {
Text(
stringResource(id = android.R.string.ok)
)
}
},
dismissButton = {
TextButton(
onClick = { showDialog = false }
) {
Text(
stringResource(id = android.R.string.cancel)
)
}
},
text = {
Text(text)
}
)
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (C) 2024 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi.geq.ui
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@Composable
fun EqualizerBands(viewModel: EqualizerViewModel) {
val preset by viewModel.preset.collectAsState()
val bandGains = preset.bandGains
LazyRow(
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier.fillMaxWidth()
) {
item {
BandGainSliderLabels()
}
items(bandGains.size) { index ->
BandGainSlider(
bandGains[index],
onValueChangeFinished = {
viewModel.setGain(index, it)
}
)
}
}
}

View File

@@ -0,0 +1,42 @@
/*
* Copyright (C) 2024 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi.geq.ui
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import com.android.settingslib.spa.framework.theme.settingsBackground
import com.android.settingslib.spa.framework.theme.SettingsDimension
@Composable
fun EqualizerScreen(
viewModel: EqualizerViewModel,
modifier: Modifier = Modifier
) {
Surface(
modifier = Modifier
.fillMaxSize()
.padding(SettingsDimension.itemPadding)
.then(modifier),
color = MaterialTheme.colorScheme.settingsBackground
) {
Column(
verticalArrangement = Arrangement.Top,
modifier = Modifier.fillMaxHeight()
) {
PresetSelector(viewModel = viewModel)
EqualizerBands(viewModel = viewModel)
}
}
}

View File

@@ -0,0 +1,173 @@
/*
* Copyright (C) 2024 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi.geq.ui
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.viewModelScope
import androidx.lifecycle.viewmodel.initializer
import androidx.lifecycle.viewmodel.viewModelFactory
import co.aospa.dolby.xiaomi.geq.data.EqualizerRepository
import co.aospa.dolby.xiaomi.geq.data.Preset
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.dlog
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.flow.drop
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
const val TAG = "EqViewModel"
class EqualizerViewModel(
private val repository: EqualizerRepository
) : ViewModel() {
private val _presets = MutableStateFlow<List<Preset>>(repository.builtInPresets)
val presets = _presets.asStateFlow()
private val _preset = MutableStateFlow<Preset>(repository.defaultPreset)
val preset = _preset.asStateFlow()
private var presetRestored = false
init {
// Update the list of presets: combined list of user defined presets if any,
// and then the built in presets.
repository.userPresets
.onEach { presets ->
dlog(TAG, "updated userPresets: $presets")
_presets.value = mutableListOf<Preset>().apply {
addAll(presets)
addAll(repository.builtInPresets)
}.toList()
// We can restore the active preset only after the presets list is populated,
// since we do not save the preset name but only its gains.
if (!presetRestored) {
val bandGains = repository.getBandGains()
_preset.value = _presets.value.find {
bandGains == it.bandGains
} ?: Preset(bandGains = bandGains)
dlog(TAG, "restored preset: ${_preset.value}")
presetRestored = true
}
}
.launchIn(viewModelScope)
// Update the preset in repository everytime we set it here
_preset
.drop(1) // skip the initial value
.onEach {
// wait till the active preset is restored
if (!presetRestored) {
return@onEach
}
dlog(TAG, "updated preset: $it")
repository.setBandGains(it.bandGains)
if (it.isUserDefined) {
repository.addPreset(it)
}
}
.launchIn(viewModelScope)
}
fun reset() {
dlog(TAG, "reset()")
if (_preset.value.isUserDefined) {
// Reset gains to 0
_preset.value = _preset.value.copy(
bandGains = repository.defaultPreset.bandGains
)
} else {
// Switch to flat preset
_preset.value = repository.defaultPreset
}
}
fun setPreset(preset: Preset) {
dlog(TAG, "setPreset($preset)")
_preset.value = preset
}
fun setGain(index: Int, gain: Int) {
dlog(TAG, "setGain($index, $gain)")
_preset.value = _preset.value.run {
copy(
// if we're modifying predefined preset, set name to null so UI shows "Custom"
name = if (!isUserDefined) null else name,
bandGains = bandGains
.toMutableList()
// create a new object to ensure the flow emits an update.
.apply { this[index] = this[index].copy(gain = gain) }
.toList(),
isMutated = true
)
}
}
// Returns string containing the error message if it failed, otherwise null
private fun validatePresetName(name: String): PresetNameValidationError? {
// Ensure we don't have another preset with the same name
return if (
_presets.value
.any { it.name!!.equals(name.trim(), ignoreCase = true) }
) {
PresetNameValidationError.NAME_EXISTS
} else if (name.length > 50) {
PresetNameValidationError.NAME_TOO_LONG
} else null
}
fun createNewPreset(name: String): PresetNameValidationError? {
dlog(TAG, "createNewPreset($name)")
validatePresetName(name)?.let {
dlog(TAG, "createNewPreset failed: $it")
return it
}
_preset.value = _preset.value.copy(
name = name.trim(),
isUserDefined = true,
isMutated = false
)
return null
}
fun renamePreset(preset: Preset, name: String): PresetNameValidationError? {
dlog(TAG, "renamePreset($preset, $name)")
// create a preset with the new name and same gains
createNewPreset(name = name)?.let {
dlog(TAG, "renamePreset failed")
return it
}
// and delete the old one.
deletePreset(preset, shouldReset = false)
return null
}
fun deletePreset(preset: Preset, shouldReset: Boolean = true) {
dlog(TAG, "deletePreset($preset)")
viewModelScope.launch {
repository.removePreset(preset)
}
if (shouldReset) {
_preset.value = repository.defaultPreset
}
}
companion object {
val Factory = viewModelFactory {
initializer {
EqualizerViewModel(
repository = EqualizerRepository(
this[ViewModelProvider.AndroidViewModelFactory.APPLICATION_KEY]!!
)
)
}
}
}
}

View File

@@ -0,0 +1,94 @@
/*
* Copyright (C) 2024 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi.geq.ui
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.AlertDialog
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import co.aospa.dolby.xiaomi.R
@Composable
fun PresetNameDialog(
title: String,
presetName: String = "",
onPresetNameSet: (String) -> PresetNameValidationError?,
onDismissDialog: () -> Unit
) {
var showDialog by remember { mutableStateOf(true) }
if (!showDialog) {
onDismissDialog()
return
}
var text by remember { mutableStateOf(presetName) }
var error by remember { mutableStateOf<PresetNameValidationError?>(null) }
AlertDialog(
onDismissRequest = { showDialog = false },
confirmButton = {
TextButton(
onClick = {
onPresetNameSet(text)?.let {
// validation failed
error = it
return@TextButton
}
// succeeded
showDialog = false
error = null
}
) {
Text(
stringResource(id = android.R.string.ok)
)
}
},
dismissButton = {
TextButton(
onClick = { showDialog = false }
) {
Text(
stringResource(id = android.R.string.cancel)
)
}
},
title = { Text(title) },
text = {
Column {
OutlinedTextField(
value = text,
onValueChange = { text = it },
label = {
Text(
stringResource(id = R.string.dolby_geq_preset_name)
)
},
isError = error != null,
singleLine = true
)
error?.let {
Text(
text = it.toErrorMessage(),
color = MaterialTheme.colorScheme.error,
modifier = Modifier.padding(top = 8.dp)
)
}
}
}
)
}

View File

@@ -0,0 +1,25 @@
/*
* Copyright (C) 2024 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi.geq.ui
import androidx.compose.runtime.Composable
import androidx.compose.ui.res.stringResource
import co.aospa.dolby.xiaomi.R
enum class PresetNameValidationError {
NAME_EXISTS,
NAME_TOO_LONG;
@Composable
fun toErrorMessage() =
stringResource(
id = when (this) {
NAME_EXISTS -> R.string.dolby_geq_preset_name_exists
NAME_TOO_LONG -> R.string.dolby_geq_preset_name_too_long
}
)
}

View File

@@ -0,0 +1,176 @@
/*
* Copyright (C) 2024 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi.geq.ui
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.Edit
import androidx.compose.material3.DropdownMenuItem
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ExposedDropdownMenuBox
import androidx.compose.material3.ExposedDropdownMenuDefaults
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.runtime.Composable
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.focusProperties
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.res.vectorResource
import androidx.compose.ui.unit.dp
import co.aospa.dolby.xiaomi.R
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun PresetSelector(viewModel: EqualizerViewModel) {
val presets by viewModel.presets.collectAsState()
val currentPreset by viewModel.preset.collectAsState()
var expanded by remember { mutableStateOf(false) }
var showNewPresetDialog by remember { mutableStateOf(false) }
var showRenamePresetDialog by remember { mutableStateOf(false) }
var showDeleteConfirmDialog by remember { mutableStateOf(false) }
var showResetConfirmDialog by remember { mutableStateOf(false) }
Row(
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 24.dp),
horizontalArrangement = Arrangement.Start,
verticalAlignment = Alignment.CenterVertically
) {
ExposedDropdownMenuBox(
expanded = expanded,
onExpandedChange = { expanded = !expanded },
modifier = Modifier
.padding(end = 8.dp)
.weight(1f)
) {
TextField(
value = currentPreset.name ?: stringResource(id = R.string.dolby_preset_custom),
onValueChange = { },
readOnly = true,
label = {
Text(
stringResource(id = R.string.dolby_geq_preset)
)
},
singleLine = true,
trailingIcon = {
ExposedDropdownMenuDefaults.TrailingIcon(
expanded = expanded
)
},
colors = ExposedDropdownMenuDefaults.textFieldColors(),
modifier = Modifier.menuAnchor()
// prevent keyboard from popping up
.focusProperties { canFocus = false }
)
ExposedDropdownMenu(
expanded = expanded,
onDismissRequest = { expanded = false }
) {
presets.forEach { preset ->
DropdownMenuItem(
text = { Text(text = preset.name!!) },
onClick = {
viewModel.setPreset(preset)
expanded = false
}
)
}
}
}
TooltipIconButton(
icon = ImageVector.vectorResource(
id = R.drawable.save_as_24px
),
text = stringResource(id = R.string.dolby_geq_new_preset),
onClick = { showNewPresetDialog = true }
)
if (currentPreset.isUserDefined) {
TooltipIconButton(
icon = Icons.Default.Edit,
text = stringResource(id = R.string.dolby_geq_rename_preset),
onClick = { showRenamePresetDialog = true }
)
TooltipIconButton(
icon = Icons.Default.Delete,
text = stringResource(id = R.string.dolby_geq_delete_preset),
onClick = { showDeleteConfirmDialog = true }
)
}
TooltipIconButton(
icon = ImageVector.vectorResource(
id = R.drawable.reset_settings_24px
),
text = stringResource(id = R.string.dolby_geq_reset_gains),
onClick = {
if (currentPreset.isUserDefined) {
showResetConfirmDialog = true
} else {
viewModel.reset()
}
}
)
}
// Dialogs
if (showNewPresetDialog) {
PresetNameDialog(
title = stringResource(id = R.string.dolby_geq_new_preset),
onPresetNameSet = {
return@PresetNameDialog viewModel.createNewPreset(name = it)
},
onDismissDialog = { showNewPresetDialog = false }
)
}
if (showRenamePresetDialog) {
PresetNameDialog(
title = stringResource(id = R.string.dolby_geq_rename_preset),
presetName = currentPreset.name!!,
onPresetNameSet = {
return@PresetNameDialog viewModel.renamePreset(
preset = currentPreset,
name = it
)
},
onDismissDialog = { showRenamePresetDialog = false }
)
}
if (showDeleteConfirmDialog) {
ConfirmationDialog(
text = stringResource(id = R.string.dolby_geq_delete_preset_prompt),
onConfirm = { viewModel.deletePreset(currentPreset) },
onDismiss = { showDeleteConfirmDialog = false }
)
}
if (showResetConfirmDialog) {
ConfirmationDialog(
text = stringResource(id = R.string.dolby_geq_reset_gains_prompt),
onConfirm = { viewModel.reset() },
onDismiss = { showResetConfirmDialog = false }
)
}
}

View File

@@ -0,0 +1,46 @@
/*
* Copyright (C) 2024 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi.geq.ui
import androidx.compose.foundation.layout.size
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.Text
import androidx.compose.material3.TooltipBox
import androidx.compose.material3.TooltipDefaults
import androidx.compose.material3.rememberTooltipState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.unit.dp
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun TooltipIconButton(
icon: ImageVector,
text: String,
onClick: () -> Unit
) {
TooltipBox(
positionProvider = TooltipDefaults.rememberTooltipPositionProvider(),
tooltip = {
Text(text)
},
state = rememberTooltipState()
) {
IconButton(
onClick = onClick
) {
Icon(
imageVector = icon,
contentDescription = text,
modifier = Modifier.size(24.dp)
)
}
}
}

View File

@@ -0,0 +1,42 @@
/*
* Copyright (C) 2024 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi.preference
import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.ImageView
import androidx.appcompat.content.res.AppCompatResources
import androidx.preference.ListPreference
import androidx.preference.PreferenceViewHolder
import co.aospa.dolby.xiaomi.R
// Preference with icon on the right side
class DolbyIeqPreference(
context: Context,
attrs: AttributeSet?,
) : ListPreference(context, attrs) {
init {
widgetLayoutResource = R.layout.ieq_icon_layout
}
override fun onBindViewHolder(holder: PreferenceViewHolder) {
super.onBindViewHolder(holder)
val iconView = holder.findViewById(R.id.ieq_icon)!! as ImageView
val icon = AppCompatResources.getDrawable(context, getIeqIconResId())
iconView.setImageDrawable(icon)
}
private fun getIeqIconResId(): Int =
when (findIndexOfValue(value)) {
1 -> R.drawable.ic_ieq_detailed
2 -> R.drawable.ic_ieq_balanced
3 -> R.drawable.ic_ieq_warm
else -> R.drawable.ic_ieq_off
}
}

View File

@@ -0,0 +1,64 @@
/*
* Copyright (C) 2024 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi.preference
import android.content.Context
import android.content.SharedPreferences
import androidx.preference.PreferenceDataStore
import androidx.preference.PreferenceManager
import co.aospa.dolby.xiaomi.DolbyConstants
class DolbyPreferenceStore(
private val context: Context
) : PreferenceDataStore() {
private val defaultSharedPrefs by lazy {
PreferenceManager.getDefaultSharedPreferences(context)
}
private lateinit var profileSharedPrefs: SharedPreferences
var profile = 0
set(value) {
field = value
profileSharedPrefs = context.getSharedPreferences(
"profile_$value",
Context.MODE_PRIVATE
)
}
private fun getSharedPreferences(key: String) =
if (DolbyConstants.PROFILE_SPECIFIC_PREFS.contains(key)) {
profileSharedPrefs
} else {
defaultSharedPrefs
}
override fun putBoolean(key: String, value: Boolean) =
getSharedPreferences(key).edit()
.putBoolean(key, value)
.apply()
override fun getBoolean(key: String, defValue: Boolean) =
getSharedPreferences(key).getBoolean(key, defValue)
override fun putInt(key: String, value: Int) =
getSharedPreferences(key).edit()
.putInt(key, value)
.apply()
override fun getInt(key: String, defValue: Int) =
getSharedPreferences(key).getInt(key, defValue)
override fun putString(key: String, value: String?) =
getSharedPreferences(key).edit()
.putString(key, value)
.apply()
override fun getString(key: String, defValue: String?) =
getSharedPreferences(key).getString(key, defValue)
}

View File

@@ -0,0 +1,289 @@
/*
* Copyright (C) 2023-25 Paranoid Android
*
* SPDX-License-Identifier: Apache-2.0
*/
package co.aospa.dolby.xiaomi.preference
import android.media.AudioAttributes
import android.media.AudioDeviceCallback
import android.media.AudioDeviceInfo
import android.media.AudioManager
import android.os.Bundle
import android.os.Handler
import android.widget.Toast
import androidx.core.os.postDelayed
import androidx.preference.ListPreference
import androidx.preference.Preference
import androidx.preference.Preference.OnPreferenceChangeListener
import androidx.preference.PreferenceCategory
import androidx.preference.SeekBarPreference
import androidx.preference.SwitchPreferenceCompat
import co.aospa.dolby.xiaomi.DolbyConstants
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.PREF_BASS
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.PREF_DIALOGUE
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.PREF_DIALOGUE_AMOUNT
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.PREF_ENABLE
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.PREF_HP_VIRTUALIZER
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.PREF_IEQ
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.PREF_PRESET
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.PREF_PROFILE
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.PREF_RESET
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.PREF_SPK_VIRTUALIZER
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.PREF_STEREO_WIDENING
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.PREF_VOLUME
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.dlog
import co.aospa.dolby.xiaomi.DolbyController
import co.aospa.dolby.xiaomi.R
import com.android.settingslib.widget.MainSwitchPreference
import com.android.settingslib.widget.SettingsBasePreferenceFragment
class DolbySettingsFragment : SettingsBasePreferenceFragment(),
OnPreferenceChangeListener {
private val switchBar by lazy {
findPreference<MainSwitchPreference>(PREF_ENABLE)!!
}
private val profilePref by lazy {
findPreference<ListPreference>(PREF_PROFILE)!!
}
private val presetPref by lazy {
findPreference<Preference>(PREF_PRESET)!!
}
private val ieqPref by lazy {
findPreference<DolbyIeqPreference>(PREF_IEQ)!!
}
private val dialoguePref by lazy {
findPreference<SwitchPreferenceCompat>(PREF_DIALOGUE)!!
}
private val dialogueAmountPref by lazy {
findPreference<SeekBarPreference>(PREF_DIALOGUE_AMOUNT)!!
}
private val bassPref by lazy {
findPreference<SwitchPreferenceCompat>(PREF_BASS)!!
}
private val hpVirtPref by lazy {
findPreference<SwitchPreferenceCompat>(PREF_HP_VIRTUALIZER)!!
}
private val spkVirtPref by lazy {
findPreference<SwitchPreferenceCompat>(PREF_SPK_VIRTUALIZER)!!
}
private val settingsCategory by lazy {
findPreference<PreferenceCategory>("dolby_category_settings")!!
}
private val advSettingsCategory by lazy {
findPreference<PreferenceCategory>("dolby_category_adv_settings")!!
}
private val advSettingsFooter by lazy {
findPreference<Preference>("dolby_adv_settings_footer")!!
}
private var volumePref: SwitchPreferenceCompat? = null
private var stereoPref: SeekBarPreference? = null
private val dolbyController by lazy { DolbyController.getInstance(requireContext()) }
private val audioManager by lazy { requireContext().getSystemService(AudioManager::class.java)!! }
private val handler = Handler()
private var isOnSpeaker = true
set(value) {
if (field == value) return
field = value
dlog(TAG, "setIsOnSpeaker($value)")
updateProfileSpecificPrefs()
}
private val audioDeviceCallback = object : AudioDeviceCallback() {
override fun onAudioDevicesAdded(addedDevices: Array<AudioDeviceInfo>) {
dlog(TAG, "onAudioDevicesAdded")
updateSpeakerState()
}
override fun onAudioDevicesRemoved(removedDevices: Array<AudioDeviceInfo>) {
dlog(TAG, "onAudioDevicesRemoved")
updateSpeakerState()
}
}
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
dlog(TAG, "onCreatePreferences")
setPreferencesFromResource(R.xml.dolby_settings, rootKey)
stereoPref = findPreference<SeekBarPreference>(PREF_STEREO_WIDENING)!!
if (!resources.getBoolean(R.bool.dolby_stereo_widening_supported)) {
settingsCategory.removePreference(stereoPref!!)
stereoPref = null
}
volumePref = findPreference<SwitchPreferenceCompat>(PREF_VOLUME)!!
if (!resources.getBoolean(R.bool.dolby_volume_leveler_supported)) {
advSettingsCategory.removePreference(volumePref!!)
volumePref = null
}
preferenceManager.preferenceDataStore = DolbyPreferenceStore(requireContext()).also {
it.profile = dolbyController.profile
}
val dsOn = dolbyController.dsOn
switchBar.onPreferenceChangeListener = this
switchBar.setChecked(dsOn)
profilePref.onPreferenceChangeListener = this
hpVirtPref.onPreferenceChangeListener = this
spkVirtPref.onPreferenceChangeListener = this
stereoPref?.apply {
onPreferenceChangeListener = this@DolbySettingsFragment
min = context.resources.getInteger(R.integer.stereo_widening_min)
max = context.resources.getInteger(R.integer.stereo_widening_max)
}
dialoguePref.onPreferenceChangeListener = this
dialogueAmountPref.apply {
onPreferenceChangeListener = this@DolbySettingsFragment
min = context.resources.getInteger(R.integer.dialogue_enhancer_min)
max = context.resources.getInteger(R.integer.dialogue_enhancer_max)
}
bassPref.onPreferenceChangeListener = this
volumePref?.onPreferenceChangeListener = this
ieqPref.onPreferenceChangeListener = this
audioManager.registerAudioDeviceCallback(audioDeviceCallback, handler)
updateSpeakerState()
updateProfileSpecificPrefsImmediate()
}
override fun onDestroyView() {
dlog(TAG, "onDestroyView")
audioManager.unregisterAudioDeviceCallback(audioDeviceCallback)
handler.removeCallbacksAndMessages(null)
super.onDestroyView()
}
override fun onResume() {
super.onResume()
updateProfileSpecificPrefsImmediate()
}
override fun onPreferenceChange(preference: Preference, newValue: Any): Boolean {
dlog(TAG, "onPreferenceChange: key=${preference.key} value=$newValue")
when (preference.key) {
PREF_ENABLE -> {
val isChecked = newValue as Boolean
dlog(TAG, "PREF_ENABLE -> $isChecked")
dolbyController.dsOn = isChecked
updateProfileSpecificPrefs()
}
PREF_PROFILE -> {
val profile = newValue.toString().toInt()
dolbyController.profile = profile
updateProfileSpecificPrefs()
}
PREF_SPK_VIRTUALIZER -> {
dolbyController.setSpeakerVirtEnabled(newValue as Boolean)
}
PREF_HP_VIRTUALIZER -> {
dolbyController.setHeadphoneVirtEnabled(newValue as Boolean)
}
PREF_STEREO_WIDENING -> {
dolbyController.setStereoWideningAmount(newValue as Int)
}
PREF_DIALOGUE -> {
dolbyController.setDialogueEnhancerEnabled(newValue as Boolean)
}
PREF_DIALOGUE_AMOUNT -> {
dolbyController.setDialogueEnhancerAmount(newValue as Int)
}
PREF_BASS -> {
dolbyController.setBassEnhancerEnabled(newValue as Boolean)
}
PREF_VOLUME -> {
dolbyController.setVolumeLevelerEnabled(newValue as Boolean)
}
PREF_IEQ -> {
dolbyController.setIeqPreset(newValue.toString().toInt())
}
else -> return false
}
return true
}
private fun updateSpeakerState() {
val device = audioManager.getDevicesForAttributes(ATTRIBUTES_MEDIA)[0]
isOnSpeaker = (device.type == AudioDeviceInfo.TYPE_BUILTIN_SPEAKER)
}
private fun updateProfileSpecificPrefs() {
handler.postDelayed(100) { updateProfileSpecificPrefsImmediate() }
}
private fun updateProfileSpecificPrefsImmediate() {
if (context == null) return
if (!dolbyController.dsOn) {
dlog(TAG, "updateProfileSpecificPrefs: Dolby is off")
advSettingsCategory.isVisible = false
return
}
val unknownRes = getString(R.string.dolby_unknown)
val headphoneRes = getString(R.string.dolby_connect_headphones)
val currentProfile = dolbyController.profile
val isDynamicProfile = currentProfile == 0
(preferenceManager.preferenceDataStore as DolbyPreferenceStore).profile = currentProfile
dlog(TAG, "updateProfileSpecificPrefs: currentProfile=$currentProfile")
profilePref.apply {
if (entryValues.contains(currentProfile.toString())) {
summary = "%s"
value = currentProfile.toString()
} else {
summary = unknownRes
dlog(TAG, "current profile $currentProfile unknown")
}
}
// hide advanced settings on dynamic profile
advSettingsCategory.isVisible = !isDynamicProfile
advSettingsFooter.isVisible = isDynamicProfile
presetPref.summary = dolbyController.getPresetName()
bassPref.isChecked = dolbyController.getBassEnhancerEnabled(currentProfile)
// below prefs are not visible on dynamic profile
if (isDynamicProfile) return
val ieqValue = dolbyController.getIeqPreset(currentProfile)
ieqPref.apply {
if (entryValues.contains(ieqValue.toString())) {
summary = "%s"
value = ieqValue.toString()
} else {
summary = unknownRes
dlog(TAG, "ieq value $ieqValue unknown")
}
}
dialoguePref.isChecked = dolbyController.getDialogueEnhancerEnabled(currentProfile)
dialogueAmountPref.value = dolbyController.getDialogueEnhancerAmount(currentProfile)
spkVirtPref.isChecked = dolbyController.getSpeakerVirtEnabled(currentProfile)
volumePref?.isChecked = dolbyController.getVolumeLevelerEnabled(currentProfile)
hpVirtPref.isChecked = dolbyController.getHeadphoneVirtEnabled(currentProfile)
stereoPref?.value = dolbyController.getStereoWideningAmount(currentProfile)
}
companion object {
private const val TAG = "DolbySettingsFragment"
private val ATTRIBUTES_MEDIA = AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_MEDIA)
.build()
}
}

View File

@@ -1,11 +0,0 @@
<compatibility-matrix version="4.0" type="framework">
<hal format="hidl" optional="true">
<name>vendor.dolby.hardware.dms</name>
<transport>hwbinder</transport>
<version>2.0</version>
<interface>
<name>IDms</name>
<instance>default</instance>
</interface>
</hal>
</compatibility-matrix>

17
libshims/Android.bp Normal file
View File

@@ -0,0 +1,17 @@
//
// Copyright (C) 2023 The LineageOS Project
//
// SPDX-License-Identifier: Apache-2.0
//
cc_library_shared {
name: "libshim_dolby",
srcs: ["libshim_dolby.cpp"],
compile_multilib: "64",
shared_libs: [
"liblog",
"libdl",
"libc",
],
vendor: true,
}

View File

@@ -0,0 +1,27 @@
//
// SPDX-FileCopyrightText: The LineageOS Project
// SPDX-License-Identifier: Apache-2.0
//
#include <log/log.h>
#include <dlfcn.h>
extern "C" void _ZNK7android7RefBase9incStrongEPKv(void* thisptr, const void* id) {
if (!thisptr) {
ALOGE("DolbyShim: incStrong called on nullptr!");
return;
}
typedef void (*RealFunc)(void*, const void*);
static RealFunc real = (RealFunc)dlsym(RTLD_NEXT, "_ZNK7android7RefBase9incStrongEPKv");
if (real) real(thisptr, id);
}
extern "C" void _ZNK7android7RefBase9decStrongEPKv(void* thisptr, const void* id) {
if (!thisptr) {
ALOGE("DolbyShim: decStrong called on nullptr!");
return;
}
typedef void (*RealFunc)(void*, const void*);
static RealFunc real = (RealFunc)dlsym(RTLD_NEXT, "_ZNK7android7RefBase9decStrongEPKv");
if (real) real(thisptr, id);
}

View File

@@ -0,0 +1,4 @@
runtime_resource_overlay {
name: "DolbyFrameworksResCommon",
product_specific: true,
}

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.overlay.dolby">
<overlay
android:isStatic="true"
android:priority="300"
android:targetPackage="android" />
</manifest>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
SPDX-License-Identifier: Apache-2.0
-->
<resources>
<!-- The default value for whether head tracking for
spatial audio is enabled for a newly connected audio device -->
<bool name="config_spatial_audio_head_tracking_enabled_default">true</bool>
</resources>

View File

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<privapp-permissions package="com.dolby.daxappui">
<permission name="android.permission.INTERACT_ACROSS_USERS"/>
<permission name="android.permission.MANAGE_USERS"/>
</privapp-permissions>
</permissions>

View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--Copyright (C) 2018 Dolby Laboratories
* This program is protected under international and U.S. copyright laws as
* an unpublished work. This program is confidential and proprietary to the
* copyright owners. Reproduction or disclosure, in whole or in part, or the
* production of derivative works therefrom without the express permission of
* the copyright owners is prohibited.
* Copyright (C) 2018-2019 by Dolby Laboratories.
* All rights reserved.
-->
<permissions>
<privapp-permissions package="com.dolby.daxservice">
<permission name="android.permission.INTERACT_ACROSS_USERS"/>
<permission name="android.permission.MANAGE_USERS"/>
<permission name="android.permission.WRITE_SECURE_SETTINGS"/>
<permission name="android.permission.SUBSTITUTE_NOTIFICATION_APP_NAME"/>
</privapp-permissions>
</permissions>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<hidden-api-whitelisted-app package="com.dolby.daxappui"/>
<allow-in-power-save package="com.dolby.daxappui"/>
</config>

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<hidden-api-whitelisted-app package="com.dolby.daxservice"/>
<allow-in-power-save package="com.dolby.daxservice"/>
</config>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<config>
<hidden-api-whitelisted-app package="com.dolby.daxservice"/>
</config>

BIN
proprietary/vendor/bin/hw/vendor.dolby.hardware.dms@2.0-service vendored Normal file → Executable file

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,7 @@
service vendor-dolby-media-c2-hal-1-0 /vendor/bin/hw/vendor.dolby.media.c2@1.0-service
class hal
user mediacodec
group camera mediadrm drmrpc
ioprio rt 4
writepid /dev/cpuset/foreground/tasks

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
proprietary/vendor/lib64/libdlbpreg.so vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More