universal7885: Enable DAP effect on boot

Change-Id: I07daeebc1a4b51905e7551081b1530e0502689d2
Signed-off-by: SamarV-121 <samarvispute121@pm.me>
This commit is contained in:
LuK1337 2021-09-18 00:08:16 +02:00 committed by roynatech2544
commit 97a81dec31
No known key found for this signature in database
GPG key ID: 9675C32163D88D30
5 changed files with 98 additions and 1 deletions

12
dap/Android.bp Normal file
View file

@ -0,0 +1,12 @@
android_app {
name: "SamsungDAP",
srcs: ["src/**/*.kt"],
certificate: "platform",
platform_apis: true,
optimize: {
proguard_flags_files: ["proguard.flags"],
},
}

23
dap/AndroidManifest.xml Normal file
View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.lineageos.dap"
android:versionCode="1"
android:versionName="1.0"
android:sharedUserId="android.uid.system">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<application
android:label="SamsungDAP"
android:persistent="true"
android:defaultToDeviceProtectedStorage="true"
android:directBootAware="true">
<receiver android:name="org.lineageos.dap.BootCompletedReceiver">
<intent-filter>
<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
</manifest>

3
dap/proguard.flags Normal file
View file

@ -0,0 +1,3 @@
-keep class org.lineageos.dap.gef.* {
*;
}

View file

@ -0,0 +1,58 @@
/*
* Copyright (c) 2021 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.lineageos.dap
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.media.audiofx.AudioEffect
import android.util.Log
import java.util.UUID
class BootCompletedReceiver : BroadcastReceiver() {
private val audioEffect = AudioEffect(
EFFECT_TYPE_DAP, AudioEffect.EFFECT_TYPE_NULL, 0, 0
)
override fun onReceive(context: Context, intent: Intent) {
Log.d(TAG, "Starting")
audioEffect.setParameter(EFFECT_PARAM_EFF_ENAB, 1)
audioEffect.setParameter(EFFECT_PARAM_PROFILE, PROFILE_AUTO)
audioEffect.enabled = true
}
companion object {
private const val TAG = "SamsungDAP"
private val EFFECT_TYPE_DAP = UUID.fromString("46d279d9-9be7-453d-9d7c-ef937f675587")
private const val EFFECT_PARAM_PROFILE = 0
private const val EFFECT_PARAM_STEREO_WIDENING_DISTANCE = 1
private const val EFFECT_PARAM_EFF_ENAB = 19
private const val PROFILE_AUTO = 0
private const val PROFILE_MOVIE = 1
private const val PROFILE_MUSIC = 2
private const val PROFILE_VOICE = 3
private const val PROFILE_GAME = 4
private const val PROFILE_OFF = 5
private const val PROFILE_GAME_1 = 6
private const val PROFILE_GAME_2 = 7
private const val PROFILE_SPACIAL_AUDIO = 8
}
}

View file

@ -13,7 +13,8 @@ PRODUCT_PACKAGES += \
android.hardware.audio.effect@6.0-impl \
libtinycompress \
audio.r_submix.default \
audio.usb.default
audio.usb.default \
SamsungDAP
PRODUCT_COPY_FILES += \
frameworks/av/services/audiopolicy/config/a2dp_audio_policy_configuration.xml:$(TARGET_COPY_OUT_VENDOR)/etc/a2dp_audio_policy_configuration.xml \