diff options
author | Daniel Hillenbrand <codeworkx@cyanogenmod.org> | 2013-04-13 12:33:40 +0000 |
---|---|---|
committer | Daniel Hillenbrand <codeworkx@cyanogenmod.org> | 2013-04-13 12:33:40 +0000 |
commit | b85434c16ffe031270e6c8c62bd26fc46ddce37f (patch) | |
tree | d5a97bf3e72b8c40f670ee4d3fa4b0d7735d5ee8 | |
parent | 02cb2585b1f0415e35623a284ef843ffedccd4ad (diff) | |
download | device_samsung_p3100-b85434c16ffe031270e6c8c62bd26fc46ddce37f.zip device_samsung_p3100-b85434c16ffe031270e6c8c62bd26fc46ddce37f.tar.gz device_samsung_p3100-b85434c16ffe031270e6c8c62bd26fc46ddce37f.tar.bz2 |
p31xx: add support for dock audio
Change-Id: I35363baf1d0ad4930bee049faf6e8ae25ad94211
29 files changed, 856 insertions, 19 deletions
diff --git a/DeviceSettings/Android.mk b/DeviceSettings/Android.mk new file mode 100644 index 0000000..67ee3a6 --- /dev/null +++ b/DeviceSettings/Android.mk @@ -0,0 +1,15 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := optional + +LOCAL_STATIC_JAVA_LIBRARIES := android-support-v13 + +LOCAL_SRC_FILES := $(call all-java-files-under, src) + +LOCAL_PACKAGE_NAME := GalaxyTab2Settings +LOCAL_CERTIFICATE := platform + +include $(BUILD_PACKAGE) + +include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/DeviceSettings/AndroidManifest.xml b/DeviceSettings/AndroidManifest.xml new file mode 100644 index 0000000..a581d10 --- /dev/null +++ b/DeviceSettings/AndroidManifest.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="utf-8"?> +<manifest xmlns:android="http://schemas.android.com/apk/res/android" + package="com.cyanogenmod.settings.device" + android:sharedUserId="android.uid.system" > + + <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> + <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" /> + + <application android:label="@string/app_name"> + <activity + android:name="com.cyanogenmod.settings.device.DeviceSettings" + android:icon="@drawable/ic_launcher_cmdevicesettings" + android:label="@string/app_name" > + <intent-filter> + <action android:name="com.cyanogenmod.action.LAUNCH_DEVICE_SETTINGS" /> + <action android:name="android.intent.action.MAIN" /> + </intent-filter> + </activity> + + <receiver android:name=".Startup"> + <intent-filter android:priority="100"> + <action android:name="android.intent.action.BOOT_COMPLETED" /> + </intent-filter> + </receiver> + + <activity android:name=".HapticFragmentActivity" /> + <activity android:name=".RadioFragmentActivity" /> + <activity android:name=".ScreenFragmentActivity" /> + + </application> +</manifest> diff --git a/DeviceSettings/res/drawable/ic_launcher_cmdevicesettings.png b/DeviceSettings/res/drawable/ic_launcher_cmdevicesettings.png Binary files differnew file mode 100755 index 0000000..66de9c3 --- /dev/null +++ b/DeviceSettings/res/drawable/ic_launcher_cmdevicesettings.png diff --git a/DeviceSettings/res/layout/top.xml b/DeviceSettings/res/layout/top.xml new file mode 100755 index 0000000..744b568 --- /dev/null +++ b/DeviceSettings/res/layout/top.xml @@ -0,0 +1,5 @@ +<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/viewPager" + android:layout_width="match_parent" + android:layout_height="match_parent" /> + diff --git a/DeviceSettings/res/values-de/arrays.xml b/DeviceSettings/res/values-de/arrays.xml new file mode 100644 index 0000000..4cf4e23 --- /dev/null +++ b/DeviceSettings/res/values-de/arrays.xml @@ -0,0 +1,19 @@ +<?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:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + +</resources> diff --git a/DeviceSettings/res/values-de/strings.xml b/DeviceSettings/res/values-de/strings.xml new file mode 100644 index 0000000..fb16ff2 --- /dev/null +++ b/DeviceSettings/res/values-de/strings.xml @@ -0,0 +1,24 @@ +<?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:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_name">Galaxy Tab 2 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> +</resources> diff --git a/DeviceSettings/res/values-es/strings.xml b/DeviceSettings/res/values-es/strings.xml new file mode 100644 index 0000000..ec13f9d --- /dev/null +++ b/DeviceSettings/res/values-es/strings.xml @@ -0,0 +1,24 @@ +<?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:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_name">Ajustes Galaxy Tab 2</string> + + <string name="category_dock_title">Conector</string> + <string name="dockaudio_subcat_title">Audio</string> + <string name="use_dock_audio_title_head">Usar el conector de audio USB</string> + <string name="use_dock_audio_summary_head">Usar la salida de audio pasiva cuando el conector USB esté activado</string> +</resources> diff --git a/DeviceSettings/res/values-fi/strings.xml b/DeviceSettings/res/values-fi/strings.xml new file mode 100644 index 0000000..ef3e9d7 --- /dev/null +++ b/DeviceSettings/res/values-fi/strings.xml @@ -0,0 +1,24 @@ +<?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:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_name">Galaxy Tab 2-asetukset</string> + + <string name="category_dock_title">Telakka</string> + <string name="dockaudio_subcat_title">Audio</string> + <string name="use_dock_audio_title_head">Käytä USB-audiotelakkaa</string> + <string name="use_dock_audio_summary_head">Käytä telakan audioulostuloa</string> +</resources> diff --git a/DeviceSettings/res/values-hu/strings.xml b/DeviceSettings/res/values-hu/strings.xml new file mode 100644 index 0000000..cbad81a --- /dev/null +++ b/DeviceSettings/res/values-hu/strings.xml @@ -0,0 +1,24 @@ +<?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:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_name">Galaxy Tab 2 Beállítások</string> + + <string name="category_dock_title">Dokkoló</string> + <string name="dockaudio_subcat_title">Dokkoló hangszórók</string> + <string name="use_dock_audio_title_head">Dokkoló hangszóróinak használata</string> + <string name="use_dock_audio_summary_head">Használja a dokkoló passzív hangkimenetét</string> +</resources> diff --git a/DeviceSettings/res/values-it/strings.xml b/DeviceSettings/res/values-it/strings.xml new file mode 100644 index 0000000..186446b --- /dev/null +++ b/DeviceSettings/res/values-it/strings.xml @@ -0,0 +1,24 @@ +<?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:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_name">Impostazioni Galaxy Tab 2</string> + + <string name="category_dock_title">Dock</string> + <string name="dockaudio_subcat_title">Audio</string> + <string name="use_dock_audio_title_head">Usa USB audio in dock</string> + <string name="use_dock_audio_summary_head">Usa l\'uscita audio passiva quando in dock</string> +</resources> diff --git a/DeviceSettings/res/values-nl/strings.xml b/DeviceSettings/res/values-nl/strings.xml new file mode 100644 index 0000000..4836a39 --- /dev/null +++ b/DeviceSettings/res/values-nl/strings.xml @@ -0,0 +1,24 @@ +<?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:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_name">Galaxy Tab 2-instellingen</string> + + <string name="category_dock_title">Dock</string> + <string name="dockaudio_subcat_title">Geluid</string> + <string name="use_dock_audio_title_head">USB-geluidsdock</string> + <string name="use_dock_audio_summary_head">Passieve geluidsuitgang van het dock gebruiken</string> +</resources> diff --git a/DeviceSettings/res/values-pl/arrays.xml b/DeviceSettings/res/values-pl/arrays.xml new file mode 100644 index 0000000..268ac03 --- /dev/null +++ b/DeviceSettings/res/values-pl/arrays.xml @@ -0,0 +1,56 @@ +<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + + <string-array name="vibrator_intensity_entries"> + <item>0%</item> + <item>25%</item> + <item>50% (domyślnie)</item> + <item>75%</item> + <item>100%</item> + </string-array> + + <string-array name="hspa_entries"> + <item>Tylko UMTS</item> + <item>Tylko HSDPA</item> + <item>HSDPA + HSUPA</item> + </string-array> + + <string-array name="mdnie_scenario_entries"> + <item>CyanogenMod (domyślnie)</item> + <item>UI</item> + <item>Wideo</item> + <item>Ciepły film</item> + <item>Zimny film</item> + <item>Kamera</item> + <item>Nawigacja</item> + <item>Galeria</item> + <item>VT</item> + </string-array> + + <string-array name="mdnie_mode_entries"> + <item>Dynamicznie (domyślnie)</item> + <item>Standardowo</item> + <item>Naturalnie</item> + <item>Film</item> + </string-array> + + <string-array name="mdnie_negative_entries"> + <item>Normalnie</item> + <item>Odwrócony</item> + </string-array> + + <string-array name="led_fade_entries"> + <item>Miganie</item> + <item>Zanikanie</item> + </string-array> + + <string-array name="touchkey_timeout_entries"> + <item>Nigdy</item> + <item>1 sekunda</item> + <item>2 sekundy</item> + <item>3 sekundy (domyślnie)</item> + <item>4 sekundy</item> + <item>5 sekund</item> + <item>6 sekund</item> + </string-array> + +</resources> diff --git a/DeviceSettings/res/values-pl/strings.xml b/DeviceSettings/res/values-pl/strings.xml new file mode 100644 index 0000000..5f831ff --- /dev/null +++ b/DeviceSettings/res/values-pl/strings.xml @@ -0,0 +1,24 @@ +<?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:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_name">Ustawienia Galaxy Tab 2</string> + + <string name="category_dock_title">Stacja dokująca</string> + <string name="dockaudio_subcat_title">Dźwięk w stacji dokującej</string> + <string name="use_dock_audio_title_head">Użyj stacji dokującej</string> + <string name="use_dock_audio_summary_head">Użyj pasywnego wyjścia audio w stacji dokującej</string> +</resources>
\ No newline at end of file diff --git a/DeviceSettings/res/values-pt-rBR/strings.xml b/DeviceSettings/res/values-pt-rBR/strings.xml new file mode 100644 index 0000000..d7da292 --- /dev/null +++ b/DeviceSettings/res/values-pt-rBR/strings.xml @@ -0,0 +1,24 @@ +<?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:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_name">Config. Galaxy Tab 2</string> + + <string name="category_dock_title">Dock</string> + <string name="dockaudio_subcat_title">Áudio</string> + <string name="use_dock_audio_title_head">Usar Áudio USB do Dock</string> + <string name="use_dock_audio_summary_head">Usar o áudio de saída passivo no dock</string> +</resources> diff --git a/DeviceSettings/res/values-ru/strings.xml b/DeviceSettings/res/values-ru/strings.xml new file mode 100644 index 0000000..057df1f --- /dev/null +++ b/DeviceSettings/res/values-ru/strings.xml @@ -0,0 +1,24 @@ +<?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:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_name">Настройки Galaxy Tab 2</string> + + <string name="category_dock_title">Док-станция</string> + <string name="dockaudio_subcat_title">Аудио</string> + <string name="use_dock_audio_title_head">USB аудио док-станция</string> + <string name="use_dock_audio_summary_head">Использовать пассивный режим аудио док-станции</string> +</resources> diff --git a/DeviceSettings/res/values-zh-rCN/strings.xml b/DeviceSettings/res/values-zh-rCN/strings.xml new file mode 100644 index 0000000..0c5c0e4 --- /dev/null +++ b/DeviceSettings/res/values-zh-rCN/strings.xml @@ -0,0 +1,24 @@ +<?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:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_name">Galaxy Tab 2 设置</string> + + <string name="category_dock_title">基座</string> + <string name="dockaudio_subcat_title">基座音频</string> + <string name="use_dock_audio_title_head">使用基座的 USB 音频</string> + <string name="use_dock_audio_summary_head">使用基座上的被动音频输出</string> +</resources> diff --git a/DeviceSettings/res/values/arrays.xml b/DeviceSettings/res/values/arrays.xml new file mode 100644 index 0000000..4cf4e23 --- /dev/null +++ b/DeviceSettings/res/values/arrays.xml @@ -0,0 +1,19 @@ +<?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:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + +</resources> diff --git a/DeviceSettings/res/values/strings.xml b/DeviceSettings/res/values/strings.xml new file mode 100644 index 0000000..5632f1e --- /dev/null +++ b/DeviceSettings/res/values/strings.xml @@ -0,0 +1,24 @@ +<?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:android="http://schemas.android.com/apk/res/android" + xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> + <string name="app_name">Galaxy Tab 2 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> +</resources> 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 new file mode 100644 index 0000000..ffa3054 --- /dev/null +++ b/DeviceSettings/src/com/cyanogenmod/settings/device/DeviceSettings.java @@ -0,0 +1,142 @@ +/* + * 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.ActionBar; +import android.app.ActionBar.Tab; +import android.app.Activity; +import android.app.Fragment; +import android.app.FragmentTransaction; +import android.content.Context; +import android.os.Bundle; +import android.support.v4.app.FragmentActivity; +import android.support.v13.app.FragmentPagerAdapter; +import android.support.v4.view.ViewPager; + +import com.cyanogenmod.settings.device.R; + +import java.util.ArrayList; + +public class DeviceSettings extends FragmentActivity { + + public static final String SHARED_PREFERENCES_BASENAME = "com.cyanogenmod.settings.device"; + public static final String ACTION_UPDATE_PREFERENCES = "com.cyanogenmod.settings.device.UPDATE"; + public static final String KEY_USE_DOCK_AUDIO = "dock_audio"; + + ViewPager mViewPager; + TabsAdapter mTabsAdapter; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + mViewPager = new ViewPager(this); + mViewPager.setId(R.id.viewPager); + setContentView(mViewPager); + + final ActionBar bar = getActionBar(); + bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); + bar.setDisplayOptions(ActionBar.DISPLAY_SHOW_TITLE, ActionBar.DISPLAY_SHOW_TITLE); + bar.setTitle(R.string.app_name); + + mTabsAdapter = new TabsAdapter(this, mViewPager); + mTabsAdapter.addTab(bar.newTab().setText(R.string.category_dock_title), + DockFragmentActivity.class, null); + + if (savedInstanceState != null) { + bar.setSelectedNavigationItem(savedInstanceState.getInt("tab", 0)); + } + } + + @Override + protected void onSaveInstanceState(Bundle outState) { + super.onSaveInstanceState(outState); + outState.putInt("tab", getActionBar().getSelectedNavigationIndex()); + } + + public static class TabsAdapter extends FragmentPagerAdapter + implements ActionBar.TabListener, ViewPager.OnPageChangeListener { + private final Context mContext; + private final ActionBar mActionBar; + private final ViewPager mViewPager; + private final ArrayList<TabInfo> mTabs = new ArrayList<TabInfo>(); + + static final class TabInfo { + private final Class<?> clss; + private final Bundle args; + + TabInfo(Class<?> _class, Bundle _args) { + clss = _class; + args = _args; + } + } + + public TabsAdapter(Activity activity, ViewPager pager) { + super(activity.getFragmentManager()); + mContext = activity; + mActionBar = activity.getActionBar(); + mViewPager = pager; + mViewPager.setAdapter(this); + mViewPager.setOnPageChangeListener(this); + } + + public void addTab(ActionBar.Tab tab, Class<?> clss, Bundle args) { + TabInfo info = new TabInfo(clss, args); + tab.setTag(info); + tab.setTabListener(this); + mTabs.add(info); + mActionBar.addTab(tab); + notifyDataSetChanged(); + } + + @Override + public int getCount() { + return mTabs.size(); + } + + @Override + public Fragment getItem(int position) { + TabInfo info = mTabs.get(position); + return Fragment.instantiate(mContext, info.clss.getName(), info.args); + } + + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { + } + + public void onPageSelected(int position) { + mActionBar.setSelectedNavigationItem(position); + } + + public void onPageScrollStateChanged(int state) { + } + + public void onTabSelected(Tab tab, FragmentTransaction ft) { + Object tag = tab.getTag(); + for (int i=0; i<mTabs.size(); i++) { + if (mTabs.get(i) == tag) { + mViewPager.setCurrentItem(i); + } + } + } + + public void onTabUnselected(Tab tab, FragmentTransaction ft) { + } + + public void onTabReselected(Tab tab, FragmentTransaction ft) { + } + } +} 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..22f9f56 --- /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 = "GalaxyTab2Settings_General"; + + @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 new file mode 100644 index 0000000..a210616 --- /dev/null +++ b/DeviceSettings/src/com/cyanogenmod/settings/device/Startup.java @@ -0,0 +1,29 @@ +/* + * 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.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; + +public class Startup extends BroadcastReceiver { + + @Override + public void onReceive(final Context context, final Intent bootintent) { + DockFragmentActivity.restore(context); + } +} diff --git a/DeviceSettings/src/com/cyanogenmod/settings/device/Utils.java b/DeviceSettings/src/com/cyanogenmod/settings/device/Utils.java new file mode 100644 index 0000000..2153212 --- /dev/null +++ b/DeviceSettings/src/com/cyanogenmod/settings/device/Utils.java @@ -0,0 +1,143 @@ +/* + * 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.util.Log; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.SyncFailedException; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.content.Context; + +public class Utils { + + private static final String TAG = "GalaxyTab2Settings_Utils"; + private static final String TAG_READ = "GalaxyTab2Settings_Utils_Read"; + private static final String TAG_WRITE = "GalaxyTab2Settings_Utils_Write"; + + /** + * Write a string value to the specified file. + * + * @param filename The filename + * @param value The value + */ + public static void writeValue(String filename, String value) { + FileOutputStream fos = null; + try { + fos = new FileOutputStream(new File(filename), false); + fos.write(value.getBytes()); + fos.flush(); + // fos.getFD().sync(); + } catch (FileNotFoundException ex) { + Log.w(TAG, "file " + filename + " not found: " + ex); + } catch (SyncFailedException ex) { + Log.w(TAG, "file " + filename + " sync failed: " + ex); + } catch (IOException ex) { + Log.w(TAG, "IOException trying to sync " + filename + ": " + ex); + } catch (RuntimeException ex) { + Log.w(TAG, "exception while syncing file: ", ex); + } finally { + if (fos != null) { + try { + Log.w(TAG_WRITE, "file " + filename + ": " + value); + fos.close(); + } catch (IOException ex) { + Log.w(TAG, "IOException while closing synced file: ", ex); + } catch (RuntimeException ex) { + Log.w(TAG, "exception while closing file: ", ex); + } + } + } + + } + + /** + * Write a string value to the specified file. + * + * @param filename The filename + * @param value The value + */ + public static void writeValue(String filename, Boolean value) { + FileOutputStream fos = null; + String sEnvia; + try { + fos = new FileOutputStream(new File(filename), false); + if (value) + sEnvia = "1"; + else + sEnvia = "0"; + fos.write(sEnvia.getBytes()); + fos.flush(); + // fos.getFD().sync(); + } catch (FileNotFoundException ex) { + Log.w(TAG, "file " + filename + " not found: " + ex); + } catch (SyncFailedException ex) { + Log.w(TAG, "file " + filename + " sync failed: " + ex); + } catch (IOException ex) { + Log.w(TAG, "IOException trying to sync " + filename + ": " + ex); + } catch (RuntimeException ex) { + Log.w(TAG, "exception while syncing file: ", ex); + } finally { + if (fos != null) { + try { + Log.w(TAG_WRITE, "file " + filename + ": " + value); + fos.close(); + } catch (IOException ex) { + Log.w(TAG, "IOException while closing synced file: ", ex); + } catch (RuntimeException ex) { + Log.w(TAG, "exception while closing file: ", ex); + } + } + } + } + + /** + * Write the "color value" to the specified file. The value is scaled from + * an integer to an unsigned integer by multiplying by 2. + * @param filename The filename + * @param value The value of max value Integer.MAX + */ + public static void writeColor(String filename, int value) { + writeValue(filename, String.valueOf((long) value * 2)); + } + + /** + * Check if the specified file exists. + * @param filename The filename + * @return Whether the file exists or not + */ + public static boolean fileExists(String filename) { + return new File(filename).exists(); + } + + + public static void showDialog(Context ctx, String title, String message) { + final AlertDialog alertDialog = new AlertDialog.Builder(ctx).create(); + alertDialog.setTitle(title); + alertDialog.setMessage(message); + alertDialog.setButton("OK", new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int which) { + alertDialog.dismiss(); + } + }); + alertDialog.show(); + } +} diff --git a/audio/audio_hw.c b/audio/audio_hw.c index 01f2b2b..60ad2cf 100755 --- a/audio/audio_hw.c +++ b/audio/audio_hw.c @@ -492,6 +492,7 @@ static void set_incall_device(struct espresso_audio_device *adev) device_type = SOUND_AUDIO_PATH_HANDSET; break; case AUDIO_DEVICE_OUT_SPEAKER: + case AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET: case AUDIO_DEVICE_OUT_AUX_DIGITAL: case AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET: device_type = SOUND_AUDIO_PATH_SPEAKER; @@ -628,9 +629,18 @@ static void select_output_device(struct espresso_audio_device *adev) case AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET: ALOGD("%s: AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET", __func__); break; + case AUDIO_DEVICE_OUT_AUX_DIGITAL: + ALOGD("%s: AUDIO_DEVICE_OUT_AUX_DIGITAL", __func__); + break; 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; @@ -2427,17 +2437,21 @@ static int adev_open_output_stream(struct audio_hw_device *dev, struct espresso_stream_out *out; int ret; int output_type; + *stream_out = NULL; out = (struct espresso_stream_out *)calloc(1, sizeof(struct espresso_stream_out)); - if (!out) + if (!out) { + ALOGE("%s: out of memory!", __func__); return -ENOMEM; + } out->sup_channel_masks[0] = AUDIO_CHANNEL_OUT_STEREO; out->channel_mask = AUDIO_CHANNEL_OUT_STEREO; if (ladev->outputs[OUTPUT_DEEP_BUF] != NULL) { ret = -ENOSYS; + ALOGW("%s: output not available!", __func__); goto err_open; } output_type = OUTPUT_DEEP_BUF; @@ -2453,8 +2467,10 @@ static int adev_open_output_stream(struct audio_hw_device *dev, RESAMPLER_QUALITY_DEFAULT, NULL, &out->resampler); - if (ret != 0) + if (ret != 0) { + ALOGE("%s: error on resampler create!", __func__); goto err_open; + } out->stream.common.set_sample_rate = out_set_sample_rate; out->stream.common.get_channels = out_get_channels; @@ -2489,6 +2505,7 @@ static int adev_open_output_stream(struct audio_hw_device *dev, return 0; err_open: + ALOGE("%s: error opening output stream", __func__); free(out); return ret; } @@ -2783,7 +2800,8 @@ static const struct { { AUDIO_DEVICE_OUT_SPEAKER, "speaker" }, { 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_ANLG_DOCK_HEADSET, "dock" }, + { AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET, "dock" }, { AUDIO_DEVICE_OUT_ALL_SCO, "sco-out" }, { AUDIO_DEVICE_IN_BUILTIN_MIC, "builtin-mic" }, @@ -2993,7 +3011,7 @@ static int adev_open(const hw_module_t* module, const char* name, hw_device_t** device) { struct espresso_audio_device *adev; - int ret; + int i, ret; if (strcmp(name, AUDIO_HARDWARE_INTERFACE) != 0) return -EINVAL; @@ -3040,6 +3058,10 @@ static int adev_open(const hw_module_t* module, const char* name, adev->in_device = AUDIO_DEVICE_IN_BUILTIN_MIC & ~AUDIO_DEVICE_BIT_IN; select_devices(adev); + for (i = 0; i < OUTPUT_TOTAL; i++) { + adev->outputs[i] = NULL; + } + adev->pcm_modem_dl = NULL; adev->pcm_modem_ul = NULL; adev->pcm_bt_dl = NULL; diff --git a/common-overlay/packages/apps/Settings/res/values/config.xml b/common-overlay/packages/apps/Settings/res/values/config.xml index 8aa3cc2..52e178b 100644 --- a/common-overlay/packages/apps/Settings/res/values/config.xml +++ b/common-overlay/packages/apps/Settings/res/values/config.xml @@ -20,6 +20,9 @@ <!-- Show Expanded Desktop preference --> <bool name="config_show_expandedDesktop">true</bool> + <!-- Dock Settings --> + <bool name="has_dock_settings">true</bool> + <!-- Volume Rocker Wake --> <bool name="config_show_volumeRockerWake">true</bool> </resources> diff --git a/common-overlay/packages/apps/Trebuchet/res/values/config.xml b/common-overlay/packages/apps/Trebuchet/res/values/config.xml deleted file mode 100644 index 2a65ae4..0000000 --- a/common-overlay/packages/apps/Trebuchet/res/values/config.xml +++ /dev/null @@ -1,6 +0,0 @@ -<resources> - <bool name="is_large_screen">true</bool> - - <!-- Allow tablets to set grid size in settings, false disables - <bool name="config_workspaceTabletGrid">true</bool>--> -</resources> diff --git a/configs/audio_policy.conf b/configs/audio_policy.conf index f483979..72249cf 100644 --- a/configs/audio_policy.conf +++ b/configs/audio_policy.conf @@ -26,7 +26,7 @@ audio_hw_modules { sampling_rates 44100 channel_masks AUDIO_CHANNEL_OUT_STEREO formats AUDIO_FORMAT_PCM_16_BIT - devices AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_DEVICE_OUT_ALL_SCO + devices AUDIO_DEVICE_OUT_EARPIECE|AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE|AUDIO_DEVICE_OUT_ALL_SCO|AUDIO_DEVICE_OUT_ANLG_DOCK_HEADSET|AUDIO_DEVICE_OUT_AUX_DIGITAL|AUDIO_DEVICE_OUT_DGTL_DOCK_HEADSET flags AUDIO_OUTPUT_FLAG_PRIMARY } deep_buffer { @@ -36,13 +36,6 @@ audio_hw_modules { devices AUDIO_DEVICE_OUT_SPEAKER|AUDIO_DEVICE_OUT_WIRED_HEADSET|AUDIO_DEVICE_OUT_WIRED_HEADPHONE flags AUDIO_OUTPUT_FLAG_DEEP_BUFFER } - hdmi { - sampling_rates 44100|48000 - channel_masks dynamic - formats AUDIO_FORMAT_PCM_16_BIT - devices AUDIO_DEVICE_OUT_AUX_DIGITAL - flags AUDIO_OUTPUT_FLAG_DIRECT - } } inputs { primary { diff --git a/configs/tiny_hw.xml b/configs/tiny_hw.xml index 9a22e4a..49d71ea 100644 --- a/configs/tiny_hw.xml +++ b/configs/tiny_hw.xml @@ -166,7 +166,7 @@ We are able to have most of our routing static so do that <ctl name="AIF2DAC2R Mixer AIF1.1 Switch" val="0"/> </path> </device> -<device name="analog-dock"> +<device name="dock"> <path name="on"> <ctl name="LINEOUT1N Switch" val="1"/> <ctl name="LINEOUT1P Switch" val="1"/> diff --git a/p31xx-common.mk b/p31xx-common.mk index e40e03d..d5787fb 100755 --- a/p31xx-common.mk +++ b/p31xx-common.mk @@ -74,6 +74,7 @@ PRODUCT_COPY_FILES += \ PRODUCT_PACKAGES += \ audio.primary.piranha \ camera.piranha \ + GalaxyTab2Settings \ hwcomposer.piranha \ lights.piranha \ libinvensense_mpl \ |