diff --git a/BoardConfigCommon.mk b/BoardConfigCommon.mk index ec5e2646..d5941aa2 100644 --- a/BoardConfigCommon.mk +++ b/BoardConfigCommon.mk @@ -49,8 +49,6 @@ TARGET_BOARD_PLATFORM := sdm845 # Audio TARGET_PROVIDES_AUDIO_EXTNS := true -TARGET_EXCLUDES_AUDIOFX := true -AUDIO_FEATURE_ENABLED_DS2_DOLBY_DAP := true # Filesystem TARGET_FS_CONFIG_GEN := $(COMMON_PATH)/config.fs diff --git a/audio/audio_effects.xml b/audio/audio_effects.xml index 682ad18e..c0e62a98 100644 --- a/audio/audio_effects.xml +++ b/audio/audio_effects.xml @@ -42,13 +42,6 @@ - - - - - - - @@ -97,26 +90,22 @@ - - - - - - - - - + + + + + diff --git a/audio/audio_policy_configuration.xml b/audio/audio_policy_configuration.xml index 0b133822..aa6d7f38 100644 --- a/audio/audio_policy_configuration.xml +++ b/audio/audio_policy_configuration.xml @@ -94,15 +94,6 @@ - - - diff --git a/configs/media_codecs.xml b/configs/media_codecs.xml index 611463e9..ec752681 100644 --- a/configs/media_codecs.xml +++ b/configs/media_codecs.xml @@ -391,6 +391,4 @@ Only the three quirks included above are recognized at this point: - - diff --git a/extract-files.sh b/extract-files.sh index c373ec10..c759daf2 100755 --- a/extract-files.sh +++ b/extract-files.sh @@ -29,15 +29,11 @@ function blob_fixup() { vendor/lib/camera/components/com.qti.node.watermark.so) grep -q "libpiex_shim.so" "${2}" || ${PATCHELF} --add-needed "libpiex_shim.so" "${2}" ;; + vendor/lib/mediadrm/libwvdrmengine.so | vendor/lib64/mediadrm/libwvdrmengine.so | vendor/lib64/libwvhidl.so) ${PATCHELF} --replace-needed "libprotobuf-cpp-lite-3.9.1.so" "libprotobuf-cpp-full-3.9.1.so" "${2}" ;; - vendor/lib64/libdlbdsservice.so | vendor/lib/libstagefright_soft_ac4dec.so | vendor/lib/libstagefright_soft_ddpdec.so) - "${PATCHELF}" --replace-needed "libstagefright_foundation.so" "libstagefright_foundation-v33.so" "${2}" - ;; - vendor/etc/dolby/dax-default.xml) - sed -i "/volume-leveler-enable/ s/true/false/g" "${2}" - ;; + esac } diff --git a/parts/Android.bp b/parts/Android.bp index 904c92d7..adc8834c 100644 --- a/parts/Android.bp +++ b/parts/Android.bp @@ -14,7 +14,6 @@ android_app { privileged: true, system_ext_specific: true, - overrides: ["MusicFX"], static_libs: [ "org.lineageos.settings.resources", ], diff --git a/parts/AndroidManifest.xml b/parts/AndroidManifest.xml index 10924de2..d7f973ba 100644 --- a/parts/AndroidManifest.xml +++ b/parts/AndroidManifest.xml @@ -43,23 +43,14 @@ + android:label="@string/dirac_title"> - - - - - - - - - - - - - - - - diff --git a/parts/res/drawable/ic_dolby.xml b/parts/res/drawable/ic_dolby.xml deleted file mode 100644 index 4cf0aac5..00000000 --- a/parts/res/drawable/ic_dolby.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/parts/res/drawable/ic_dolby_qs.xml b/parts/res/drawable/ic_dolby_qs.xml deleted file mode 100644 index 5ed3f946..00000000 --- a/parts/res/drawable/ic_dolby_qs.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/parts/res/values/arrays.xml b/parts/res/values/arrays.xml index fddae9c3..3fdddd99 100644 --- a/parts/res/values/arrays.xml +++ b/parts/res/values/arrays.xml @@ -95,85 +95,4 @@ "0,4,2,0,-2,-2,4" "2,0,0,-2,-4,0,0" - - - @string/dolby_profile_dynamic - @string/music_headset_scenario_video - @string/music_headset_scenario_music - @string/music_headset_scenario_vocal - - - - 0 - 1 - 2 - 8 - - - - @string/dirac_preset_default - @string/dirac_preset_rock - @string/dirac_preset_jazz - @string/dirac_preset_pop - @string/dirac_preset_classical - @string/dirac_preset_hiphop - @string/dirac_preset_blues - @string/dirac_preset_electronic - @string/dirac_preset_metal - - - - - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - 60,36,12,-12,-36,-24,-12,-8,-4,-20,-36,-20,-4,-20,-36,-16,4,32,60,60 - 8,8,8,8,8,0,-8,-8,-8,-24,-40,-20,0,4,8,8,8,8,8,8 - -13,-1,11,-25,-61,-29,3,11,19,19,19,15,11,-9,-29,-9,11,15,19,19 - -32,-32,-32,-32,-32,-32,-32,-28,-24,-4,16,0,-16,24,64,32,0,32,64,64 - 52,28,4,-20,-44,-24,-4,-4,-4,-24,-44,-24,-4,0,4,4,4,20,36,36 - 28,28,28,-36,-100,-68,-36,4,44,28,12,4,-4,4,12,4,-4,12,28,28 - 50,34,18,2,-14,-6,2,-2,-6,-26,-46,-26,-6,-2,2,2,2,2,2,2 - 40,24,8,8,8,-4,-16,-12,-8,-32,-56,-24,8,8,8,8,8,8,8,8 - - - - @string/dolby_off - @string/dolby_low - @string/dolby_medium - @string/dolby_high - @string/dolby_max - - - - 0 - 2 - 6 - 9 - 12 - - - - @string/dolby_off - @string/dolby_low - @string/dolby_medium - @string/dolby_high - @string/dolby_max - - - - 0 - 4 - 24 - 44 - 64 - diff --git a/parts/res/values/strings.xml b/parts/res/values/strings.xml index d1517d09..f4c91384 100644 --- a/parts/res/values/strings.xml +++ b/parts/res/values/strings.xml @@ -65,28 +65,4 @@ Battery Balance Performance - - - - Dolby Atmos - Use Dolby Atmos - Choose a profile - Equalizer preset - Dynamic - Off - On - Low - Medium - High - Max - Unknown - On (%1$s) - Settings - Bass enhancer - Dialogue enhancer - Surround virtualizer - Volume leveler - Connect headphones - Reset to defaults - Succesfully reset settings for %1$s profile diff --git a/parts/res/xml/dolby_settings.xml b/parts/res/xml/dolby_settings.xml deleted file mode 100644 index 76710df6..00000000 --- a/parts/res/xml/dolby_settings.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/parts/src/org/lineageos/settings/BootCompletedReceiver.java b/parts/src/org/lineageos/settings/BootCompletedReceiver.java index 83657143..0728d092 100644 --- a/parts/src/org/lineageos/settings/BootCompletedReceiver.java +++ b/parts/src/org/lineageos/settings/BootCompletedReceiver.java @@ -25,7 +25,6 @@ import org.lineageos.settings.dirac.DiracUtils; import org.lineageos.settings.doze.DozeUtils; import org.lineageos.settings.thermal.ThermalUtils; -import org.lineageos.settings.dolby.DolbyUtils; public class BootCompletedReceiver extends BroadcastReceiver { @@ -38,6 +37,5 @@ public void onReceive(final Context context, Intent intent) { DiracUtils.initialize(); DozeUtils.checkDozeService(context); ThermalUtils.startService(context); - DolbyUtils.getInstance(context); } } diff --git a/parts/src/org/lineageos/settings/SummaryProvider.java b/parts/src/org/lineageos/settings/SummaryProvider.java deleted file mode 100644 index f9d60dc4..00000000 --- a/parts/src/org/lineageos/settings/SummaryProvider.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * (C) 2023 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 - */ - -package org.lineageos.settings; - -import static com.android.settingslib.drawer.TileUtils.META_DATA_PREFERENCE_SUMMARY; - -import android.content.ContentProvider; -import android.content.ContentValues; -import android.database.Cursor; -import android.net.Uri; -import android.os.Bundle; - -import org.lineageos.settings.R; -import org.lineageos.settings.dolby.DolbyUtils; - -/** Provide preference summary for injected items. */ -public class SummaryProvider extends ContentProvider { - - private static final String KEY_DOLBY = "dolby"; - - @Override - public Bundle call(String method, String uri, Bundle extras) { - final Bundle bundle = new Bundle(); - String summary; - switch (method) { - case KEY_DOLBY: - summary = getDolbySummary(); - break; - default: - throw new IllegalArgumentException("Unknown method: " + method); - } - bundle.putString(META_DATA_PREFERENCE_SUMMARY, summary); - return bundle; - } - - @Override - public boolean onCreate() { - return true; - } - - @Override - public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, - String sortOrder) { - throw new UnsupportedOperationException(); - } - - @Override - public String getType(Uri uri) { - throw new UnsupportedOperationException(); - } - - @Override - public Uri insert(Uri uri, ContentValues values) { - throw new UnsupportedOperationException(); - } - - @Override - public int delete(Uri uri, String selection, String[] selectionArgs) { - throw new UnsupportedOperationException(); - } - - @Override - public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { - throw new UnsupportedOperationException(); - } - - private String getDolbySummary() { - final DolbyUtils dolbyUtils = DolbyUtils.getInstance(getContext()); - final boolean dsOn = dolbyUtils.getDsOn(); - if (!dsOn) { - return getContext().getString(R.string.dolby_off); - } - final String profileName = dolbyUtils.getProfileName(); - if (profileName == null) { - return getContext().getString(R.string.dolby_on); - } else { - return getContext().getString(R.string.dolby_on_with_profile, profileName); - } - } -} diff --git a/parts/src/org/lineageos/settings/dolby/DolbyActivity.java b/parts/src/org/lineageos/settings/dolby/DolbyActivity.java deleted file mode 100644 index e8cf8a25..00000000 --- a/parts/src/org/lineageos/settings/dolby/DolbyActivity.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2018 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.lineageos.settings.dolby; - -import android.os.Bundle; - -import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity; -import com.android.settingslib.widget.R; - -public class DolbyActivity extends CollapsingToolbarBaseActivity { - - private static final String TAG_DOLBY = "dolby"; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - getFragmentManager().beginTransaction().replace(R.id.content_frame, - new DolbySettingsFragment(), TAG_DOLBY).commit(); - } -} diff --git a/parts/src/org/lineageos/settings/dolby/DolbyAtmos.java b/parts/src/org/lineageos/settings/dolby/DolbyAtmos.java deleted file mode 100644 index 65423b0d..00000000 --- a/parts/src/org/lineageos/settings/dolby/DolbyAtmos.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (C) 2018 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.lineageos.settings.dolby; - -import android.media.audiofx.AudioEffect; -import android.util.Log; - -import java.util.UUID; - -class DolbyAtmos extends AudioEffect { - - private static final String TAG = "DolbyAtmos"; - private static final UUID EFFECT_TYPE_DAP = - UUID.fromString("9d4921da-8225-4f29-aefa-39537a04bcaa"); - - private static final int - EFFECT_PARAM_CPDP_VALUES = 5, - EFFECT_PARAM_ENABLE = 0, - EFFECT_PARAM_PROFILE = 0xA000000, - EFFECT_PARAM_SET_PROFILE_PARAMETER = 0x1000000, - EFFECT_PARAM_GET_PROFILE_PARAMETER = 0x1000005, - EFFECT_PARAM_RESET_PROFILE_SETTINGS = 0xC000000; - - enum DsParam { - HEADPHONE_VIRTUALIZER(101), - VOLUME_LEVELER(103), - DIALOGUE_ENHANCER_ENABLE(105), - DIALOGUE_ENHANCER_AMOUNT(108), - GEQ(110), - BASS_ENHANCER(111), - STEREO_WIDENING(113); - - public int id, length; - - DsParam(int id) { - this.id = id; - } - - public int getLength() { - return (id == GEQ.id) ? 20 : 1; - } - - public String toString() { - return String.format("%s(%s)", name(), id); - } - } - - DolbyAtmos(int priority, int audioSession) { - super(EFFECT_TYPE_NULL, EFFECT_TYPE_DAP, priority, audioSession); - } - - private static int int32ToByteArray(int value, byte[] dst, int index) { - dst[index++] = (byte) (value & 0xff); - dst[index++] = (byte) ((value >>> 8) & 0xff); - dst[index++] = (byte) ((value >>> 16) & 0xff); - dst[index] = (byte) ((value >>> 24) & 0xff); - return 4; - } - - private static int byteArrayToInt32(byte[] ba) { - return ((ba[3] & 0xff) << 24) | ((ba[2] & 0xff) << 16) - | ((ba[1] & 0xff) << 8) | (ba[0] & 0xff); - } - - private static int int32ArrayToByteArray(int[] src, byte[] dst, int index) { - for (int x : src) { - dst[index++] = (byte) ((x >>> 0) & 0xff); - dst[index++] = (byte) ((x >>> 8) & 0xff); - dst[index++] = (byte) ((x >>> 16) & 0xff); - dst[index++] = (byte) ((x >>> 24) & 0xff); - } - return src.length << 2; - } - - private static int[] byteArrayToInt32Array(byte[] ba, int dstLength) { - int srcLength = ba.length >> 2; - if (dstLength > srcLength) { - dstLength = srcLength; - } - int[] dst = new int[dstLength]; - for (int i = 0; i < dstLength; i++) { - dst[i] = ((ba[i * 4 + 3] & 0xff) << 24) | ((ba[i * 4 + 2] & 0xff) << 16) - | ((ba[i * 4 + 1] & 0xff) << 8) | (ba[i * 4] & 0xff); - } - return dst; - } - - private void setIntParam(int param, int value) { - byte[] buf = new byte[12]; - int i = int32ToByteArray(param, buf, 0); - int32ToByteArray(value, buf, i + int32ToByteArray(1, buf, i)); - checkStatus(setParameter(EFFECT_PARAM_CPDP_VALUES, buf)); - } - - private int getIntParam(int param) { - byte[] buf = new byte[12]; - int32ToByteArray(param, buf, 0); - checkStatus(getParameter(EFFECT_PARAM_CPDP_VALUES + param, buf)); - return byteArrayToInt32(buf); - } - - void setDsOn(boolean on) { - setIntParam(EFFECT_PARAM_ENABLE, on ? 1 : 0); - super.setEnabled(on); - } - - boolean getDsOn() { - return getIntParam(EFFECT_PARAM_ENABLE) == 1; - } - - void setProfile(int index) { - setIntParam(EFFECT_PARAM_PROFILE, index); - } - - int getProfile() { - return getIntParam(EFFECT_PARAM_PROFILE); - } - - void resetProfileSpecificSettings() { - int profile = getProfile(); - Log.d(TAG, "resetProfileSpecificSettings: profile=" + profile); - setIntParam(EFFECT_PARAM_RESET_PROFILE_SETTINGS, getProfile()); - } - - void setDapParameter(int profile, DsParam param, int values[]) { - Log.d(TAG, "setDapParameter: profile=" + profile + " param=" + param.toString()); - int length = values.length; - byte[] buf = new byte[(length + 4) * 4]; - int i = int32ToByteArray(EFFECT_PARAM_SET_PROFILE_PARAMETER, buf, 0); - int i2 = i + int32ToByteArray(length + 1, buf, i); - int i3 = i2 + int32ToByteArray(profile, buf, i2); - int32ArrayToByteArray(values, buf, i3 + int32ToByteArray(param.id, buf, i3)); - checkStatus(setParameter(EFFECT_PARAM_CPDP_VALUES, buf)); - } - - void setDapParameter(DsParam param, int values[]) { - setDapParameter(getProfile(), param, values); - } - - void setDapParameterBool(DsParam param, boolean enable) { - setDapParameter(param, new int[]{enable ? 1 : 0}); - } - - void setDapParameterInt(DsParam param, int value) { - setDapParameter(param, new int[]{value}); - } - - int[] getDapParameter(int profile, DsParam param) { - Log.d(TAG, "getDapParameter: profile=" + profile + " param=" + param.toString()); - int length = param.getLength(); - byte[] buf = new byte[(length + 2) * 4]; - int i = (param.id << 16) + EFFECT_PARAM_GET_PROFILE_PARAMETER; - checkStatus(getParameter(i + (profile << 8), buf)); - return byteArrayToInt32Array(buf, length); - } - - int[] getDapParameter(DsParam param) { - return getDapParameter(getProfile(), param); - } - - boolean getDapParameterBool(DsParam param) { - return getDapParameter(param)[0] == 1; - } - - int getDapParameterInt(DsParam param) { - return getDapParameter(param)[0]; - } -} diff --git a/parts/src/org/lineageos/settings/dolby/DolbySettingsFragment.java b/parts/src/org/lineageos/settings/dolby/DolbySettingsFragment.java deleted file mode 100644 index 6c56a48e..00000000 --- a/parts/src/org/lineageos/settings/dolby/DolbySettingsFragment.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * Copyright (C) 2018,2020 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.lineageos.settings.dolby; - -import android.media.AudioAttributes; -import android.media.AudioDeviceAttributes; -import android.media.AudioDeviceCallback; -import android.media.AudioDeviceInfo; -import android.media.AudioManager; -import android.os.Bundle; -import android.os.Handler; -import android.util.Log; -import android.widget.Switch; -import android.widget.Toast; - -import androidx.preference.ListPreference; -import androidx.preference.Preference; -import androidx.preference.Preference.OnPreferenceChangeListener; -import androidx.preference.PreferenceFragment; -import androidx.preference.SwitchPreference; - -import java.util.Arrays; -import java.util.List; - -import com.android.settingslib.widget.MainSwitchPreference; -import com.android.settingslib.widget.OnMainSwitchChangeListener; - -import org.lineageos.settings.R; - -public class DolbySettingsFragment extends PreferenceFragment implements - OnPreferenceChangeListener, OnMainSwitchChangeListener { - - private static final String TAG = "DolbySettingsFragment"; - - private static final AudioAttributes ATTRIBUTES_MEDIA = new AudioAttributes.Builder() - .setUsage(AudioAttributes.USAGE_MEDIA) - .build(); - - public static final String PREF_ENABLE = "dolby_enable"; - public static final String PREF_PROFILE = "dolby_profile"; - public static final String PREF_PRESET = "dolby_preset"; - public static final String PREF_VIRTUALIZER = "dolby_virtualizer"; - public static final String PREF_DIALOGUE = "dolby_dialogue"; - public static final String PREF_BASS = "dolby_bass"; - public static final String PREF_VOLUME = "dolby_volume"; - public static final String PREF_RESET = "dolby_reset"; - - private MainSwitchPreference mSwitchBar; - private ListPreference mProfilePref, mPresetPref, mVirtualizerPref, mDialoguePref; - private SwitchPreference mBassPref, mVolumePref; - private Preference mResetPref; - private CharSequence[] mPresets, mDeValues, mSwValues; - - private DolbyUtils mDolbyUtils; - private AudioManager mAudioManager; - private boolean mDsOn, mIsProfileUnknown, mIsOnSpeaker; - private final Handler mHandler = new Handler(); - - private final AudioDeviceCallback mAudioDeviceCallback = new AudioDeviceCallback() { - public void onAudioDevicesAdded(AudioDeviceInfo[] addedDevices) { - updateSpeakerState(false); - } - - public void onAudioDevicesRemoved(AudioDeviceInfo[] removedDevices) { - updateSpeakerState(false); - } - }; - - @Override - public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { - addPreferencesFromResource(R.xml.dolby_settings); - - mAudioManager = getActivity().getSystemService(AudioManager.class); - mDolbyUtils = DolbyUtils.getInstance(getActivity()); - mDsOn = mDolbyUtils.getDsOn(); - - mSwitchBar = (MainSwitchPreference) findPreference(PREF_ENABLE); - mSwitchBar.addOnSwitchChangeListener(this); - mSwitchBar.setChecked(mDsOn); - - mProfilePref = (ListPreference) findPreference(PREF_PROFILE); - mProfilePref.setOnPreferenceChangeListener(this); - mProfilePref.setEnabled(mDsOn); - - final CharSequence[] profiles = mProfilePref.getEntryValues(); - final String profile = Integer.toString(mDolbyUtils.getProfile()); - if (Arrays.asList(profiles).contains(profile)) { - mProfilePref.setSummary("%s"); - mProfilePref.setValue(profile); - } else { - mProfilePref.setSummary(getActivity().getString(R.string.dolby_unknown)); - mIsProfileUnknown = true; - } - - mPresetPref = (ListPreference) findPreference(PREF_PRESET); - mPresetPref.setOnPreferenceChangeListener(this); - mPresets = mPresetPref.getEntryValues(); - - mVirtualizerPref = (ListPreference) findPreference(PREF_VIRTUALIZER); - mVirtualizerPref.setOnPreferenceChangeListener(this); - mSwValues = mVirtualizerPref.getEntryValues(); - - mDialoguePref = (ListPreference) findPreference(PREF_DIALOGUE); - mDialoguePref.setOnPreferenceChangeListener(this); - mDeValues = mDialoguePref.getEntryValues(); - - mBassPref = (SwitchPreference) findPreference(PREF_BASS); - mBassPref.setOnPreferenceChangeListener(this); - - mVolumePref = (SwitchPreference) findPreference(PREF_VOLUME); - mVolumePref.setOnPreferenceChangeListener(this); - - mResetPref = (Preference) findPreference(PREF_RESET); - mResetPref.setEnabled(mDsOn && !mIsProfileUnknown); - mResetPref.setOnPreferenceClickListener(p -> { - mDolbyUtils.resetProfileSpecificSettings(); - updateProfileSpecificPrefs(); - Toast.makeText(getActivity(), - getActivity().getString(R.string.dolby_reset_profile_toast, - mProfilePref.getSummary()), Toast.LENGTH_SHORT).show(); - return true; - }); - - mAudioManager.registerAudioDeviceCallback(mAudioDeviceCallback, mHandler); - updateSpeakerState(true); - } - - @Override - public void onDestroyView() { - mAudioManager.unregisterAudioDeviceCallback(mAudioDeviceCallback); - super.onDestroyView(); - } - - @Override - public boolean onPreferenceChange(Preference preference, Object newValue) { - switch (preference.getKey()) { - case PREF_PROFILE: - mDolbyUtils.setProfile(Integer.parseInt((newValue.toString()))); - mIsProfileUnknown = false; - updateProfileSpecificPrefs(); - return true; - case PREF_PRESET: - mDolbyUtils.setPreset(newValue.toString()); - return true; - case PREF_VIRTUALIZER: - mDolbyUtils.setStereoWideningAmount(Integer.parseInt((newValue.toString()))); - return true; - case PREF_DIALOGUE: - mDolbyUtils.setDialogueEnhancerAmount(Integer.parseInt((newValue.toString()))); - return true; - case PREF_BASS: - mDolbyUtils.setBassEnhancerEnabled((Boolean) newValue); - return true; - case PREF_VOLUME: - mDolbyUtils.setVolumeLevelerEnabled((Boolean) newValue); - return true; - default: - return false; - } - } - - @Override - public void onSwitchChanged(Switch switchView, boolean isChecked) { - mDsOn = isChecked; - mDolbyUtils.setDsOn(isChecked); - mProfilePref.setEnabled(isChecked); - mResetPref.setEnabled(isChecked); - updateProfileSpecificPrefs(); - } - - private void updateSpeakerState(boolean force) { - final AudioDeviceAttributes device = - mAudioManager.getDevicesForAttributes(ATTRIBUTES_MEDIA).get(0); - final boolean isOnSpeaker = (device.getType() == AudioDeviceInfo.TYPE_BUILTIN_SPEAKER); - if (mIsOnSpeaker != isOnSpeaker || force) { - Log.d(TAG, "updateSpeakerState: " + mIsOnSpeaker); - mIsOnSpeaker = isOnSpeaker; - updateProfileSpecificPrefs(); - } - } - - private void updateProfileSpecificPrefs() { - final String unknown = getActivity().getString(R.string.dolby_unknown); - final String speaker = getActivity().getString(R.string.dolby_connect_headphones); - - Log.d(TAG, "updateProfileSpecificPrefs: mDsOn=" + mDsOn - + " mIsProfileUnknown=" + mIsProfileUnknown + " mIsOnSpeaker=" + mIsOnSpeaker); - - final boolean enable = mDsOn && !mIsProfileUnknown; - mPresetPref.setEnabled(enable); - mDialoguePref.setEnabled(enable); - mVolumePref.setEnabled(enable); - mVirtualizerPref.setEnabled(enable && !mIsOnSpeaker); - mBassPref.setEnabled(enable && !mIsOnSpeaker); - - if (!enable) return; - - final String preset = mDolbyUtils.getPreset(); - if (Arrays.asList(mPresets).contains(preset)) { - mPresetPref.setSummary("%s"); - mPresetPref.setValue(preset); - } else { - mPresetPref.setSummary(unknown); - } - - final String deValue = Integer.toString(mDolbyUtils.getDialogueEnhancerAmount()); - if (Arrays.asList(mDeValues).contains(deValue)) { - mDialoguePref.setSummary("%s"); - mDialoguePref.setValue(deValue); - } else { - mDialoguePref.setSummary(unknown); - } - - mVolumePref.setChecked(mDolbyUtils.getVolumeLevelerEnabled()); - - if (mIsOnSpeaker) { - mVirtualizerPref.setSummary(speaker); - mBassPref.setSummary(speaker); - return; - } - - final String swValue = Integer.toString(mDolbyUtils.getStereoWideningAmount()); - if (Arrays.asList(mSwValues).contains(swValue)) { - mVirtualizerPref.setSummary("%s"); - mVirtualizerPref.setValue(swValue); - } else { - mVirtualizerPref.setSummary(unknown); - } - - mBassPref.setChecked(mDolbyUtils.getBassEnhancerEnabled()); - mBassPref.setSummary(null); - } -} diff --git a/parts/src/org/lineageos/settings/dolby/DolbyTileService.java b/parts/src/org/lineageos/settings/dolby/DolbyTileService.java deleted file mode 100644 index 64f0f15f..00000000 --- a/parts/src/org/lineageos/settings/dolby/DolbyTileService.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.lineageos.settings.dolby; - -import android.service.quicksettings.Tile; -import android.service.quicksettings.TileService; - -public class DolbyTileService extends TileService { - - @Override - public void onStartListening() { - Tile tile = getQsTile(); - DolbyUtils dolbyUtils = DolbyUtils.getInstance(getApplicationContext()); - if (dolbyUtils.getDsOn()) { - tile.setState(Tile.STATE_ACTIVE); - } else { - tile.setState(Tile.STATE_INACTIVE); - } - tile.setSubtitle(dolbyUtils.getProfileName()); - tile.updateTile(); - super.onStartListening(); - } - - @Override - public void onClick() { - Tile tile = getQsTile(); - DolbyUtils dolbyUtils = DolbyUtils.getInstance(getApplicationContext()); - if (dolbyUtils.getDsOn()) { - dolbyUtils.setDsOn(false); - tile.setState(Tile.STATE_INACTIVE); - } else { - dolbyUtils.setDsOn(true); - tile.setState(Tile.STATE_ACTIVE); - } - tile.updateTile(); - super.onClick(); - } -} diff --git a/parts/src/org/lineageos/settings/dolby/DolbyUtils.java b/parts/src/org/lineageos/settings/dolby/DolbyUtils.java deleted file mode 100644 index 45eabdf8..00000000 --- a/parts/src/org/lineageos/settings/dolby/DolbyUtils.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (C) 2018,2020 The LineageOS Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.lineageos.settings.dolby; - -import static org.lineageos.settings.dolby.DolbyAtmos.DsParam; - -import android.content.Context; -import android.util.Log; - -import org.lineageos.settings.R; - -import java.util.Arrays; -import java.util.List; - -public final class DolbyUtils { - - private static final String TAG = "DolbyUtils"; - private static final int EFFECT_PRIORITY = 100; - - private static DolbyUtils mInstance; - private DolbyAtmos mDolbyAtmos; - private Context mContext; - - public DolbyUtils(Context context) { - mContext = context; - mDolbyAtmos = new DolbyAtmos(EFFECT_PRIORITY, 0); - mDolbyAtmos.setEnabled(mDolbyAtmos.getDsOn()); - } - - public static synchronized DolbyUtils getInstance(Context context) { - if (mInstance == null) { - mInstance = new DolbyUtils(context); - } - return mInstance; - } - - private void checkEffect() { - if (!mDolbyAtmos.hasControl()) { - Log.w(TAG, "lost control, recreating effect"); - mDolbyAtmos.release(); - mDolbyAtmos = new DolbyAtmos(EFFECT_PRIORITY, 0); - } - } - - public void setDsOn(boolean on) { - checkEffect(); - Log.d(TAG, "setDsOn: " + on); - mDolbyAtmos.setDsOn(on); - } - - public boolean getDsOn() { - boolean on = mDolbyAtmos.getDsOn(); - Log.d(TAG, "getDsOn: " + on); - return on; - } - - public void setProfile(int index) { - checkEffect(); - Log.d(TAG, "setProfile: " + index); - mDolbyAtmos.setProfile(index); - } - - public int getProfile() { - int profile = mDolbyAtmos.getProfile(); - Log.d(TAG, "getProfile: " + profile); - return profile; - } - - public String getProfileName() { - String profile = Integer.toString(mDolbyAtmos.getProfile()); - List profiles = Arrays.asList(mContext.getResources().getStringArray( - R.array.dolby_profile_values)); - int profileIndex = profiles.indexOf(profile); - Log.d(TAG, "getProfileName: profile=" + profile + " index=" + profileIndex); - return profileIndex == -1 ? null : mContext.getResources().getStringArray( - R.array.dolby_profile_entries)[profileIndex]; - } - - public void resetProfileSpecificSettings() { - checkEffect(); - mDolbyAtmos.resetProfileSpecificSettings(); - } - - public void setPreset(String preset) { - checkEffect(); - int[] gains = Arrays.stream(preset.split(",")).mapToInt(Integer::parseInt).toArray(); - Log.d(TAG, "setPreset: " + Arrays.toString(gains)); - mDolbyAtmos.setDapParameter(DsParam.GEQ, gains); - } - - public String getPreset() { - int[] gains = mDolbyAtmos.getDapParameter(DsParam.GEQ); - Log.d(TAG, "getPreset: " + Arrays.toString(gains)); - String[] preset = Arrays.stream(gains).mapToObj(String::valueOf).toArray(String[]::new); - return String.join(",", preset); - } - - public void setBassEnhancerEnabled(boolean enable) { - checkEffect(); - Log.d(TAG, "setBassEnhancerEnabled: " + enable); - mDolbyAtmos.setDapParameterBool(DsParam.BASS_ENHANCER, enable); - } - - public boolean getBassEnhancerEnabled() { - boolean enabled = mDolbyAtmos.getDapParameterBool(DsParam.BASS_ENHANCER); - Log.d(TAG, "getBassEnhancerEnabled: " + enabled); - return enabled; - } - - public void setDialogueEnhancerAmount(int amount) { - checkEffect(); - Log.d(TAG, "setDialogueEnhancerAmount: " + amount); - mDolbyAtmos.setDapParameterBool(DsParam.DIALOGUE_ENHANCER_ENABLE, amount > 0); - mDolbyAtmos.setDapParameterInt(DsParam.DIALOGUE_ENHANCER_AMOUNT, amount); - } - - public int getDialogueEnhancerAmount() { - boolean enabled = mDolbyAtmos.getDapParameterBool(DsParam.DIALOGUE_ENHANCER_ENABLE); - int amount = enabled ? mDolbyAtmos.getDapParameterInt(DsParam.DIALOGUE_ENHANCER_AMOUNT) : 0; - Log.d(TAG, "getDialogueEnhancerAmount: enabled=" + enabled + " amount=" + amount); - return amount; - } - - public void setStereoWideningAmount(int amount) { - checkEffect(); - Log.d(TAG, "setStereoWideningAmount: " + amount); - mDolbyAtmos.setDapParameterBool(DsParam.HEADPHONE_VIRTUALIZER, amount > 0); - mDolbyAtmos.setDapParameterInt(DsParam.STEREO_WIDENING, amount); - } - - public int getStereoWideningAmount() { - boolean enabled = mDolbyAtmos.getDapParameterBool(DsParam.HEADPHONE_VIRTUALIZER); - int amount = enabled ? mDolbyAtmos.getDapParameterInt(DsParam.STEREO_WIDENING) : 0; - Log.d(TAG, "getStereoWideningAmount: enabled=" + enabled + " amount=" + amount); - return amount; - } - - public void setVolumeLevelerEnabled(boolean enable) { - checkEffect(); - Log.d(TAG, "setVolumeLevelerEnabled: " + enable); - mDolbyAtmos.setDapParameterBool(DsParam.VOLUME_LEVELER, enable); - } - - public boolean getVolumeLevelerEnabled() { - boolean enabled = mDolbyAtmos.getDapParameterBool(DsParam.VOLUME_LEVELER); - Log.d(TAG, "getVolumeLevelerEnabled: " + enabled); - return enabled; - } -} diff --git a/proprietary-files.txt b/proprietary-files.txt index 499221dc..3d7a6c18 100644 --- a/proprietary-files.txt +++ b/proprietary-files.txt @@ -494,28 +494,6 @@ vendor/etc/init/vendor.xiaomi.hardware.mlipay@1.1-service.rc vendor/lib64/libmlipay.so vendor/lib64/libmlipay@1.1.so -# Media (Dolby) -vendor/bin/hw/vendor.dolby.hardware.dms@2.0-service|a5b407c13dc7348ce9d66ff71b22063fde803110 -vendor/etc/dolby/dax-default.xml|ff6106958d9fec85d1ffd175b219195403bb718c -vendor/etc/init/vendor.dolby.hardware.dms@2.0-service.rc|29296ebfe89b2697fec573be73cc3757fd97bed6 -vendor/etc/media_codecs_dolby_audio.xml|a794eb15fc198d0285510260025cd99b53fa174f -vendor/etc/vintf/manifest/manifest_vendor.dolby.hardware.dms.xml|c8095f649de19b80271fb429b4b6b439297a0678 --vendor/lib/libdapparamstorage.so|da1ee55c70a51c820f796ad1663e28b465304e2e --vendor/lib/libdeccfg.so|22594003b9f28f4c2aeeda484bb7ab8fbf0f67ea --vendor/lib/libstagefright_soft_ac4dec.so|564db26f99adc4b8a71473fc4dd9e95a5f2e3c50 --vendor/lib/libstagefright_soft_ddpdec.so|29061ed62252311630438086ab854a2751a8f381 --vendor/lib/soundfx/libswdap.so|810d0e266e4a77f06cba72fe8bdde2e1ede4f9f9 --vendor/lib/soundfx/libswgamedap.so|c7d35eb932ecffb384ec62628404df3406b63919 --vendor/lib/soundfx/libswvqe.so|3009202dcdd5b8fadb9c43a8cf5f0fe1c28311a6 --vendor/lib64/soundfx/libswdap.so|e996ee1d421b3b2cf74f3f3ed93bff067d83dddb --vendor/lib64/soundfx/libswgamedap.so|c898fd5b51312c5fafa693ca037423c5bae23101 --vendor/lib64/soundfx/libswvqe.so|08394e1ac285479213604c35cb144147fdac68c0 --vendor/lib/vendor.dolby.hardware.dms@2.0.so|2bf537bbf5c413527e5c648b8e63b95f904f7532 --vendor/lib64/libdapparamstorage.so|573c229a12b95151922c669301b34851444a8004 --vendor/lib64/libdlbdsservice.so|518f4a7fa3dd4bb9d0ced70f81bb7711c66f5e38 --vendor/lib64/vendor.dolby.hardware.dms@2.0-impl.so|e0bd781d13463f28dcc2bd05b37dfaebadecc95b --vendor/lib64/vendor.dolby.hardware.dms@2.0.so|2020b5fd9abac65520224069bbe75d5e76d3f158 - # Neural networks - from PNX - RKQ1.200906.002 vendor/bin/hw/android.hardware.neuralnetworks@1.3-service-qti|2f4c5509649e72b1085c9eabd92a2b0b32090c0e vendor/etc/init/android.hardware.neuralnetworks@1.3-service-qti.rc|4b7f2c5f914f3eef38f19936c0a06efc09b5b28c diff --git a/sdm845.mk b/sdm845.mk index 8616c6e9..28485b8e 100644 --- a/sdm845.mk +++ b/sdm845.mk @@ -263,11 +263,7 @@ PRODUCT_PACKAGES += \ libOmxQcelp13Enc \ libOmxVdec \ libOmxVenc \ - libstagefrighthw \ - libstagefright_foundation-v33 \ - libavservices_minijail_vendor \ - libcodec2_soft_common.vendor \ - libsfplugin_ccodec_utils.vendor + libstagefrighthw PRODUCT_COPY_FILES += \ $(LOCAL_PATH)/configs/media_codecs.xml:$(TARGET_COPY_OUT_VENDOR)/etc/media_codecs.xml \ diff --git a/sepolicy/vendor/attributes b/sepolicy/vendor/attributes deleted file mode 100644 index 7910a3bd..00000000 --- a/sepolicy/vendor/attributes +++ /dev/null @@ -1,9 +0,0 @@ -# Xiaomi CIT Sensor Service -attribute vendor_hal_citsensorservice_xiaomi; -attribute vendor_hal_citsensorservice_xiaomi_client; -attribute vendor_hal_citsensorservice_xiaomi_server; - -# HALs -attribute hal_dms; -attribute hal_dms_client; -attribute hal_dms_server; diff --git a/sepolicy/vendor/file_contexts b/sepolicy/vendor/file_contexts index a9f54ce3..0ce67ad2 100644 --- a/sepolicy/vendor/file_contexts +++ b/sepolicy/vendor/file_contexts @@ -12,10 +12,6 @@ /data/vendor/mac_addr(/.*)? u:object_r:wifi_vendor_data_file:s0 /data/vendor/thermal(/.*)? u:object_r:thermal_data_file:s0 -# Dolby -/data/vendor/dolby(/.*)? u:object_r:vendor_data_file:s0 -/(vendor|system/vendor)/bin/hw/vendor\.dolby\.hardware\.dms@2\.0-service u:object_r:hal_dms_default_exec:s0 - # Executables /vendor/bin/glgps u:object_r:glgps_exec:s0 /vendor/bin/ignss_2_0 u:object_r:hal_gnss_default_exec:s0 diff --git a/sepolicy/vendor/hal_audio_default.te b/sepolicy/vendor/hal_audio_default.te index a0672ad8..4ee9a0fe 100644 --- a/sepolicy/vendor/hal_audio_default.te +++ b/sepolicy/vendor/hal_audio_default.te @@ -6,7 +6,3 @@ set_prop(hal_audio_default, vendor_audio_prop) allow hal_audio_default audio_socket:sock_file rw_file_perms; dontaudit hal_audio_default sysfs:dir read; - -# Dolby -allow hal_audio_default hal_dms_hwservice:hwservice_manager find; -binder_call(hal_audio_default, hal_dms_default) diff --git a/sepolicy/vendor/hal_dms.te b/sepolicy/vendor/hal_dms.te deleted file mode 100644 index 6f3b093b..00000000 --- a/sepolicy/vendor/hal_dms.te +++ /dev/null @@ -1,6 +0,0 @@ -# HwBinder IPC from client to server, and callbacks -binder_call(hal_dms_client, hal_dms_server) -binder_call(hal_dms_server, hal_dms_client) - -add_hwservice(hal_dms_server, hal_dms_hwservice) -allow hal_dms_client hal_dms_hwservice:hwservice_manager find; diff --git a/sepolicy/vendor/hal_dms_default.te b/sepolicy/vendor/hal_dms_default.te deleted file mode 100644 index 886e3e8b..00000000 --- a/sepolicy/vendor/hal_dms_default.te +++ /dev/null @@ -1,10 +0,0 @@ -type hal_dms_default, domain; -hal_server_domain(hal_dms_default, hal_dms) -type hal_dms_default_exec, exec_type, vendor_file_type, file_type; -init_daemon_domain(hal_dms_default) - -allow hal_dms_default vendor_data_file:file { rw_file_perms create unlink }; -allow hal_dms_default vendor_data_file:dir { rw_file_perms add_name remove_name }; -allow hal_dms_default mediacodec:binder call; -binder_call(hal_dms_default, hal_audio_default) -binder_call(hal_dms_default, platform_app) diff --git a/sepolicy/vendor/hwservice.te b/sepolicy/vendor/hwservice.te index c340faf9..876a0fb8 100644 --- a/sepolicy/vendor/hwservice.te +++ b/sepolicy/vendor/hwservice.te @@ -1,6 +1,3 @@ type hal_mlipay_hwservice, hwservice_manager_type; type hal_nxpese_hwservice, hwservice_manager_type; type hal_nxpnfc_hwservice, hwservice_manager_type; - -# Dolby -type hal_dms_hwservice, hwservice_manager_type; diff --git a/sepolicy/vendor/hwservice_contexts b/sepolicy/vendor/hwservice_contexts index a4b60716..6e8498b2 100644 --- a/sepolicy/vendor/hwservice_contexts +++ b/sepolicy/vendor/hwservice_contexts @@ -1,5 +1,3 @@ -# Dolby -vendor.dolby.hardware.dms::IDms com.fingerprints.extension::IFingerprintEngineering u:object_r:hal_fingerprint_hwservice:s0 com.fingerprints.extension::IFingerprintSensorTest u:object_r:hal_fingerprint_hwservice:s0 com.fingerprints.extension::IFingerprintNavigation u:object_r:hal_fingerprint_hwservice:s0 diff --git a/vendor.prop b/vendor.prop index 2669d0be..af3380be 100644 --- a/vendor.prop +++ b/vendor.prop @@ -11,6 +11,8 @@ ro.vendor.audio.sdk.fluencetype=fluence ro.vendor.audio.sdk.ssr=false ro.vendor.audio.soundfx.usb=true vendor.audio.adm.buffering.ms=6 +vendor.audio.dolby.ds2.enabled=false +vendor.audio.dolby.ds2.hardbypass=false vendor.audio.enable.dp.for.voice=false vendor.audio.feature.a2dp_offload.enable=true vendor.audio.feature.afe_proxy.enable=true @@ -127,12 +129,6 @@ persist.vendor.dpmhalservice.enable=1 # DRM drm.service.enabled=true -# Dolby -persist.vendor.audio_fx.current=dolby -vendor.audio.dolby.ds2.enabled=true -vendor.audio.dolby.ds2.hardbypass=true -ro.vendor.audio.dolby.dax.support=true - # FRP ro.frp.pst=/dev/block/bootdevice/by-name/frp diff --git a/vndk/Android.bp b/vndk/Android.bp deleted file mode 100644 index 20233597..00000000 --- a/vndk/Android.bp +++ /dev/null @@ -1,23 +0,0 @@ -// -// Copyright (C) 2023 The LineageOS Project -// -// SPDX-License-Identifier: Apache-2.0 -// - -cc_prebuilt_library_shared { - name: "libstagefright_foundation-v33", - vendor: true, - strip: { - none: true, - }, - target: { - android_arm: { - srcs: ["v33/arm/libstagefright_foundation-v33.so"], - }, - android_arm64: { - srcs: ["v33/arm64/libstagefright_foundation-v33.so"], - }, - }, - compile_multilib: "both", - check_elf_files: false, -} diff --git a/vndk/v33/arm/libstagefright_foundation-v33.so b/vndk/v33/arm/libstagefright_foundation-v33.so deleted file mode 100644 index 538672fa..00000000 --- a/vndk/v33/arm/libstagefright_foundation-v33.so +++ /dev/null @@ -1 +0,0 @@ -../../../../../../prebuilts/vndk/v33/arm/arch-arm-armv7-a-neon/shared/vndk-core/libstagefright_foundation.so diff --git a/vndk/v33/arm64/libstagefright_foundation-v33.so b/vndk/v33/arm64/libstagefright_foundation-v33.so deleted file mode 100644 index 79448824..00000000 --- a/vndk/v33/arm64/libstagefright_foundation-v33.so +++ /dev/null @@ -1 +0,0 @@ -../../../../../../prebuilts/vndk/v33/arm64/arch-arm64-armv8-a/shared/vndk-core/libstagefright_foundation.so