diff options
author | codeworkx <codeworkx@cyanogenmod.org> | 2013-03-28 18:11:44 +0000 |
---|---|---|
committer | codeworkx <codeworkx@cyanogenmod.org> | 2013-03-28 18:56:27 +0000 |
commit | 09d3f13837b9e0d6580b121daac1eac1fda01990 (patch) | |
tree | 38391bc0650c0f64e0822559d97c7b9bd6b97640 | |
parent | c775350911364b52ff76d3e41f78afbc8632ba74 (diff) | |
download | device_samsung_i9300-09d3f13837b9e0d6580b121daac1eac1fda01990.zip device_samsung_i9300-09d3f13837b9e0d6580b121daac1eac1fda01990.tar.gz device_samsung_i9300-09d3f13837b9e0d6580b121daac1eac1fda01990.tar.bz2 |
i9300: fix dock audio
Change-Id: I44b8c3ec52652ff9f57a70aacd4c5156818e0037
9 files changed, 147 insertions, 3 deletions
diff --git a/DeviceSettings/res/values-de/strings.xml b/DeviceSettings/res/values-de/strings.xml index 50c66a6..099267d 100644 --- a/DeviceSettings/res/values-de/strings.xml +++ b/DeviceSettings/res/values-de/strings.xml @@ -2,6 +2,11 @@ <resources> <string name="app_name">Galaxy S III Einstellungen</string> + <string name="category_dock_title">Dock</string> + <string name="dockaudio_subcat_title">Audio</string> + <string name="use_dock_audio_title_head">USB-Dock Audio</string> + <string name="use_dock_audio_summary_head">Passive Audio-Ausgabe des USB-Docks verwenden</string> + <string name="category_haptic_title">Haptik</string> <string name="vibrator_subcat_title">Vibrator</string> <string name="vibrator_intensity_title_head">Vibrator Intensität</string> diff --git a/DeviceSettings/res/values/strings.xml b/DeviceSettings/res/values/strings.xml index e842ae4..c32c2d5 100644 --- a/DeviceSettings/res/values/strings.xml +++ b/DeviceSettings/res/values/strings.xml @@ -2,6 +2,11 @@ <resources> <string name="app_name">Galaxy S III Settings</string> + <string name="category_dock_title">Dock</string> + <string name="dockaudio_subcat_title">Dock Audio</string> + <string name="use_dock_audio_title_head">Use Dock USB Audio</string> + <string name="use_dock_audio_summary_head">Use the passive audio out on the dock</string> + <string name="category_haptic_title">Haptic</string> <string name="vibrator_subcat_title">Vibrator</string> <string name="vibrator_intensity_title_head">Vibrator Intensity</string> diff --git a/DeviceSettings/res/xml/dock_preferences.xml b/DeviceSettings/res/xml/dock_preferences.xml new file mode 100644 index 0000000..62c962c --- /dev/null +++ b/DeviceSettings/res/xml/dock_preferences.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2012 The CyanogenMod 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. + --> +<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"> + <PreferenceCategory + android:title="@string/dockaudio_subcat_title"> + <!-- Use Dock Audio --> + <CheckBoxPreference + android:key="dock_audio" + android:title="@string/use_dock_audio_title_head" + android:summary="@string/use_dock_audio_summary_head" + /> + </PreferenceCategory> +</PreferenceScreen> diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/DeviceSettings.java b/DeviceSettings/src/com/cyanogenmod/settings/device/DeviceSettings.java index 152e361..6c5fc67 100644 --- a/DeviceSettings/src/com/cyanogenmod/settings/device/DeviceSettings.java +++ b/DeviceSettings/src/com/cyanogenmod/settings/device/DeviceSettings.java @@ -44,6 +44,7 @@ public class DeviceSettings extends FragmentActivity { public static final String KEY_LED_FADE = "led_fade"; public static final String KEY_TOUCHKEY_LIGHT = "touchkey_light"; public static final String KEY_TOUCHKEY_TIMEOUT = "touchkey_timeout"; + public static final String KEY_USE_DOCK_AUDIO = "dock_audio"; ViewPager mViewPager; TabsAdapter mTabsAdapter; @@ -63,6 +64,8 @@ public class DeviceSettings extends FragmentActivity { bar.setDisplayHomeAsUpEnabled(true); mTabsAdapter = new TabsAdapter(this, mViewPager); + mTabsAdapter.addTab(bar.newTab().setText(R.string.category_dock_title), + DockFragmentActivity.class, null); mTabsAdapter.addTab(bar.newTab().setText(R.string.category_radio_title), RadioFragmentActivity.class, null); mTabsAdapter.addTab(bar.newTab().setText(R.string.category_screen_title), diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/DockFragmentActivity.java b/DeviceSettings/src/com/cyanogenmod/settings/device/DockFragmentActivity.java new file mode 100644 index 0000000..c57cd63 --- /dev/null +++ b/DeviceSettings/src/com/cyanogenmod/settings/device/DockFragmentActivity.java @@ -0,0 +1,75 @@ +/* +* Copyright (C) 2012 The CyanogenMod 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 com.cyanogenmod.settings.device; + +import android.app.ActivityManagerNative; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.os.Bundle; +import android.os.UserHandle; +import android.preference.CheckBoxPreference; +import android.preference.Preference; +import android.preference.PreferenceActivity; +import android.preference.PreferenceFragment; +import android.preference.PreferenceManager; +import android.preference.PreferenceScreen; +import android.util.Log; + +import com.cyanogenmod.settings.device.R; + +public class DockFragmentActivity extends PreferenceFragment { + + private static final String PREF_ENABLED = "1"; + private static final String TAG = "GalaxyS3Settings_Dock"; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + addPreferencesFromResource(R.xml.dock_preferences); + PreferenceScreen prefSet = getPreferenceScreen(); + + } + + @Override + public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) { + + String boxValue; + String key = preference.getKey(); + + Log.w(TAG, "key: " + key); + + if (key.compareTo(DeviceSettings.KEY_USE_DOCK_AUDIO) == 0) { + boxValue = (((CheckBoxPreference)preference).isChecked() ? "1" : "0"); + Intent i = new Intent("com.cyanogenmod.settings.SamsungDock"); + i.putExtra("data", boxValue); + ActivityManagerNative.broadcastStickyIntent(i, null, UserHandle.USER_ALL); + } + + return true; + } + + public static void restore(Context context) { + SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context); + boolean dockAudio = sharedPrefs.getBoolean(DeviceSettings.KEY_USE_DOCK_AUDIO, false); + Intent i = new Intent("com.cyanogenmod.settings.SamsungDock"); + i.putExtra("data", (dockAudio? "1" : "0")); + ActivityManagerNative.broadcastStickyIntent(i, null, UserHandle.USER_ALL); + } + +} diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/Startup.java b/DeviceSettings/src/com/cyanogenmod/settings/device/Startup.java index dc9ec9c..56b903b 100644 --- a/DeviceSettings/src/com/cyanogenmod/settings/device/Startup.java +++ b/DeviceSettings/src/com/cyanogenmod/settings/device/Startup.java @@ -24,6 +24,7 @@ public class Startup extends BroadcastReceiver { @Override public void onReceive(final Context context, final Intent bootintent) { + DockFragmentActivity.restore(context); HapticFragmentActivity.restore(context); Hspa.restore(context); RadioFragmentActivity.restore(context); diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 8473841..6645647 100755 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -438,8 +438,9 @@ static void set_incall_device(struct m0_audio_device *adev) device_type = SOUND_AUDIO_PATH_HANDSET; break; case AUDIO_DEVICE_OUT_SPEAKER: - case AUDIO_DEVICE_OUT_AUX_DIGITAL: + case AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET: case AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET: + case AUDIO_DEVICE_OUT_AUX_DIGITAL: device_type = SOUND_AUDIO_PATH_SPEAKER; break; case AUDIO_DEVICE_OUT_WIRED_HEADSET: @@ -577,6 +578,12 @@ static void select_output_device(struct m0_audio_device *adev) case AUDIO_DEVICE_OUT_ALL_SCO: ALOGD("%s: AUDIO_DEVICE_OUT_ALL_SCO", __func__); break; + case AUDIO_DEVICE_OUT_USB_ACCESSORY: + ALOGD("%s: AUDIO_DEVICE_OUT_USB_ACCESSORY", __func__); + break; + case AUDIO_DEVICE_OUT_USB_DEVICE: + ALOGD("%s: AUDIO_DEVICE_OUT_USB_DEVICE", __func__); + break; default: ALOGD("%s: AUDIO_DEVICE_OUT_ALL", __func__); break; @@ -2744,7 +2751,7 @@ static const struct { { AUDIO_DEVICE_OUT_WIRED_HEADSET | AUDIO_DEVICE_OUT_WIRED_HEADPHONE, "headphone" }, { AUDIO_DEVICE_OUT_EARPIECE, "earpiece" }, { AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET, "analog-dock" }, - { AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET, "digital-dock" }, + { AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET, "analog-dock" }, { AUDIO_DEVICE_OUT_ALL_SCO, "sco-out" }, { AUDIO_DEVICE_IN_BUILTIN_MIC, "builtin-mic" }, diff --git a/overlay/packages/apps/Settings/res/values/bools.xml b/overlay/packages/apps/Settings/res/values/bools.xml index 63f1363..88338eb 100644 --- a/overlay/packages/apps/Settings/res/values/bools.xml +++ b/overlay/packages/apps/Settings/res/values/bools.xml @@ -16,5 +16,6 @@ --> <resources xmlns:xliff="urnasis:names:tc:xliff:document:1.2 "> - <bool name="has_powercontrol_widget">true</bool> + <!-- Whether or not the dock settings are to be displayed for this device when docked --> + <bool name="has_dock_settings">true</bool> </resources> diff --git a/overlay/packages/apps/Settings/res/values/config.xml b/overlay/packages/apps/Settings/res/values/config.xml new file mode 100644 index 0000000..89a117f --- /dev/null +++ b/overlay/packages/apps/Settings/res/values/config.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- + Copyright (C) 2012 The CyanogenMod Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<resources xmlns:xliff="urnasis:names:tc:xliff:document:1.2 "> + <!-- Volume Rocker Wake --> + <bool name="config_show_volumeRockerWake">true</bool> +</resources> |