Compare commits
33 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 02d5796d3a | |||
|
|
c0de818eba | ||
|
|
4609a70e95 | ||
|
|
2ac524b54c | ||
| f42bd8b0b0 | |||
| 3e5a418ec2 | |||
|
|
a87374584b | ||
|
|
823cb93c6e | ||
|
|
298cc0e0a2 | ||
|
|
9bb5037bc0 | ||
|
|
0c9ddc4349 | ||
|
|
9034fe64c9 | ||
|
|
ff98f55a64 | ||
|
|
d520bfc991 | ||
|
|
898b66db90 | ||
|
|
ba30d4f198 | ||
|
|
756f07541f | ||
|
|
8d1f1dec6f | ||
|
|
708d38f721 | ||
|
|
5d570a07fe | ||
|
|
7a34fbab8f | ||
|
|
80dde88580 | ||
|
|
b78ed962c9 | ||
|
|
0aa344b92c | ||
|
|
21b1b920de | ||
|
|
97abb34497 | ||
|
|
f102f6b9b0 | ||
|
|
caedc60497 | ||
|
|
97387bcbb5 | ||
|
|
e33ef72395 | ||
|
|
6cc96db8d4 | ||
|
|
6a92f5625e | ||
|
|
5bddfe4ab8 |
346
Android.bp
346
Android.bp
@@ -14,3 +14,349 @@
|
||||
|
||||
soong_namespace {
|
||||
}
|
||||
|
||||
cc_prebuilt_library_shared {
|
||||
name: "libdapparamstorage",
|
||||
owner: "xiaomi",
|
||||
strip: {
|
||||
none: true,
|
||||
},
|
||||
target: {
|
||||
android_arm: {
|
||||
srcs: ["proprietary/vendor/lib/libdapparamstorage.so"],
|
||||
shared_libs: ["libcutils", "libutils", "liblog", "libc++", "libc", "libm", "libdl", ],
|
||||
},
|
||||
android_arm64: {
|
||||
srcs: ["proprietary/vendor/lib64/libdapparamstorage.so"],
|
||||
shared_libs: ["libcutils", "libutils", "liblog", "libc++", "libc", "libm", "libdl", ],
|
||||
},
|
||||
},
|
||||
compile_multilib: "both",
|
||||
prefer: true,
|
||||
soc_specific: true,
|
||||
}
|
||||
|
||||
cc_prebuilt_library_shared {
|
||||
name: "libdlbpreg",
|
||||
owner: "xiaomi",
|
||||
strip: {
|
||||
none: true,
|
||||
},
|
||||
target: {
|
||||
android_arm: {
|
||||
srcs: ["proprietary/vendor/lib/libdlbpreg.so"],
|
||||
shared_libs: ["liblog", "libutils", "libcutils", "libaudioutils", "libstagefright_foundation-v33", "libc++", "libc", "libm", "libdl", ],
|
||||
},
|
||||
android_arm64: {
|
||||
srcs: ["proprietary/vendor/lib64/libdlbpreg.so"],
|
||||
shared_libs: ["liblog", "libutils", "libcutils", "libaudioutils", "libstagefright_foundation-v33", "libc++", "libc", "libm", "libdl", ],
|
||||
},
|
||||
},
|
||||
compile_multilib: "both",
|
||||
prefer: true,
|
||||
soc_specific: true,
|
||||
}
|
||||
|
||||
cc_prebuilt_library_shared {
|
||||
name: "vendor.dolby.hardware.dms@2.0",
|
||||
owner: "xiaomi",
|
||||
strip: {
|
||||
none: true,
|
||||
},
|
||||
target: {
|
||||
android_arm: {
|
||||
srcs: ["proprietary/vendor/lib/vendor.dolby.hardware.dms@2.0.so"],
|
||||
shared_libs: ["libhidlbase", "liblog", "libutils", "libcutils", "libc++", "libc", "libm", "libdl", ],
|
||||
},
|
||||
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: "both",
|
||||
prefer: true,
|
||||
soc_specific: true,
|
||||
}
|
||||
|
||||
cc_prebuilt_library_shared {
|
||||
name: "libdlbdsservice",
|
||||
owner: "xiaomi",
|
||||
strip: {
|
||||
none: true,
|
||||
},
|
||||
target: {
|
||||
android_arm64: {
|
||||
srcs: ["proprietary/vendor/lib64/libdlbdsservice.so"],
|
||||
shared_libs: ["libutils", "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: "liboem_specific",
|
||||
owner: "xiaomi",
|
||||
strip: {
|
||||
none: true,
|
||||
},
|
||||
target: {
|
||||
android_arm64: {
|
||||
srcs: ["proprietary/vendor/lib64/liboem_specific.so"],
|
||||
shared_libs: ["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_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", "libstagefright_foundation-v33", "libcutils", "libbase", "liblog", "libcodec2", "libcodec2_vndk", "libutils", "libcodec2_soft_dolby", "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", "libstagefright_foundation-v33", "libcutils", "libbase", "liblog", "libcodec2", "libcodec2_vndk", "libutils", "libcodec2_soft_dolby", "libcodec2_store_dolby", "libc++", "libc", "libm", "libdl", ],
|
||||
},
|
||||
},
|
||||
compile_multilib: "64",
|
||||
prefer: true,
|
||||
soc_specific: true,
|
||||
}
|
||||
|
||||
cc_prebuilt_library_shared {
|
||||
name: "libcodec2_soft_dolby",
|
||||
owner: "xiaomi",
|
||||
strip: {
|
||||
none: true,
|
||||
},
|
||||
target: {
|
||||
android_arm64: {
|
||||
srcs: ["proprietary/vendor/lib64/libcodec2_soft_dolby.so"],
|
||||
shared_libs: ["libbase", "libcodec2", "libcodec2_vndk", "libutils", "libcutils", "liblog", "libstagefright_foundation-v33", "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: ["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: ["libshim_dolby", "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_arm: {
|
||||
srcs: ["proprietary/vendor/lib/soundfx/libdlbvol.so"],
|
||||
shared_libs: ["liblog", "libutils", "libcutils", "libaudioutils", "libstagefright_foundation-v33", "libdlbpreg", "vendor.dolby.hardware.dms@2.0", "libc++", "libc", "libm", "libdl", ],
|
||||
},
|
||||
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: "both",
|
||||
relative_install_path: "soundfx",
|
||||
prefer: true,
|
||||
soc_specific: true,
|
||||
}
|
||||
|
||||
cc_prebuilt_library_shared {
|
||||
name: "libswdap",
|
||||
owner: "xiaomi",
|
||||
strip: {
|
||||
none: true,
|
||||
},
|
||||
target: {
|
||||
android_arm: {
|
||||
srcs: ["proprietary/vendor/lib/soundfx/libswdap.so"],
|
||||
shared_libs: ["liblog", "libutils", "libcutils", "libaudioutils", "libdapparamstorage", "libhidlbase", "libstagefright_foundation-v33", "libdlbpreg", "vendor.dolby.hardware.dms@2.0", "libc++", "libc", "libm", "libdl", ],
|
||||
},
|
||||
android_arm64: {
|
||||
srcs: ["proprietary/vendor/lib64/soundfx/libswdap.so"],
|
||||
shared_libs: ["liblog", "libutils", "libcutils", "libaudioutils", "libdapparamstorage", "libhidlbase", "libstagefright_foundation-v33", "libdlbpreg", "vendor.dolby.hardware.dms@2.0", "libc++", "libc", "libm", "libdl", ],
|
||||
},
|
||||
},
|
||||
compile_multilib: "both",
|
||||
relative_install_path: "soundfx",
|
||||
prefer: true,
|
||||
soc_specific: true,
|
||||
}
|
||||
|
||||
cc_prebuilt_library_shared {
|
||||
name: "libswgamedap",
|
||||
owner: "xiaomi",
|
||||
strip: {
|
||||
none: true,
|
||||
},
|
||||
target: {
|
||||
android_arm: {
|
||||
srcs: ["proprietary/vendor/lib/soundfx/libswgamedap.so"],
|
||||
shared_libs: ["liblog", "libutils", "libcutils", "libaudioutils", "libdapparamstorage", "libhidlbase", "vendor.dolby.hardware.dms@2.0", "libc++", "libc", "libm", "libdl", ],
|
||||
},
|
||||
android_arm64: {
|
||||
srcs: ["proprietary/vendor/lib64/soundfx/libswgamedap.so"],
|
||||
shared_libs: ["liblog", "libutils", "libcutils", "libaudioutils", "libdapparamstorage", "libhidlbase", "vendor.dolby.hardware.dms@2.0", "libc++", "libc", "libm", "libdl", ],
|
||||
},
|
||||
},
|
||||
compile_multilib: "both",
|
||||
relative_install_path: "soundfx",
|
||||
prefer: true,
|
||||
soc_specific: true,
|
||||
}
|
||||
|
||||
cc_prebuilt_library_shared {
|
||||
name: "libswvqe",
|
||||
owner: "xiaomi",
|
||||
strip: {
|
||||
none: true,
|
||||
},
|
||||
target: {
|
||||
android_arm: {
|
||||
srcs: ["proprietary/vendor/lib/soundfx/libswvqe.so"],
|
||||
shared_libs: ["liblog", "libutils", "libcutils", "libaudioutils", "libdapparamstorage", "libhidlbase", "vendor.dolby.hardware.dms@2.0", "libc++", "libc", "libm", "libdl", ],
|
||||
},
|
||||
android_arm64: {
|
||||
srcs: ["proprietary/vendor/lib64/soundfx/libswvqe.so"],
|
||||
shared_libs: ["liblog", "libutils", "libcutils", "libaudioutils", "libdapparamstorage", "libhidlbase", "vendor.dolby.hardware.dms@2.0", "libc++", "libc", "libm", "libdl", ],
|
||||
},
|
||||
},
|
||||
compile_multilib: "both",
|
||||
relative_install_path: "soundfx",
|
||||
prefer: true,
|
||||
soc_specific: true,
|
||||
}
|
||||
|
||||
cc_prebuilt_library_shared {
|
||||
name: "libspatialaudio",
|
||||
owner: "xiaomi",
|
||||
strip: {
|
||||
none: true,
|
||||
},
|
||||
target: {
|
||||
android_arm: {
|
||||
srcs: ["proprietary/vendor/lib/soundfx/libspatialaudio.so"],
|
||||
shared_libs: ["libaudioutils", "libcutils", "liblog", "libc++", "libc", "libm", "libdl", ],
|
||||
},
|
||||
android_arm64: {
|
||||
srcs: ["proprietary/vendor/lib64/soundfx/libspatialaudio.so"],
|
||||
shared_libs: ["libaudioutils", "libcutils", "liblog", "libc++", "libc", "libm", "libdl", ],
|
||||
},
|
||||
},
|
||||
compile_multilib: "both",
|
||||
relative_install_path: "soundfx",
|
||||
prefer: true,
|
||||
soc_specific: true,
|
||||
}
|
||||
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
//
|
||||
// Copyright (C) 2024-2025 The LineageOS Project
|
||||
//
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
android_app {
|
||||
name: "DSPVolumeSynchronizer",
|
||||
certificate: "platform",
|
||||
srcs: ["src/**/*.java"],
|
||||
platform_apis: true,
|
||||
privileged: true,
|
||||
system_ext_specific: true,
|
||||
static_libs: [
|
||||
"androidx.core_core",
|
||||
"SettingsLib",
|
||||
],
|
||||
|
||||
required: [
|
||||
"privapp-permissions-dspvolume",
|
||||
"config-dspvolume",
|
||||
],
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "privapp-permissions-dspvolume",
|
||||
relative_install_path: "permissions",
|
||||
src: "privapp-permissions-dspvolume.xml",
|
||||
system_ext_specific: true,
|
||||
filename_from_src: true,
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "config-dspvolume",
|
||||
relative_install_path: "sysconfig",
|
||||
src: "config-dspvolume.xml",
|
||||
system_ext_specific: true,
|
||||
filename_from_src: true,
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.lineageos.dspvolume.xiaomi"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0"
|
||||
android:sharedUserId="android.uid.system">
|
||||
|
||||
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
|
||||
<application
|
||||
android:label="@string/app_name"
|
||||
android:persistent="true"
|
||||
android:defaultToDeviceProtectedStorage="true"
|
||||
android:directBootAware="true">
|
||||
|
||||
<receiver
|
||||
android:name=".BootReceiver"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.RECEIVE_BOOT_COMPLETED">
|
||||
<intent-filter android:priority="999">
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<service
|
||||
android:name=".VolumeListenerService" />
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<config>
|
||||
<allow-in-power-save package="org.lineageos.dspvolume.xiaomi" />
|
||||
<hidden-api-whitelisted-app package="org.lineageos.dspvolume.xiaomi" />
|
||||
</config>
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<permissions>
|
||||
<privapp-permissions package="org.lineageos.dspvolume.xiaomi">
|
||||
<permission name="android.permission.INTERACT_ACROSS_USERS" />
|
||||
<permission name="android.permission.INTERACT_ACROSS_USERS_FULL" />
|
||||
<permission name="android.permission.MODIFY_AUDIO_SETTINGS" />
|
||||
<permission name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
</privapp-permissions>
|
||||
</permissions>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- App Name -->
|
||||
<string name="app_name">DSP Volume Synchronizer</string>
|
||||
</resources>
|
||||
@@ -1,16 +0,0 @@
|
||||
package org.lineageos.dspvolume.xiaomi;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
|
||||
public class BootReceiver extends BroadcastReceiver {
|
||||
@Override
|
||||
public void onReceive(final Context context, Intent intent) {
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
context.startService(new Intent(context, VolumeListenerService.class));
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package org.lineageos.dspvolume.xiaomi;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.media.AudioManager;
|
||||
import android.util.Log;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
public class VolumeListenerReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (context == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(intent.getIntExtra("android.media.EXTRA_VOLUME_STREAM_TYPE", 0) == AudioManager.STREAM_MUSIC) {
|
||||
AudioManager audioManager = context.getSystemService(AudioManager.class);
|
||||
int current = intent.getIntExtra(
|
||||
"android.media.EXTRA_VOLUME_STREAM_VALUE",
|
||||
0
|
||||
);
|
||||
audioManager.setParameters("volume_change=" + current + ";flags=8");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package org.lineageos.dspvolume.xiaomi;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.media.AudioManager;
|
||||
import android.os.IBinder;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
public class VolumeListenerService extends Service {
|
||||
@Nullable
|
||||
@Override
|
||||
public IBinder onBind(Intent intent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
IntentFilter intentFilter = new IntentFilter();
|
||||
intentFilter.addAction("android.media.VOLUME_CHANGED_ACTION");
|
||||
registerReceiver(new VolumeListenerReceiver(), intentFilter);
|
||||
|
||||
AudioManager audioManager = getSystemService(AudioManager.class);
|
||||
int current = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
|
||||
audioManager.setParameters("volume_change=" + current + ";flags=8");
|
||||
|
||||
return super.onStartCommand(intent, flags, startId);
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@
|
||||
//
|
||||
|
||||
android_app {
|
||||
name: "XiaomiDolby",
|
||||
name: "DolbyManager",
|
||||
|
||||
srcs: ["src/**/*.kt"],
|
||||
resource_dirs: ["res"],
|
||||
@@ -23,15 +23,6 @@ android_app {
|
||||
"androidx.compose.material3_material3",
|
||||
"androidx.compose.runtime_runtime",
|
||||
"androidx.preference_preference",
|
||||
"org.lineageos.settings.resources",
|
||||
"com.google.android.material_material",
|
||||
],
|
||||
|
||||
required: ["preinstalled-packages-platform-dolby.xml"],
|
||||
}
|
||||
|
||||
prebuilt_etc {
|
||||
name: "preinstalled-packages-platform-dolby.xml",
|
||||
src: "preinstalled-packages-platform-dolby.xml",
|
||||
sub_dir: "sysconfig",
|
||||
system_ext_specific: true,
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
-->
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="co.aospa.dolby.xiaomi"
|
||||
package="co.aospa.dolby"
|
||||
android:sharedUserId="android.uid.system">
|
||||
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
@@ -13,7 +13,8 @@
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:allowBackup="false"
|
||||
android:label="@string/dolby_title"
|
||||
android:persistent="true">
|
||||
android:persistent="true"
|
||||
android:theme="@style/Theme.SubSettingsBase.Expressive">
|
||||
|
||||
<receiver
|
||||
android:name=".BootCompletedReceiver"
|
||||
@@ -26,7 +27,6 @@
|
||||
<activity
|
||||
android:name=".DolbyActivity"
|
||||
android:label="@string/dolby_title"
|
||||
android:theme="@style/Theme.SubSettingsBase"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="com.android.settings.action.IA_SETTINGS" />
|
||||
@@ -44,13 +44,12 @@
|
||||
<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" />
|
||||
android:value="content://co.aospa.dolby.summary/dolby" />
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
android:name=".geq.EqualizerActivity"
|
||||
android:label="@string/dolby_preset"
|
||||
android:theme="@style/Theme.SubSettingsBase"
|
||||
android:exported="true" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
@@ -71,7 +70,7 @@
|
||||
|
||||
<provider
|
||||
android:name=".SummaryProvider"
|
||||
android:authorities="co.aospa.dolby.xiaomi.summary">
|
||||
android:authorities="co.aospa.dolby.summary">
|
||||
</provider>
|
||||
|
||||
</application>
|
||||
11
DolbyManager/res/drawable/ic_profile_custom.xml
Executable file
11
DolbyManager/res/drawable/ic_profile_custom.xml
Executable file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:tint="?android:attr/colorControlNormal"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="72.0"
|
||||
android:viewportHeight="72.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M45,9L45,27L51,27L51,21L63,21L63,15L51,15L51,9L45,9M9,15L9,21L39,21L39,15L9,15M21,27L21,33L9,33L9,39L21,39L21,45L27,45L27,27L21,27M33,33L33,39L63,39L63,33L33,33M33,45L33,63L39,63L39,57L63,57L63,51L39,51L39,45L33,45M9,51L9,57L27,57L27,51L9,51z"/>
|
||||
</vector>
|
||||
11
DolbyManager/res/drawable/ic_profile_dynamic.xml
Executable file
11
DolbyManager/res/drawable/ic_profile_dynamic.xml
Executable file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:tint="?android:attr/colorControlNormal"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="72.0"
|
||||
android:viewportHeight="72.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M21,6L21,39L30,39L30,66C34.0185,62.1036 36.3516,56.7839 39.2006,52C43.3436,45.0435 48.7076,37.7933 51,30L40,30C43.3656,21.916 48.5711,14.4315 51,6L21,6z"/>
|
||||
</vector>
|
||||
11
DolbyManager/res/drawable/ic_profile_movie.xml
Executable file
11
DolbyManager/res/drawable/ic_profile_movie.xml
Executable file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:tint="?android:attr/colorControlNormal"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="72.0"
|
||||
android:viewportHeight="72.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M7.84,13.82C9.62,11.74 12.52,12.02 14.98,11.95C16.97,15.97 19,19.98 21,24C24,24 27,24 30,24C28,20 26,16 24,12C26,12 28,12 30,12C32,16 34,20 36,24C39,24 42,24 45,24C43,20 41,16 39,12C41,12 43,12 45,12C47,16 49,20 51,24C54,24 57,24 60,24C58,20 56,16 54,12C58,12 62,12 66,12C65.99,25.69 66.01,39.38 66,53.07C66.42,56.49 63.62,59.98 60.12,59.96C44.39,60.06 28.66,59.97 12.93,60C9.52,60.43 6.02,57.62 6.04,54.12C5.93,42.75 6.06,31.37 6,19.99C5.95,17.82 6.08,15.36 7.84,13.82Z"/>
|
||||
</vector>
|
||||
11
DolbyManager/res/drawable/ic_profile_music.xml
Executable file
11
DolbyManager/res/drawable/ic_profile_music.xml
Executable file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:tint="?android:attr/colorControlNormal"
|
||||
android:height="24dp"
|
||||
android:width="24dp"
|
||||
android:viewportWidth="72.0"
|
||||
android:viewportHeight="72.0">
|
||||
<path
|
||||
android:fillColor="#FF000000"
|
||||
android:pathData="M36,9L36,40C32.245,38.8901 27.6726,38.2912 24.0154,40.179C17.5734,43.5044 15.8784,53.3215 20.4336,58.8912C25.822,65.4796 38.0937,64.1632 41.2577,55.9961C42.655,52.3894 42,47.7931 42,44L42,21L54,21L54,9L36,9z"/>
|
||||
</vector>
|
||||
63
DolbyManager/res/layout-v34/settingslib_main_switch_bar.xml
Normal file
63
DolbyManager/res/layout-v34/settingslib_main_switch_bar.xml
Normal file
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2023 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.
|
||||
-->
|
||||
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:minHeight="?android:attr/listPreferredItemHeight"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingTop="@dimen/settingslib_switchbar_margin"
|
||||
android:paddingBottom="@dimen/settingslib_switchbar_margin"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/frame"
|
||||
android:minHeight="@dimen/settingslib_min_switch_bar_height"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:paddingStart="@dimen/settingslib_switchbar_padding_left"
|
||||
android:paddingEnd="@dimen/settingslib_switchbar_padding_right"
|
||||
android:background="@drawable/settingslib_switch_bar_bg">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/switch_text"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="0dp"
|
||||
android:layout_weight="1"
|
||||
android:layout_marginEnd="@dimen/settingslib_switch_title_margin"
|
||||
android:layout_marginVertical="@dimen/settingslib_switch_title_margin"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:ellipsize="end"
|
||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
||||
android:hyphenationFrequency="normalFast"
|
||||
android:lineBreakWordStyle="phrase"
|
||||
style="@style/MainSwitchText.Settingslib" />
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
android:id="@android:id/switch_widget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:theme="@style/Theme.Material3.DynamicColors.DayNight" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
26
DolbyManager/res/layout/preference_widget_switch_compat.xml
Normal file
26
DolbyManager/res/layout/preference_widget_switch_compat.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
~ Copyright (C) 2023 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.
|
||||
-->
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/switchWidget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:clickable="false"
|
||||
android:focusable="false"
|
||||
android:theme="@style/Theme.Material3.DynamicColors.DayNight" />
|
||||
@@ -8,18 +8,16 @@
|
||||
<!-- Dolby Atmos -->
|
||||
<string-array name="dolby_profile_entries">
|
||||
<item>@string/dolby_profile_dynamic</item>
|
||||
<item>@string/dolby_profile_video</item>
|
||||
<item>@string/dolby_profile_movie</item>
|
||||
<item>@string/dolby_profile_music</item>
|
||||
<item>@string/dolby_profile_game</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>9</item>
|
||||
<item>3</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="dolby_preset_entries" translatable="false">
|
||||
@@ -75,16 +73,12 @@
|
||||
|
||||
<string-array name="dolby_stereo_entries">
|
||||
<item>@string/dolby_low</item>
|
||||
<item>@string/dolby_medium</item>
|
||||
<item>@string/dolby_high</item>
|
||||
<item>@string/dolby_max</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="dolby_stereo_values">
|
||||
<item>4</item>
|
||||
<item>24</item>
|
||||
<item>44</item>
|
||||
<item>64</item>
|
||||
<item>40</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="dolby_ieq_entries">
|
||||
@@ -31,10 +31,9 @@
|
||||
|
||||
<!-- Dolby profiles -->
|
||||
<string name="dolby_profile_dynamic">Dynamic</string>
|
||||
<string name="dolby_profile_video">Movie/Video</string>
|
||||
<string name="dolby_profile_movie">Movie</string>
|
||||
<string name="dolby_profile_music">Music</string>
|
||||
<string name="dolby_profile_game">Game</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>
|
||||
@@ -18,8 +18,7 @@
|
||||
android:entryValues="@array/dolby_profile_values"
|
||||
android:defaultValue="0"
|
||||
android:title="@string/dolby_profile_title"
|
||||
android:summary="%s"
|
||||
android:icon="@drawable/ic_dolby" />
|
||||
android:summary="%s" />
|
||||
|
||||
<PreferenceCategory
|
||||
android:title="@string/dolby_category_settings">
|
||||
@@ -29,11 +28,11 @@
|
||||
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" />
|
||||
android:targetPackage="co.aospa.dolby"
|
||||
android:targetClass="co.aospa.dolby.geq.EqualizerActivity" />
|
||||
</Preference>
|
||||
|
||||
<co.aospa.dolby.xiaomi.preference.DolbyIeqPreference
|
||||
<co.aospa.dolby.preference.DolbyIeqPreference
|
||||
android:key="dolby_ieq"
|
||||
android:entries="@array/dolby_ieq_entries"
|
||||
android:entryValues="@array/dolby_ieq_values"
|
||||
@@ -4,14 +4,14 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi
|
||||
package co.aospa.dolby
|
||||
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.util.Log
|
||||
|
||||
private const val TAG = "XiaomiDolby-Boot"
|
||||
private const val TAG = "Dolby-Boot"
|
||||
|
||||
class BootCompletedReceiver : BroadcastReceiver() {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi
|
||||
package co.aospa.dolby
|
||||
|
||||
import android.os.Bundle
|
||||
import co.aospa.dolby.xiaomi.preference.DolbySettingsFragment
|
||||
import co.aospa.dolby.preference.DolbySettingsFragment
|
||||
import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity
|
||||
|
||||
private const val TAG = "DolbyActivity"
|
||||
@@ -16,7 +16,7 @@ class DolbyActivity : CollapsingToolbarBaseActivity() {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
fragmentManager.beginTransaction()
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(com.android.settingslib.collapsingtoolbar.R.id.content_frame, DolbySettingsFragment(), TAG)
|
||||
.commit()
|
||||
}
|
||||
@@ -4,11 +4,11 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi
|
||||
package co.aospa.dolby
|
||||
|
||||
import android.media.audiofx.AudioEffect
|
||||
import co.aospa.dolby.xiaomi.DolbyConstants.Companion.dlog
|
||||
import co.aospa.dolby.xiaomi.DolbyConstants.DsParam
|
||||
import co.aospa.dolby.DolbyConstants.Companion.dlog
|
||||
import co.aospa.dolby.DolbyConstants.DsParam
|
||||
import java.util.UUID
|
||||
|
||||
class DolbyAudioEffect(priority: Int, audioSession: Int) : AudioEffect(
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi
|
||||
package co.aospa.dolby
|
||||
|
||||
import android.util.Log
|
||||
|
||||
@@ -27,7 +27,7 @@ class DolbyConstants {
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val TAG = "XiaomiDolby"
|
||||
const val TAG = "Dolby"
|
||||
const val PREF_ENABLE = "dolby_enable"
|
||||
const val PREF_PROFILE = "dolby_profile"
|
||||
const val PREF_PRESET = "dolby_preset"
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi
|
||||
package co.aospa.dolby
|
||||
|
||||
import android.content.Context
|
||||
import android.media.AudioDeviceCallback
|
||||
@@ -15,9 +15,9 @@ 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
|
||||
import co.aospa.dolby.DolbyConstants.Companion.dlog
|
||||
import co.aospa.dolby.DolbyConstants.DsParam
|
||||
import co.aospa.dolby.R
|
||||
|
||||
internal class DolbyController private constructor(
|
||||
private val context: Context
|
||||
@@ -4,13 +4,12 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi.preference
|
||||
package co.aospa.dolby
|
||||
|
||||
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
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi.preference
|
||||
package co.aospa.dolby
|
||||
|
||||
import android.media.AudioAttributes
|
||||
import android.media.AudioDeviceCallback
|
||||
@@ -13,69 +13,52 @@ import android.media.AudioManager
|
||||
import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.widget.CompoundButton
|
||||
import android.widget.CompoundButton.OnCheckedChangeListener
|
||||
import android.widget.Toast
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.Preference.OnPreferenceChangeListener
|
||||
import androidx.preference.PreferenceFragment
|
||||
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_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
|
||||
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 co.aospa.dolby.DolbyConstants.Companion.dlog
|
||||
import co.aospa.dolby.R
|
||||
import com.android.settingslib.widget.MainSwitchPreference
|
||||
import com.android.settingslib.widget.SettingsBasePreferenceFragment
|
||||
|
||||
class DolbySettingsFragment : PreferenceFragment(),
|
||||
class DolbySettingsFragment : SettingsBasePreferenceFragment(),
|
||||
OnPreferenceChangeListener, CompoundButton.OnCheckedChangeListener {
|
||||
|
||||
private val switchBar by lazy {
|
||||
findPreference<MainSwitchPreference>(PREF_ENABLE)!!
|
||||
findPreference<MainSwitchPreference>(DolbyConstants.PREF_ENABLE)!!
|
||||
}
|
||||
private val profilePref by lazy {
|
||||
findPreference<ListPreference>(PREF_PROFILE)!!
|
||||
findPreference<ListPreference>(DolbyConstants.PREF_PROFILE)!!
|
||||
}
|
||||
private val presetPref by lazy {
|
||||
findPreference<Preference>(PREF_PRESET)!!
|
||||
}
|
||||
private val ieqPref by lazy {
|
||||
findPreference<DolbyIeqPreference>(PREF_IEQ)!!
|
||||
findPreference<Preference>(DolbyConstants.PREF_PRESET)!!
|
||||
}
|
||||
private val stereoPref by lazy {
|
||||
findPreference<ListPreference>(PREF_STEREO)!!
|
||||
findPreference<ListPreference>(DolbyConstants.PREF_STEREO)!!
|
||||
}
|
||||
private val dialoguePref by lazy {
|
||||
findPreference<ListPreference>(PREF_DIALOGUE)!!
|
||||
findPreference<ListPreference>(DolbyConstants.PREF_DIALOGUE)!!
|
||||
}
|
||||
private val bassPref by lazy {
|
||||
findPreference<SwitchPreferenceCompat>(PREF_BASS)!!
|
||||
findPreference<SwitchPreferenceCompat>(DolbyConstants.PREF_BASS)!!
|
||||
}
|
||||
private val hpVirtPref by lazy {
|
||||
findPreference<SwitchPreferenceCompat>(PREF_HP_VIRTUALIZER)!!
|
||||
findPreference<SwitchPreferenceCompat>(DolbyConstants.PREF_HP_VIRTUALIZER)!!
|
||||
}
|
||||
private val spkVirtPref by lazy {
|
||||
findPreference<SwitchPreferenceCompat>(PREF_SPK_VIRTUALIZER)!!
|
||||
findPreference<SwitchPreferenceCompat>(DolbyConstants.PREF_SPK_VIRTUALIZER)!!
|
||||
}
|
||||
private val volumePref by lazy {
|
||||
findPreference<SwitchPreferenceCompat>(PREF_VOLUME)!!
|
||||
findPreference<SwitchPreferenceCompat>(DolbyConstants.PREF_VOLUME)!!
|
||||
}
|
||||
private val resetPref by lazy {
|
||||
findPreference<Preference>(PREF_RESET)!!
|
||||
findPreference<Preference>(DolbyConstants.PREF_RESET)!!
|
||||
}
|
||||
|
||||
private val dolbyController by lazy { DolbyController.getInstance(context) }
|
||||
private val audioManager by lazy { context.getSystemService(AudioManager::class.java) }
|
||||
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
|
||||
@@ -100,13 +83,14 @@ class DolbySettingsFragment : PreferenceFragment(),
|
||||
|
||||
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
|
||||
dlog(TAG, "onCreatePreferences")
|
||||
addPreferencesFromResource(R.xml.dolby_settings)
|
||||
|
||||
val profile = dolbyController.profile
|
||||
preferenceManager.preferenceDataStore = DolbyPreferenceStore(context).also {
|
||||
preferenceManager.preferenceDataStore = DolbyPreferenceStore(requireContext()).also {
|
||||
it.profile = profile
|
||||
}
|
||||
|
||||
setPreferencesFromResource(R.xml.dolby_settings, rootKey)
|
||||
|
||||
val dsOn = dolbyController.dsOn
|
||||
switchBar.addOnSwitchChangeListener(this)
|
||||
switchBar.setChecked(dsOn)
|
||||
@@ -118,7 +102,7 @@ class DolbySettingsFragment : PreferenceFragment(),
|
||||
summary = "%s"
|
||||
value = profile.toString()
|
||||
} else {
|
||||
summary = context.getString(R.string.dolby_unknown)
|
||||
summary = getString(R.string.dolby_unknown)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,14 +112,13 @@ class DolbySettingsFragment : PreferenceFragment(),
|
||||
dialoguePref.onPreferenceChangeListener = this
|
||||
bassPref.onPreferenceChangeListener = this
|
||||
volumePref.onPreferenceChangeListener = this
|
||||
ieqPref.onPreferenceChangeListener = this
|
||||
|
||||
resetPref.setOnPreferenceClickListener {
|
||||
dolbyController.resetProfileSpecificSettings()
|
||||
updateProfileSpecificPrefs()
|
||||
Toast.makeText(
|
||||
context,
|
||||
context.getString(R.string.dolby_reset_profile_toast, profilePref.summary),
|
||||
requireContext(),
|
||||
getString(R.string.dolby_reset_profile_toast, profilePref.summary),
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
true
|
||||
@@ -160,41 +143,37 @@ class DolbySettingsFragment : PreferenceFragment(),
|
||||
override fun onPreferenceChange(preference: Preference, newValue: Any): Boolean {
|
||||
dlog(TAG, "onPreferenceChange: key=${preference.key} value=$newValue")
|
||||
when (preference.key) {
|
||||
PREF_PROFILE -> {
|
||||
DolbyConstants.PREF_PROFILE -> {
|
||||
val profile = newValue.toString().toInt()
|
||||
dolbyController.profile = profile
|
||||
(preferenceManager.preferenceDataStore as DolbyPreferenceStore).profile = profile
|
||||
updateProfileSpecificPrefs()
|
||||
}
|
||||
|
||||
PREF_SPK_VIRTUALIZER -> {
|
||||
DolbyConstants.PREF_SPK_VIRTUALIZER -> {
|
||||
dolbyController.setSpeakerVirtEnabled(newValue as Boolean)
|
||||
}
|
||||
|
||||
PREF_HP_VIRTUALIZER -> {
|
||||
DolbyConstants.PREF_HP_VIRTUALIZER -> {
|
||||
dolbyController.setHeadphoneVirtEnabled(newValue as Boolean)
|
||||
}
|
||||
|
||||
PREF_STEREO -> {
|
||||
DolbyConstants.PREF_STEREO -> {
|
||||
dolbyController.setStereoWideningAmount(newValue.toString().toInt())
|
||||
}
|
||||
|
||||
PREF_DIALOGUE -> {
|
||||
DolbyConstants.PREF_DIALOGUE -> {
|
||||
dolbyController.setDialogueEnhancerAmount(newValue.toString().toInt())
|
||||
}
|
||||
|
||||
PREF_BASS -> {
|
||||
DolbyConstants.PREF_BASS -> {
|
||||
dolbyController.setBassEnhancerEnabled(newValue as Boolean)
|
||||
}
|
||||
|
||||
PREF_VOLUME -> {
|
||||
DolbyConstants.PREF_VOLUME -> {
|
||||
dolbyController.setVolumeLevelerEnabled(newValue as Boolean)
|
||||
}
|
||||
|
||||
PREF_IEQ -> {
|
||||
dolbyController.setIeqPreset(newValue.toString().toInt())
|
||||
}
|
||||
|
||||
else -> return false
|
||||
}
|
||||
return true
|
||||
@@ -213,8 +192,8 @@ class DolbySettingsFragment : PreferenceFragment(),
|
||||
}
|
||||
|
||||
private fun updateProfileSpecificPrefs() {
|
||||
val unknownRes = context.getString(R.string.dolby_unknown)
|
||||
val headphoneRes = context.getString(R.string.dolby_connect_headphones)
|
||||
val unknownRes = getString(R.string.dolby_unknown)
|
||||
val headphoneRes = getString(R.string.dolby_connect_headphones)
|
||||
val dsOn = dolbyController.dsOn
|
||||
val currentProfile = dolbyController.profile
|
||||
|
||||
@@ -226,28 +205,17 @@ class DolbySettingsFragment : PreferenceFragment(),
|
||||
val enable = dsOn && (currentProfile != -1)
|
||||
presetPref.setEnabled(enable)
|
||||
spkVirtPref.setEnabled(enable)
|
||||
ieqPref.setEnabled(enable)
|
||||
dialoguePref.setEnabled(enable)
|
||||
volumePref.setEnabled(enable)
|
||||
bassPref.setEnabled(enable)
|
||||
resetPref.setEnabled(enable)
|
||||
hpVirtPref.setEnabled(enable && !isOnSpeaker)
|
||||
stereoPref.setEnabled(enable && !isOnSpeaker)
|
||||
bassPref.setEnabled(enable)
|
||||
|
||||
if (!enable) return
|
||||
|
||||
presetPref.summary = dolbyController.getPresetName()
|
||||
|
||||
val ieqValue = dolbyController.getIeqPreset(currentProfile)
|
||||
ieqPref.apply {
|
||||
if (entryValues.contains(ieqValue.toString())) {
|
||||
summary = "%s"
|
||||
value = ieqValue.toString()
|
||||
} else {
|
||||
summary = unknownRes
|
||||
}
|
||||
}
|
||||
|
||||
val deValue = dolbyController.getDialogueEnhancerAmount(currentProfile).toString()
|
||||
dialoguePref.apply {
|
||||
if (entryValues.contains(deValue)) {
|
||||
@@ -260,11 +228,11 @@ class DolbySettingsFragment : PreferenceFragment(),
|
||||
|
||||
spkVirtPref.setChecked(dolbyController.getSpeakerVirtEnabled(currentProfile))
|
||||
volumePref.setChecked(dolbyController.getVolumeLevelerEnabled(currentProfile))
|
||||
bassPref.setChecked(dolbyController.getBassEnhancerEnabled(currentProfile))
|
||||
|
||||
// below prefs are not enabled on loudspeaker
|
||||
if (isOnSpeaker) {
|
||||
stereoPref.summary = headphoneRes
|
||||
bassPref.summary = headphoneRes
|
||||
hpVirtPref.summary = headphoneRes
|
||||
return
|
||||
}
|
||||
@@ -279,6 +247,11 @@ class DolbySettingsFragment : PreferenceFragment(),
|
||||
}
|
||||
}
|
||||
|
||||
bassPref.apply {
|
||||
setChecked(dolbyController.getBassEnhancerEnabled(currentProfile))
|
||||
summary = null
|
||||
}
|
||||
|
||||
hpVirtPref.apply {
|
||||
setChecked(dolbyController.getHeadphoneVirtEnabled(currentProfile))
|
||||
summary = null
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi
|
||||
package co.aospa.dolby
|
||||
|
||||
import android.service.quicksettings.Tile
|
||||
import android.service.quicksettings.TileService
|
||||
@@ -5,14 +5,14 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi
|
||||
package co.aospa.dolby
|
||||
|
||||
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 co.aospa.dolby.R
|
||||
import com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_SUMMARY
|
||||
|
||||
private const val KEY_DOLBY = "dolby"
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi.geq
|
||||
package co.aospa.dolby.geq
|
||||
|
||||
import android.os.Bundle
|
||||
import androidx.activity.ComponentActivity
|
||||
@@ -16,9 +16,9 @@ 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 co.aospa.dolby.R
|
||||
import co.aospa.dolby.geq.ui.EqualizerScreen
|
||||
import co.aospa.dolby.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
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi.geq.data
|
||||
package co.aospa.dolby.geq.data
|
||||
|
||||
data class BandGain(
|
||||
val band: Int,
|
||||
@@ -4,15 +4,15 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi.geq.data
|
||||
package co.aospa.dolby.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 co.aospa.dolby.DolbyConstants.Companion.PREF_PRESET
|
||||
import co.aospa.dolby.DolbyConstants.Companion.dlog
|
||||
import co.aospa.dolby.DolbyController
|
||||
import co.aospa.dolby.R
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.channels.awaitClose
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi.geq.data
|
||||
package co.aospa.dolby.geq.data
|
||||
|
||||
data class Preset(
|
||||
var name: String,
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi.geq.ui
|
||||
package co.aospa.dolby.geq.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.height
|
||||
@@ -25,7 +25,7 @@ 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
|
||||
import co.aospa.dolby.geq.data.BandGain
|
||||
|
||||
@Composable
|
||||
fun BandGainSlider(
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi.geq.ui
|
||||
package co.aospa.dolby.geq.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
@@ -18,7 +18,7 @@ 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
|
||||
import co.aospa.dolby.R
|
||||
|
||||
@Composable
|
||||
fun BandGainSliderLabels() {
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi.geq.ui
|
||||
package co.aospa.dolby.geq.ui
|
||||
|
||||
import androidx.compose.material3.AlertDialog
|
||||
import androidx.compose.material3.Text
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi.geq.ui
|
||||
package co.aospa.dolby.geq.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi.geq.ui
|
||||
package co.aospa.dolby.geq.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
@@ -4,16 +4,16 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi.geq.ui
|
||||
package co.aospa.dolby.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 co.aospa.dolby.geq.data.EqualizerRepository
|
||||
import co.aospa.dolby.geq.data.Preset
|
||||
import co.aospa.dolby.DolbyConstants.Companion.dlog
|
||||
import kotlinx.coroutines.flow.MutableStateFlow
|
||||
import kotlinx.coroutines.flow.asStateFlow
|
||||
import kotlinx.coroutines.flow.drop
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi.geq.ui
|
||||
package co.aospa.dolby.geq.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.padding
|
||||
@@ -21,7 +21,7 @@ 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
|
||||
import co.aospa.dolby.R
|
||||
|
||||
@Composable
|
||||
fun PresetNameDialog(
|
||||
@@ -4,11 +4,11 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi.geq.ui
|
||||
package co.aospa.dolby.geq.ui
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import co.aospa.dolby.xiaomi.R
|
||||
import co.aospa.dolby.R
|
||||
|
||||
enum class PresetNameValidationError {
|
||||
NAME_EXISTS,
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi.geq.ui
|
||||
package co.aospa.dolby.geq.ui
|
||||
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Row
|
||||
@@ -33,7 +33,7 @@ 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
|
||||
import co.aospa.dolby.R
|
||||
|
||||
@OptIn(ExperimentalMaterial3Api::class)
|
||||
@Composable
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi.geq.ui
|
||||
package co.aospa.dolby.geq.ui
|
||||
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
@@ -27,7 +27,7 @@ fun TooltipIconButton(
|
||||
onClick: () -> Unit
|
||||
) {
|
||||
TooltipBox(
|
||||
positionProvider = TooltipDefaults.rememberPlainTooltipPositionProvider(),
|
||||
positionProvider = TooltipDefaults.rememberTooltipPositionProvider(),
|
||||
tooltip = {
|
||||
Text(text)
|
||||
},
|
||||
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.xiaomi.preference
|
||||
package co.aospa.dolby.preference
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
@@ -13,7 +13,7 @@ import android.widget.ImageView
|
||||
import androidx.appcompat.content.res.AppCompatResources
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.PreferenceViewHolder
|
||||
import co.aospa.dolby.xiaomi.R
|
||||
import co.aospa.dolby.R
|
||||
|
||||
// Preference with icon on the right side
|
||||
class DolbyIeqPreference(
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Paranoid Android
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.preference
|
||||
|
||||
import android.content.Context
|
||||
import android.content.SharedPreferences
|
||||
import androidx.preference.PreferenceDataStore
|
||||
import androidx.preference.PreferenceManager
|
||||
import co.aospa.dolby.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)
|
||||
}
|
||||
@@ -0,0 +1,275 @@
|
||||
/*
|
||||
* Copyright (C) 2023-24 Paranoid Android
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package co.aospa.dolby.preference
|
||||
|
||||
import android.content.Context
|
||||
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.os.Looper
|
||||
import android.view.View
|
||||
import android.widget.CompoundButton
|
||||
import android.widget.Toast
|
||||
import androidx.preference.ListPreference
|
||||
import androidx.preference.Preference
|
||||
import androidx.preference.SwitchPreferenceCompat
|
||||
import co.aospa.dolby.DolbyConstants.Companion.PREF_BASS
|
||||
import co.aospa.dolby.DolbyConstants.Companion.PREF_DIALOGUE
|
||||
import co.aospa.dolby.DolbyConstants.Companion.PREF_ENABLE
|
||||
import co.aospa.dolby.DolbyConstants.Companion.PREF_HP_VIRTUALIZER
|
||||
import co.aospa.dolby.DolbyConstants.Companion.PREF_IEQ
|
||||
import co.aospa.dolby.DolbyConstants.Companion.PREF_PRESET
|
||||
import co.aospa.dolby.DolbyConstants.Companion.PREF_PROFILE
|
||||
import co.aospa.dolby.DolbyConstants.Companion.PREF_RESET
|
||||
import co.aospa.dolby.DolbyConstants.Companion.PREF_SPK_VIRTUALIZER
|
||||
import co.aospa.dolby.DolbyConstants.Companion.PREF_STEREO
|
||||
import co.aospa.dolby.DolbyConstants.Companion.PREF_VOLUME
|
||||
import co.aospa.dolby.DolbyConstants.Companion.dlog
|
||||
import co.aospa.dolby.DolbyController
|
||||
import co.aospa.dolby.R
|
||||
import com.android.settingslib.widget.MainSwitchPreference
|
||||
import com.android.settingslib.widget.SettingsBasePreferenceFragment
|
||||
|
||||
class DolbySettingsFragment : SettingsBasePreferenceFragment(),
|
||||
Preference.OnPreferenceChangeListener, CompoundButton.OnCheckedChangeListener {
|
||||
|
||||
private val appContext: Context
|
||||
get() = requireContext().applicationContext
|
||||
|
||||
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 stereoPref by lazy { findPreference<ListPreference>(PREF_STEREO)!! }
|
||||
private val dialoguePref by lazy { findPreference<ListPreference>(PREF_DIALOGUE)!! }
|
||||
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 volumePref by lazy { findPreference<SwitchPreferenceCompat>(PREF_VOLUME)!! }
|
||||
private val resetPref by lazy { findPreference<Preference>(PREF_RESET)!! }
|
||||
|
||||
private val dolbyController by lazy(LazyThreadSafetyMode.NONE) {
|
||||
DolbyController.getInstance(appContext)
|
||||
}
|
||||
private val audioManager by lazy(LazyThreadSafetyMode.NONE) {
|
||||
appContext.getSystemService(AudioManager::class.java)
|
||||
}
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
val profile = dolbyController.profile
|
||||
preferenceManager.preferenceDataStore = DolbyPreferenceStore(appContext).also {
|
||||
it.profile = profile
|
||||
}
|
||||
|
||||
val dsOn = dolbyController.dsOn
|
||||
switchBar.addOnSwitchChangeListener(this)
|
||||
switchBar.isChecked = dsOn
|
||||
|
||||
profilePref.onPreferenceChangeListener = this
|
||||
updateProfileIcon(profile)
|
||||
profilePref.isEnabled = dsOn
|
||||
profilePref.apply {
|
||||
if (entryValues.contains(profile.toString())) {
|
||||
summary = "%s"
|
||||
value = profile.toString()
|
||||
} else {
|
||||
summary = getString(R.string.dolby_unknown)
|
||||
}
|
||||
}
|
||||
|
||||
hpVirtPref.onPreferenceChangeListener = this
|
||||
spkVirtPref.onPreferenceChangeListener = this
|
||||
stereoPref.onPreferenceChangeListener = this
|
||||
dialoguePref.onPreferenceChangeListener = this
|
||||
bassPref.onPreferenceChangeListener = this
|
||||
volumePref.onPreferenceChangeListener = this
|
||||
ieqPref.onPreferenceChangeListener = this
|
||||
|
||||
resetPref.setOnPreferenceClickListener {
|
||||
dolbyController.resetProfileSpecificSettings()
|
||||
updateProfileSpecificPrefs()
|
||||
Toast.makeText(
|
||||
appContext,
|
||||
getString(R.string.dolby_reset_profile_toast, profilePref.summary),
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
true
|
||||
}
|
||||
|
||||
audioManager?.registerAudioDeviceCallback(audioDeviceCallback, handler)
|
||||
updateSpeakerState()
|
||||
updateProfileSpecificPrefs()
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
dlog(TAG, "onDestroyView")
|
||||
audioManager?.unregisterAudioDeviceCallback(audioDeviceCallback)
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
updateProfileSpecificPrefs()
|
||||
}
|
||||
|
||||
override fun onPreferenceChange(preference: Preference, newValue: Any): Boolean {
|
||||
dlog(TAG, "onPreferenceChange: key=${preference.key} value=$newValue")
|
||||
when (preference.key) {
|
||||
PREF_PROFILE -> {
|
||||
val profile = newValue.toString().toInt()
|
||||
dolbyController.profile = profile
|
||||
(preferenceManager.preferenceDataStore as DolbyPreferenceStore).profile = profile
|
||||
updateProfileIcon(profile)
|
||||
updateProfileSpecificPrefs()
|
||||
}
|
||||
PREF_SPK_VIRTUALIZER -> dolbyController.setSpeakerVirtEnabled(newValue as Boolean)
|
||||
PREF_HP_VIRTUALIZER -> dolbyController.setHeadphoneVirtEnabled(newValue as Boolean)
|
||||
PREF_STEREO -> dolbyController.setStereoWideningAmount(newValue.toString().toInt())
|
||||
PREF_DIALOGUE -> dolbyController.setDialogueEnhancerAmount(newValue.toString().toInt())
|
||||
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
|
||||
}
|
||||
|
||||
override fun onCheckedChanged(buttonView: CompoundButton, isChecked: Boolean) {
|
||||
dlog(TAG, "onCheckedChanged($isChecked)")
|
||||
dolbyController.dsOn = isChecked
|
||||
profilePref.isEnabled = isChecked
|
||||
updateProfileSpecificPrefs()
|
||||
}
|
||||
|
||||
private fun updateSpeakerState() {
|
||||
val devices = audioManager
|
||||
?.getDevicesForAttributes(ATTRIBUTES_MEDIA)
|
||||
.orEmpty()
|
||||
val firstType = devices.firstOrNull()?.type
|
||||
isOnSpeaker = (firstType == AudioDeviceInfo.TYPE_BUILTIN_SPEAKER)
|
||||
}
|
||||
|
||||
private fun updateProfileSpecificPrefs() {
|
||||
val unknownRes = getString(R.string.dolby_unknown)
|
||||
val headphoneRes = getString(R.string.dolby_connect_headphones)
|
||||
val dsOn = dolbyController.dsOn
|
||||
val currentProfile = dolbyController.profile
|
||||
|
||||
dlog(
|
||||
TAG, "updateProfileSpecificPrefs: dsOn=$dsOn currentProfile=$currentProfile"
|
||||
+ " isOnSpeaker=$isOnSpeaker"
|
||||
)
|
||||
|
||||
val enable = dsOn && (currentProfile != -1)
|
||||
presetPref.isEnabled = enable
|
||||
spkVirtPref.isEnabled = enable
|
||||
ieqPref.isEnabled = enable
|
||||
dialoguePref.isEnabled = enable
|
||||
volumePref.isEnabled = enable
|
||||
bassPref.isEnabled = enable
|
||||
resetPref.isEnabled = enable
|
||||
hpVirtPref.isEnabled = enable && !isOnSpeaker
|
||||
stereoPref.isEnabled = enable && !isOnSpeaker
|
||||
|
||||
if (!enable) return
|
||||
|
||||
presetPref.summary = dolbyController.getPresetName()
|
||||
|
||||
val ieqValue = dolbyController.getIeqPreset(currentProfile)
|
||||
ieqPref.apply {
|
||||
if (entryValues.contains(ieqValue.toString())) {
|
||||
summary = "%s"
|
||||
value = ieqValue.toString()
|
||||
} else {
|
||||
summary = unknownRes
|
||||
}
|
||||
}
|
||||
|
||||
val deValue = dolbyController.getDialogueEnhancerAmount(currentProfile).toString()
|
||||
dialoguePref.apply {
|
||||
if (entryValues.contains(deValue)) {
|
||||
summary = "%s"
|
||||
value = deValue
|
||||
} else {
|
||||
summary = unknownRes
|
||||
}
|
||||
}
|
||||
|
||||
spkVirtPref.isChecked = dolbyController.getSpeakerVirtEnabled(currentProfile)
|
||||
volumePref.isChecked = dolbyController.getVolumeLevelerEnabled(currentProfile)
|
||||
bassPref.isChecked = dolbyController.getBassEnhancerEnabled(currentProfile)
|
||||
|
||||
// below prefs are not enabled on loudspeaker
|
||||
if (isOnSpeaker) {
|
||||
stereoPref.summary = headphoneRes
|
||||
hpVirtPref.summary = headphoneRes
|
||||
return
|
||||
}
|
||||
|
||||
val swValue = dolbyController.getStereoWideningAmount(currentProfile).toString()
|
||||
stereoPref.apply {
|
||||
if (entryValues.contains(swValue)) {
|
||||
summary = "%s"
|
||||
value = swValue
|
||||
} else {
|
||||
summary = unknownRes
|
||||
}
|
||||
}
|
||||
|
||||
hpVirtPref.apply {
|
||||
isChecked = dolbyController.getHeadphoneVirtEnabled(currentProfile)
|
||||
summary = null
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateProfileIcon(profile: Int) {
|
||||
when (profile) {
|
||||
0 -> profilePref.setIcon(R.drawable.ic_profile_dynamic)
|
||||
1 -> profilePref.setIcon(R.drawable.ic_profile_movie)
|
||||
2 -> profilePref.setIcon(R.drawable.ic_profile_music)
|
||||
3 -> profilePref.setIcon(R.drawable.ic_profile_custom)
|
||||
else -> profilePref.setIcon(R.drawable.ic_dolby)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "DolbySettingsFragment"
|
||||
private val ATTRIBUTES_MEDIA = AudioAttributes.Builder()
|
||||
.setUsage(AudioAttributes.USAGE_MEDIA)
|
||||
.build()
|
||||
}
|
||||
}
|
||||
19
README.mkdn
19
README.mkdn
@@ -1,4 +1,4 @@
|
||||
Xiaomi Dolby
|
||||
Sony Dolby
|
||||
==============
|
||||
|
||||
Getting Started
|
||||
@@ -43,18 +43,19 @@ The only change done above is changing := symbol to += so that manifest can't be
|
||||
|
||||
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/2295d515b2d24cb94cc0545b0f80c20ca93af761
|
||||
[**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/acbc197257083339b9d1b738c5b613f4a0feec7f
|
||||
|
||||
[**3**] https://github.com/Spanish-or-Vanish/android_device_xiaomi_sm8350-common/commit/0182c5b44f0984845b8fb71a6006ecd4abffc9d3
|
||||
|
||||
[**4**] https://github.com/Spanish-or-Vanish/android_device_xiaomi_sm8350-common/commit/e64cfcc3382ac6915d7d513ef7a69a64eb00659c
|
||||
|
||||
[**5**] https://github.com/Spanish-or-Vanish/android_device_xiaomi_sm8350-common/commit/463cd46921e1451c9b8315334f8cf01998469b6d
|
||||
[**2**] https://github.com/Spanish-or-Vanish/android_device_xiaomi_sm8350-common/commit/f5abe4a589d54d8363b0f3458e09e3c069cf6384
|
||||
|
||||
#### 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)
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2024 crDroid Android 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.
|
||||
-->
|
||||
<config>
|
||||
|
||||
<!-- Dolby -->
|
||||
<install-in-user-type package="co.aospa.dolby.xiaomi">
|
||||
<install-in user-type="FULL" />
|
||||
<install-in user-type="PROFILE" />
|
||||
<do-not-install-in user-type="android.os.usertype.profile.CLONE" />
|
||||
<do-not-install-in user-type="android.os.usertype.profile.PRIVATE" />
|
||||
</install-in-user-type>
|
||||
</config>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,30 +1,14 @@
|
||||
<?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>
|
||||
@@ -51,5 +35,13 @@
|
||||
</Type>
|
||||
</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>
|
||||
|
||||
74
dolby.mk
74
dolby.mk
@@ -38,9 +38,15 @@ PRODUCT_COPY_FILES += \
|
||||
$(DOLBY_PATH)/configs/media_codecs_dolby_audio.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs_dolby_audio.xml
|
||||
|
||||
# Dolby VNDK libs
|
||||
PRODUCT_COPY_FILES += \
|
||||
prebuilts/vndk/v33/arm/arch-arm-armv7-a-neon/shared/vndk-core/libstagefright_foundation.so:$(TARGET_COPY_OUT_VENDOR)/lib/libstagefright_foundation-v33.so \
|
||||
prebuilts/vndk/v33/arm64/arch-arm64-armv8-a/shared/vndk-core/libstagefright_foundation.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libstagefright_foundation-v33.so
|
||||
PRODUCT_PACKAGES += \
|
||||
libstagefright_foundation-v33
|
||||
|
||||
PRODUCT_PACKAGES += \
|
||||
libshim_dolby
|
||||
|
||||
# Init
|
||||
PRODUCT_PACKAGES += \
|
||||
init.dolby.rc
|
||||
|
||||
# Overlays
|
||||
PRODUCT_PACKAGES += \
|
||||
@@ -62,9 +68,8 @@ PRODUCT_PROPERTY_OVERRIDES += \
|
||||
persist.vendor.audio.spatializer.speaker_enabled=true \
|
||||
|
||||
# Spatial Audio Proprietary blobs
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib/soundfx/libspatialaudio.so:$(TARGET_COPY_OUT_VENDOR)/lib/soundfx/libspatialaudio.so \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib64/soundfx/libspatialaudio.so:$(TARGET_COPY_OUT_VENDOR)/lib64/soundfx/libspatialaudio.so \
|
||||
PRODUCT_PACKAGES += \
|
||||
libspatialaudio
|
||||
|
||||
# Media (C2)
|
||||
PRODUCT_PACKAGES += \
|
||||
@@ -92,51 +97,34 @@ PRODUCT_VENDOR_PROPERTIES += \
|
||||
PRODUCT_PACKAGES += \
|
||||
RemovePackagesDolby
|
||||
|
||||
# DSP Volume Synchronizer
|
||||
PRODUCT_PACKAGES += \
|
||||
DSPVolumeSynchronizer
|
||||
|
||||
# XiaomiDolby
|
||||
# DolbyManager
|
||||
PRODUCT_PACKAGES += \
|
||||
XiaomiDolby \
|
||||
DolbyManager
|
||||
|
||||
# Dolby Proprietary blobs
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DOLBY_PATH)/proprietary/vendor/bin/hw/vendor.dolby.hardware.dms@2.0-service:$(TARGET_COPY_OUT_VENDOR)/bin/hw/vendor.dolby.hardware.dms@2.0-service \
|
||||
$(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 \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib/libdapparamstorage.so:$(TARGET_COPY_OUT_VENDOR)/lib/libdapparamstorage.so \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib/soundfx/libswgamedap.so:$(TARGET_COPY_OUT_VENDOR)/lib/soundfx/libswgamedap.so \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib/soundfx/libswvqe.so:$(TARGET_COPY_OUT_VENDOR)/lib/soundfx/libswvqe.so \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib/vendor.dolby.hardware.dms@2.0.so:$(TARGET_COPY_OUT_VENDOR)/lib/vendor.dolby.hardware.dms@2.0.so \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib64/libdapparamstorage.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libdapparamstorage.so \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib64/libdeccfg.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libdeccfg.so \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib64/soundfx/libswgamedap.so:$(TARGET_COPY_OUT_VENDOR)/lib64/soundfx/libswgamedap.so \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib64/soundfx/libswvqe.so:$(TARGET_COPY_OUT_VENDOR)/lib64/soundfx/libswvqe.so \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib64/vendor.dolby.hardware.dms@2.0-impl.so:$(TARGET_COPY_OUT_VENDOR)/lib64/vendor.dolby.hardware.dms@2.0-impl.so \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib64/vendor.dolby.hardware.dms@2.0.so:$(TARGET_COPY_OUT_VENDOR)/lib64/vendor.dolby.hardware.dms@2.0.so \
|
||||
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib/libdlbpreg.so:$(TARGET_COPY_OUT_VENDOR)/lib/libdlbpreg.so \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib/soundfx/libswdap.so:$(TARGET_COPY_OUT_VENDOR)/lib/soundfx/libswdap.so \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib64/libdlbpreg.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libdlbpreg.so \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib64/liboem_specific.so:$(TARGET_COPY_OUT_VENDOR)/lib64/liboem_specific.so \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib64/soundfx/libswdap.so:$(TARGET_COPY_OUT_VENDOR)/lib64/soundfx/libswdap.so \
|
||||
|
||||
# Codec2 (Dolby)
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DOLBY_PATH)/proprietary/vendor/bin/hw/vendor.dolby.media.c2@1.0-service:$(TARGET_COPY_OUT_VENDOR)/bin/hw/vendor.dolby.media.c2@1.0-service \
|
||||
$(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 \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib64/libcodec2_soft_ac4dec.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libcodec2_soft_ac4dec.so \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib64/libcodec2_soft_ddpdec.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libcodec2_soft_ddpdec.so \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib64/libcodec2_soft_dolby.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libcodec2_soft_dolby.so \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib64/libcodec2_store_dolby.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libcodec2_store_dolby.so \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib64/libdeccfg.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libdeccfg.so \
|
||||
|
||||
# Patched Proprietary Blobs
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib64/libdlbdsservice.so:$(TARGET_COPY_OUT_VENDOR)/lib64/libdlbdsservice.so \
|
||||
|
||||
# Not Xiaomi Proprietary Blobs
|
||||
PRODUCT_COPY_FILES += \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib/soundfx/libdlbvol.so:$(TARGET_COPY_OUT_VENDOR)/lib/soundfx/libdlbvol.so \
|
||||
$(DOLBY_PATH)/proprietary/vendor/lib64/soundfx/libdlbvol.so:$(TARGET_COPY_OUT_VENDOR)/lib64/soundfx/libdlbvol.so \
|
||||
PRODUCT_PACKAGES += \
|
||||
libdapparamstorage \
|
||||
libdlbpreg \
|
||||
vendor.dolby.hardware.dms@2.0 \
|
||||
libdlbdsservice \
|
||||
liboem_specific \
|
||||
vendor.dolby.hardware.dms@2.0-impl \
|
||||
vendor.dolby.hardware.dms@2.0-service \
|
||||
libcodec2_soft_ac4dec \
|
||||
libcodec2_soft_ddpdec \
|
||||
libcodec2_soft_dolby \
|
||||
libcodec2_store_dolby \
|
||||
libdeccfg \
|
||||
vendor.dolby.media.c2@1.0-service \
|
||||
libdlbvol \
|
||||
libswdap \
|
||||
libswgamedap \
|
||||
libswvqe \
|
||||
|
||||
17
libshims/Android.bp
Normal file
17
libshims/Android.bp
Normal 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,
|
||||
}
|
||||
27
libshims/libshim_dolby.cpp
Normal file
27
libshims/libshim_dolby.cpp
Normal 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);
|
||||
}
|
||||
BIN
proprietary/vendor/bin/hw/vendor.dolby.media.c2@1.0-service
vendored
Normal file → Executable file
BIN
proprietary/vendor/bin/hw/vendor.dolby.media.c2@1.0-service
vendored
Normal file → Executable file
Binary file not shown.
6
rootdir/etc/Android.bp
Normal file
6
rootdir/etc/Android.bp
Normal file
@@ -0,0 +1,6 @@
|
||||
prebuilt_etc {
|
||||
name: "init.dolby.rc",
|
||||
src: "init.dolby.rc",
|
||||
sub_dir: "init",
|
||||
soc_specific: true
|
||||
}
|
||||
4
rootdir/etc/init.dolby.rc
Normal file
4
rootdir/etc/init.dolby.rc
Normal file
@@ -0,0 +1,4 @@
|
||||
on early-boot
|
||||
# Dolby
|
||||
mkdir /data/vendor/dolby 0770 media media
|
||||
mkdir /data/vendor/multimedia 0775 system system
|
||||
Reference in New Issue
Block a user