summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2013-12-23 22:14:22 +0100
committerPaul Kocialkowski <contact@paulk.fr>2013-12-27 11:24:42 +0100
commit7c905830a6fc45715a2dd8c8db700a4e528ba641 (patch)
tree8bb1460f472a243fe4fdc6c3b6761ac7eb85db36
parent49dc5a2e9110bda2a750fb7d455aa773c606c51d (diff)
downloaddevice_samsung_aries-common-7c905830a6fc45715a2dd8c8db700a4e528ba641.zip
device_samsung_aries-common-7c905830a6fc45715a2dd8c8db700a4e528ba641.tar.gz
device_samsung_aries-common-7c905830a6fc45715a2dd8c8db700a4e528ba641.tar.bz2
AriesParts: Remove all TvOut-related features
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r--AriesParts/AndroidManifest.xml1
-rw-r--r--AriesParts/res/xml/main.xml19
-rw-r--r--AriesParts/src/android/hardware/TvOut.java77
-rw-r--r--AriesParts/src/com/cyanogenmod/settings/device/DeviceSettings.java72
-rw-r--r--AriesParts/src/com/cyanogenmod/settings/device/TvOutService.java146
5 files changed, 0 insertions, 315 deletions
diff --git a/AriesParts/AndroidManifest.xml b/AriesParts/AndroidManifest.xml
index 9abef28..d94a968 100644
--- a/AriesParts/AndroidManifest.xml
+++ b/AriesParts/AndroidManifest.xml
@@ -15,7 +15,6 @@
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
- <service android:name=".TvOutService" />
<activity android:name=".WarnActivity"
android:label="@string/generic_warning_title"
android:theme="@android:style/Theme.Translucent"></activity>
diff --git a/AriesParts/res/xml/main.xml b/AriesParts/res/xml/main.xml
index 9062424..61f9aa1 100644
--- a/AriesParts/res/xml/main.xml
+++ b/AriesParts/res/xml/main.xml
@@ -43,25 +43,6 @@
android:defaultValue="23" />
</PreferenceCategory>
- <PreferenceCategory
- android:title="@string/category_tvout_title"
- android:key="category_tvout">
- <CheckBoxPreference
- android:key="tvout_enable"
- android:title="@string/tvout_enable_head"
- android:summaryOn="@string/tvout_enable_summary_on"
- android:summaryOff="@string/tvout_enable_summary_nocable"
- android:persistent="false"
- android:enabled="false" />
- <ListPreference
- android:key="tvout_system"
- android:title="@string/tvout_system_head"
- android:summary="@string/tvout_system_summary"
- android:entries="@array/tvout_system_entries"
- android:entryValues="@array/tvout_system_entries_values"
- android:defaultValue="2" />
- </PreferenceCategory>
-
<PreferenceCategory
android:title="@string/category_volume_boost_title"
android:key="category_volume_boost">
diff --git a/AriesParts/src/android/hardware/TvOut.java b/AriesParts/src/android/hardware/TvOut.java
deleted file mode 100644
index 349b987..0000000
--- a/AriesParts/src/android/hardware/TvOut.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package android.hardware;
-
-import java.io.File;
-import java.lang.ref.WeakReference;
-
-import android.graphics.Bitmap;
-import android.util.Log;
-
-public class TvOut {
- private static final String TAG = "TvOut";
-
- private int mListenerContext;
- private int mNativeContext;
-
- public native void _DisableTvOut();
-
- public native void _EnableTvOut();
-
- public native void _SetOrientation(int paramInt);
-
- public native void _SetTvScreenSize(int paramInt);
-
- public native void _SetTvSystem(int paramInt);
-
- public native void _TvOutResume(int paramInt);
-
- public native void _TvOutSetImageString(String paramString);
-
- public native void _TvOutSuspend(String paramString);
-
- public native boolean _TvoutSubtitleIsEnable();
-
- public native boolean _TvoutSubtitlePostBitmap(Bitmap paramBitmap, int paramInt);
-
- public native boolean _TvoutSubtitleSetStatus(int paramInt);
-
- public native int _getSubtitleHDMIHeight();
-
- public native int _getSubtitleHDMIWidth();
-
- public native boolean _isEnabled();
-
- public native boolean _isSuspended();
-
- public native boolean _isTvoutCableConnected();
-
- private final native void _native_setup(Object paramObject);
-
- private final native void _release();
-
- public native void _setTvoutCableConnected(int paramInt);
-
- private static final String FILE = "/system/bin/tvouthack";
-
- public static boolean isSupported() {
- return new File(FILE).exists();
- }
-
- static {
- System.loadLibrary("tvout_jni");
- }
-
- public TvOut() {
- _native_setup(new WeakReference<TvOut>(this));
- }
-
- public void finalize() {
- _release();
- }
-
- private static void postEventFromNative(Object tvOutRef, int what, int arg1, int arg2, Object obj) {
- TvOut tvOut = (TvOut)((WeakReference<TvOut>)tvOutRef).get();
-
- Log.d(TAG, "Native Event: " + what + " " + arg1 + " " + arg2);
- }
-
-}
diff --git a/AriesParts/src/com/cyanogenmod/settings/device/DeviceSettings.java b/AriesParts/src/com/cyanogenmod/settings/device/DeviceSettings.java
index ab87d54..2de617a 100644
--- a/AriesParts/src/com/cyanogenmod/settings/device/DeviceSettings.java
+++ b/AriesParts/src/com/cyanogenmod/settings/device/DeviceSettings.java
@@ -4,7 +4,6 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
-import android.hardware.TvOut;
import android.os.Bundle;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
@@ -19,9 +18,6 @@ public class DeviceSettings extends PreferenceActivity {
public static final String KEY_BACKLIGHT_TIMEOUT = "backlight_timeout";
public static final String KEY_HSPA = "hspa";
public static final String KEY_HSPA_CATEGORY = "category_radio";
- public static final String KEY_TVOUT_ENABLE = "tvout_enable";
- public static final String KEY_TVOUT_SYSTEM = "tvout_system";
- public static final String KEY_TVOUT_CATEGORY = "category_tvout";
public static final String KEY_VOLUME_BOOST = "volume_boost";
public static final String KEY_VOLUME_CATEGORY = "category_volume_boost";
public static final String KEY_CARDOCK_AUDIO = "cardock_audio";
@@ -33,24 +29,11 @@ public class DeviceSettings extends PreferenceActivity {
private ListPreference mMdnie;
private ListPreference mBacklightTimeout;
private ListPreference mHspa;
- private CheckBoxPreference mTvOutEnable;
- private ListPreference mTvOutSystem;
- private TvOut mTvOut;
private VolumeBoostPreference mVolumeBoost;
private CheckBoxPreference mCarDockAudio;
private CheckBoxPreference mDeskDockAudio;
private VibrationPreference mVibration;
- private BroadcastReceiver mHeadsetReceiver = new BroadcastReceiver() {
-
- @Override
- public void onReceive(Context context, Intent intent) {
- int state = intent.getIntExtra("state", 0);
- updateTvOutEnable(state != 0);
- }
-
- };
-
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -97,75 +80,20 @@ public class DeviceSettings extends PreferenceActivity {
mVibration = (VibrationPreference) findPreference(KEY_VIBRATION);
mVibration.setEnabled(VibrationPreference.isSupported());
-
- mTvOut = new TvOut();
- mTvOutEnable = (CheckBoxPreference) findPreference(KEY_TVOUT_ENABLE);
- mTvOutSystem = (ListPreference) findPreference(KEY_TVOUT_SYSTEM);
-
- if (mTvOut.isSupported()) {
-
- mTvOutEnable.setChecked(mTvOut._isEnabled());
- mTvOutEnable.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
-
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- boolean enable = (Boolean) newValue;
- Intent i = new Intent(DeviceSettings.this, TvOutService.class);
- i.putExtra(TvOutService.EXTRA_COMMAND, enable ? TvOutService.COMMAND_ENABLE : TvOutService.COMMAND_DISABLE);
- startService(i);
- return true;
- }
-
- });
-
- mTvOutSystem.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
-
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- if (mTvOut._isEnabled()) {
- int newSystem = Integer.valueOf((String) newValue);
- Intent i = new Intent(DeviceSettings.this, TvOutService.class);
- i.putExtra(TvOutService.EXTRA_COMMAND, TvOutService.COMMAND_CHANGE_SYSTEM);
- i.putExtra(TvOutService.EXTRA_SYSTEM, newSystem);
- startService(i);
- }
- return true;
- }
-
- });
- } else {
- PreferenceCategory category = (PreferenceCategory) getPreferenceScreen().findPreference(KEY_TVOUT_CATEGORY);
- category.removePreference(mTvOutEnable);
- category.removePreference(mTvOutSystem);
- getPreferenceScreen().removePreference(category);
- }
}
@Override
protected void onResume() {
super.onResume();
- registerReceiver(mHeadsetReceiver, new IntentFilter(Intent.ACTION_HEADSET_PLUG));
}
@Override
protected void onPause() {
super.onPause();
- unregisterReceiver(mHeadsetReceiver);
- }
-
- private void updateTvOutEnable(boolean connected) {
- mTvOutEnable.setEnabled(connected);
- mTvOutEnable.setSummaryOff(connected ? R.string.tvout_enable_summary : R.string.tvout_enable_summary_nocable);
-
- if (!connected && mTvOutEnable.isChecked()) {
- // Disable on unplug (UI)
- mTvOutEnable.setChecked(false);
- }
}
@Override
protected void onDestroy() {
- mTvOut.finalize();
super.onDestroy();
}
diff --git a/AriesParts/src/com/cyanogenmod/settings/device/TvOutService.java b/AriesParts/src/com/cyanogenmod/settings/device/TvOutService.java
deleted file mode 100644
index bb2797e..0000000
--- a/AriesParts/src/com/cyanogenmod/settings/device/TvOutService.java
+++ /dev/null
@@ -1,146 +0,0 @@
-package com.cyanogenmod.settings.device;
-
-import android.app.Service;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.SharedPreferences;
-import android.hardware.TvOut;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.os.ServiceManager;
-import android.os.SystemProperties;
-import android.preference.PreferenceManager;
-import android.view.Display;
-import android.view.IRotationWatcher;
-import android.view.IWindowManager;
-import android.view.WindowManager;
-
-public class TvOutService extends Service {
-
- public static final String EXTRA_COMMAND = "command";
- public static final String EXTRA_SYSTEM = "system";
- public static final String COMMAND_ENABLE = "enable";
- public static final String COMMAND_DISABLE = "disable";
- public static final String COMMAND_CHANGE_SYSTEM = "system";
-
- private TvOut mTvOut;
- private SharedPreferences mPref;
- private int mSystem;
- private boolean mWasOn = false; // For enabling on screen on
-
- private BroadcastReceiver mReceiver = new BroadcastReceiver() {
-
- @Override
- public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
- if (Intent.ACTION_HEADSET_PLUG.equals(action)) {
- int state = intent.getIntExtra("state", 0);
- if (state == 0 && mTvOut._isEnabled()) {
- // Disable when cable is unplugged
- mWasOn = false;
- disable();
- stopSelf();
- }
- }
- else if (Intent.ACTION_SCREEN_ON.equals(action)) {
- if (mWasOn) {
- SystemProperties.set("ctl.start", "tvouthack");
- mWasOn = false;
- }
- }
- else if (Intent.ACTION_SCREEN_OFF.equals(action)) {
- if (mTvOut._isEnabled()) {
- mWasOn = true;
- SystemProperties.set("ctl.stop", "tvouthack");
- }
- }
- }
-
- };
-
- @Override
- public IBinder onBind(Intent intent) {
- return null;
- }
-
- @Override
- public void onCreate() {
- mTvOut = new TvOut();
- mPref = PreferenceManager.getDefaultSharedPreferences(this);
-
- IWindowManager wm = IWindowManager.Stub.asInterface(ServiceManager.getService("window"));
- try {
- wm.watchRotation(new IRotationWatcher.Stub() {
- @Override
- public void onRotationChanged(int rotation) {
- TvOutService.this.onRotationChanged(rotation);
- }
- });
- }
- catch (RemoteException e) { }
-
- IntentFilter filter = new IntentFilter(Intent.ACTION_HEADSET_PLUG);
- filter.addAction(Intent.ACTION_SCREEN_OFF);
- filter.addAction(Intent.ACTION_SCREEN_ON);
- registerReceiver(mReceiver, filter);
- }
-
- @Override
- public int onStartCommand(Intent intent, int flags, int startId) {
- if (intent != null) {
- String command = intent.getStringExtra("command");
- if (COMMAND_ENABLE.equals(command)) {
- mSystem = Integer.parseInt(mPref.getString(DeviceSettings.KEY_TVOUT_SYSTEM, "2")); // Default = PAL
- enable();
- }
- else if (COMMAND_DISABLE.equals(command)) {
- disable();
- stopSelf();
- }
- else if (COMMAND_CHANGE_SYSTEM.equals(command)) {
- if (mTvOut._isEnabled()) {
- mSystem = intent.getIntExtra(EXTRA_SYSTEM, 2);
- disable();
- enable();
- }
- }
- }
-
- return START_STICKY;
- }
-
- @Override
- public void onDestroy() {
- unregisterReceiver(mReceiver);
- mTvOut.finalize();
- super.onDestroy();
- }
-
- public void onRotationChanged(int rotation) {
- mTvOut._SetOrientation(rotation);
- }
-
- private void enable() {
- mTvOut._SetTvSystem(mSystem);
- mTvOut._TvOutSetImageString("TV-out not supported while application running. Phone display only");
-
- Display display = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
- mTvOut._SetOrientation(display.getRotation());
-
- mTvOut._EnableTvOut();
- mTvOut._setTvoutCableConnected(1);
-
- // Start tvouthack service used to bombard screen refresh messages
- SystemProperties.set("ctl.start", "tvouthack");
- }
-
- private void disable() {
- SystemProperties.set("ctl.stop", "tvouthack");
-
- mTvOut._DisableTvOut();
- mTvOut._setTvoutCableConnected(0);
- }
-
-}