Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add misc, voice volume factor

start vdd
  • Loading branch information...
commit f9e3618538036954a634779d49cff3dabb56312c 1 parent e335d55
@stockwell authored
View
1  AndroidManifest.xml
@@ -21,6 +21,7 @@
<activity android:name="Sound"></activity>
<activity android:name="Vdd"></activity>
<activity android:name="About"></activity>
+ <activity android:name="Misc"></activity>
</application>
View
12 res/layout/misc.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="vertical"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent">
+ <CheckBox android:text="@string/gemini"
+ android:id="@+id/checkBox1" android:layout_width="wrap_content"
+ android:layout_height="wrap_content"></CheckBox>
+ <Button android:layout_gravity="center_horizontal" android:id="@+id/button1" android:text="@android:string/ok" android:layout_height="wrap_content" android:layout_width="wrap_content"></Button>
+
+</LinearLayout>
View
13 res/layout/sound.xml
@@ -4,6 +4,19 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
+ <TextView android:id="@+id/textview1"
+ android:layout_width="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium"
+ android:text="@string/volumefactor" android:layout_height="wrap_content"></TextView>
+ <SeekBar android:id="@+id/seekBar1"
+ android:layout_height="wrap_content" android:layout_width="match_parent"
+ android:max="150" android:layout_marginLeft="15dip" android:layout_marginRight="15dip"></SeekBar>
+ <TextView android:layout_gravity="right"
+ android:id="@+id/textView2" android:layout_width="wrap_content"
+ android:textAppearance="?android:attr/textAppearanceMedium" android:text="textView2"
+ android:layout_height="wrap_content"></TextView>
+ <TextView android:id="@+id/textView3"
+ android:layout_width="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium"
+ android:text="@string/sound_options" android:layout_height="wrap_content"></TextView>
<CheckBox android:text="@string/use_phone_mic"
android:id="@+id/checkBox1" android:layout_width="wrap_content"
android:layout_height="wrap_content"></CheckBox>
View
10 res/layout/vdd.xml
@@ -4,11 +4,9 @@
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent" android:gravity="right">
- <Spinner android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_height="wrap_content" android:layout_width="match_parent" android:id="@+id/spinner1"></Spinner>
- <EditText android:layout_alignParentLeft="true" android:layout_below="@+id/spinner1" android:layout_height="wrap_content" android:id="@+id/editText1" android:layout_width="match_parent" android:inputType="number">
- <requestFocus></requestFocus>
- </EditText>
- <Button android:text="@android:string/ok" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/editText1" android:layout_alignParentRight="true" android:layout_marginRight="100dp"></Button>
- <Button android:text="Test" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/editText1" android:layout_toLeftOf="@+id/button1" android:layout_marginRight="35dp"></Button>
+ <Spinner android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_height="wrap_content" android:layout_width="match_parent" android:id="@+id/spinner1" android:layout_marginLeft="10dip" android:layout_marginRight="10dip"></Spinner>
+ <EditText android:id="@+id/editText1" android:inputType="number" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignTop="@+id/button2" android:layout_alignRight="@+id/button2" android:layout_marginLeft="58dip" android:layout_marginRight="48dp"></EditText>
+ <Button android:layout_width="wrap_content" android:text="@android:string/ok" android:id="@+id/button1" android:layout_height="wrap_content" android:layout_below="@+id/editText1" android:layout_centerHorizontal="true" android:layout_marginTop="14dp"></Button>
+ <Button android:layout_width="wrap_content" android:text="Test" android:id="@+id/button2" android:layout_height="wrap_content" android:layout_below="@+id/spinner1" android:layout_toRightOf="@+id/button1" android:layout_marginLeft="33dp"></Button>
</RelativeLayout>
View
4 res/values-pt/strings.xml
@@ -13,6 +13,7 @@
<string name="use_phone_mic">Força o uso do microfone to telemóvel com o headset</string>
<string name="speakerphone_echo_fix">Fix para o echo do microfone</string>
<string name="disable_keypad_leds">Disable keypad LEDs</string>
+ <string name="volumefactor">Voice volume</string>
<string-array name="menuItems_array">
<item>Teclas Haptic Feedback</item>
<item>Filtro do Touchscreen</item>
@@ -21,8 +22,7 @@
<item>Frequência e escalonador do CPU</item>
<item>Sequenciador I/O</item>
<item>Definições de som</item>
- <item>Dynamic Undervolting</item>
- <item>About X5settings</item>
+ <item>Miscellaneous</item>
</string-array>
<string-array name="sel_storage">
<item>Armazenamento Interno</item>
View
4 res/values-zh/strings.xml
@@ -15,6 +15,7 @@
<string name="use_phone_mic">强制使用耳机麦克风</string>
<string name="speakerphone_echo_fix">修复扬声器回声</string>
<string name="disable_keypad_leds">临时关闭键盘LED显示</string>
+ <string name="volumefactor">Voice volume</string>
<string-array name="menuItems_array">
<item>软键盘震动强度</item>
<item>触摸屏过滤器</item>
@@ -23,8 +24,7 @@
<item>CPU 频率管理 </item>
<item>I/O 调度</item>
<item>音频设置</item>
- <item>动态低电压设置</item>
- <item>关于 U8800设置</item>
+ <item>Miscellaneous</item>
</string-array>
<string-array name="sel_storage">
<item>內部存储器</item>
View
6 res/values/strings.xml
@@ -15,6 +15,9 @@
<string name="use_phone_mic">Force phone mic with headset</string>
<string name="speakerphone_echo_fix">Fix speakerphone echo</string>
<string name="disable_keypad_leds">Disable keypad LEDs</string>
+ <string name="volumefactor">Voice Volume</string>
+ <string name="sound_options">Other Options</string>
+ <string name="gemini">Enable Gemini JPEG encoding engine</string>
<string-array name="menuItems_array">
<item>Softkey Haptic Feedback</item>
<item>Touchscreen Filter</item>
@@ -23,8 +26,7 @@
<item>CPU Frequency and Governor</item>
<item>I/O Scheduler</item>
<item>Audio Settings</item>
- <item>Dynamic Undervolting</item>
- <item>About X5settings</item>
+ <item>Miscellaneous</item>
</string-array>
<string-array name="sel_storage">
<item>Internal Storage</item>
View
2  src/com/ideos/x5settings/Haptic.java
@@ -75,7 +75,7 @@ public void onStopTrackingTouch(SeekBar seekBar) {
public void setVibrate(Boolean vibrate){
boolean WRITE = false;
int newVibeLength = 0;
- if(vibrate) newVibeLength = vibLength;
+ if(vibrate) newVibeLength = seekBar.getProgress();
WRITE = Rootcommands.runRootCommand("mount -o rw,remount -t ext4 /dev/block/mmcblk0p12 /system");
if(WRITE) {
Rootcommands.runRootCommand("echo -e 'echo "+newVibeLength+" > /sys/module/synaptics_i2c_rmi_1564/parameters/vibrate\n" +
View
82 src/com/ideos/x5settings/Misc.java
@@ -0,0 +1,82 @@
+package com.ideos.x5settings;
+
+import java.io.BufferedReader;
+import java.io.FileReader;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.Toast;
+
+public class Misc extends Activity{
+ private Button applyButton;
+ private CheckBox geminiBox;
+
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.misc);
+
+ applyButton = (Button) findViewById(R.id.button1);
+ geminiBox = (CheckBox) findViewById(R.id.checkBox1);
+
+ applyButton.setOnClickListener(new View.OnClickListener() {
+ public void onClick(View view) {
+ setMisc();
+ }
+ });
+
+ getMiscSettings();
+
+ }
+
+ public void setMisc(){
+ boolean WRITE = false;
+ String gemini = "chmod ";
+ gemini += geminiBox.isChecked() ? "0666" : "0000";
+ gemini += " /dev/gemini0";
+
+ WRITE = Rootcommands.runRootCommand("mount -o rw,remount -t ext4 /dev/block/mmcblk0p12 /system");
+
+ if(WRITE) {
+ Rootcommands.runRootCommand(gemini);
+ Rootcommands.runRootCommand("echo "+
+ gemini +
+ " > /etc/init.d/16misc");
+ Rootcommands.runRootCommand("chmod +x /system/etc/init.d/16misc");
@icehong
icehong added a note

When i enable this option and close X5Setting , next time I open misc page , The check box was not checked .

I debug on my u8800 and found at Line 65 FileReader throws an 'no permission' exception.

I don't know why it happen . How about add an 'r' here ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ Rootcommands.runRootCommand("mount -o ro,remount -t ext4 /dev/block/mmcblk0p12 /system");
+ WRITE = false;
+ Toast complete = Toast.makeText(this, R.string.complete, 2000);
+ complete.show();
+ }
+ else {
+ Log.d("X5 Settings", "Error writing file");
+ }
+ }
+
+ public void getMiscSettings() {
+ String settings = null;
+ FileReader input;
+ BufferedReader reader;
+
+ try {
+ input = new FileReader("/etc/init.d/16misc");
+ reader = new BufferedReader(input);
+
+ settings = reader.readLine();
+
+ reader.close();
+ input.close();
+
+ if(settings.split(" ")[1].matches("0666")){
+ geminiBox.setChecked(true);
+ }
+
+ }catch (Exception e) {
+ Log.d("X5 Settings", "Unexpected error: "+e.getMessage());
+ }
+
+ }
+}
View
38 src/com/ideos/x5settings/Sound.java
@@ -9,12 +9,16 @@
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
+import android.widget.SeekBar;
+import android.widget.TextView;
import android.widget.Toast;
public class Sound extends Activity{
private Button applyButton;
private CheckBox forceHeadset;
private CheckBox speakerphoneEcho;
+ private SeekBar seekBar;
+ private TextView seekBarValue;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
@@ -23,14 +27,29 @@ public void onCreate(Bundle savedInstanceState) {
applyButton = (Button) findViewById(R.id.button1);
forceHeadset = (CheckBox) findViewById(R.id.checkBox1);
speakerphoneEcho = (CheckBox) findViewById(R.id.checkBox2);
+ seekBar = (SeekBar) findViewById(R.id.seekBar1);
+ seekBarValue = (TextView) findViewById(R.id.textView2);
- getSoundSettings();
+ seekBar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener(){
+ public void onProgressChanged(SeekBar seekBar, int progress,boolean fromUser) {
+ seekBarValue.setText(String.valueOf(progress));
+ }
+
+ public void onStartTrackingTouch(SeekBar seekBar) {
+ }
+
+ public void onStopTrackingTouch(SeekBar seekBar) {
+ }
+ });
+
applyButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
setSound();
}
});
+
+ getSoundSettings();
}
public void setSound(){
@@ -52,6 +71,7 @@ public void setSound(){
headsetSwitch+"\n"+
echoFix +
"' > /etc/init.d/15sound");
+ Rootcommands.runRootCommand("echo " + seekBar.getProgress() + " > /system/etc/volumefactor.txt");
Rootcommands.runRootCommand("chmod +x /system/etc/init.d/15sound");
Rootcommands.runRootCommand("mount -o ro,remount -t ext4 /dev/block/mmcblk0p12 /system");
WRITE = false;
@@ -64,7 +84,7 @@ public void setSound(){
}
public void getSoundSettings() {
- String settings[] = {null, null};
+ String settings[] = {null, null, null};
try {
FileReader input = new FileReader("/sys/module/snd_soc_msm7kv2/parameters/headset_mic_switch");
BufferedReader reader = new BufferedReader(input);
@@ -79,11 +99,23 @@ public void getSoundSettings() {
settings[1] = reader.readLine();
+ reader.close();
+ input.close();
+
+ input = new FileReader("/etc/volumefactor.txt");
+ reader = new BufferedReader(input);
+
+ settings[2] = reader.readLine();
+
+ reader.close();
+ input.close();
+
if (Integer.valueOf(settings[0])==1) forceHeadset.setChecked(true);
if (Integer.valueOf(settings[1])==1) speakerphoneEcho.setChecked(true);
-
+ seekBar.setProgress(Integer.valueOf(settings[2]));
} catch (Exception e) {
Log.d("X5 Settings", "Unexpected error: "+e.getMessage());
}
+
}
}
View
74 src/com/ideos/x5settings/Vdd.java
@@ -3,19 +3,83 @@
import java.io.BufferedReader;
import android.app.Activity;
+import android.view.View;
import android.widget.Button;
import android.os.Bundle;
-import android.widget.CheckBox;
-import android.widget.SeekBar;
-import android.widget.TextView;
-import android.view.View;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.Spinner;
+import android.widget.EditText;
import android.util.Log;
import android.widget.Toast;
public class Vdd extends Activity {
-
+
+ private static final int freq_count = 14;
+
+ private Button applyButton;
+ private Button testButton;
+ private Spinner frequencySpinner;
+ private EditText VDD;
+
+ String[] frequencies = new String[freq_count];
+ String[] vdds = new String[freq_count];
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.vdd);
+
+ VDD = (EditText) findViewById(R.id.editText1);
+ frequencySpinner = (Spinner) findViewById(R.id.spinner1);
+
+ getFreqs();
+
+ ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
+ android.R.layout.simple_spinner_item, frequencies);
+ frequencySpinner.setAdapter(adapter);
+
+ frequencySpinner.setOnItemSelectedListener(new Spinner.OnItemSelectedListener(){
+ public void onItemSelected(AdapterView<?> arg0, View arg1,
+ int arg2, long arg3) {
+ VDD.setText(vdds[arg2]);
+
+ }
+
+ public void onNothingSelected(AdapterView<?> arg0) {
+ // TODO Auto-generated method stub
+
+ }
+ });
+ }
+
+ public void getFreqs() {
+ String tmp = null;
+ int i = 0;
+ try {
+ FileReader input = new FileReader("/sys/devices/system/cpu/cpu0/cpufreq/vdd_levels");
+ BufferedReader reader = new BufferedReader(input);
+
+ while((tmp=reader.readLine())!=null){
+ frequencies[i] = tmp.split(": ")[0];
+ frequencies[i] = frequencies[i].replaceAll(" ", "");
+ vdds[i] = tmp.split(": ")[1].trim();
+ i++;
+ }
+ } catch (Exception e) {
+ Log.d("X5 Settings", "Unexpected error: "+e.getMessage());
+ }
+ }
+
+ public void setVdd(){
+ boolean WRITE = false;
+ int i=0;
+ for (i=0;i<freq_count;i++){
+ String command = "echo ";
+ command += frequencies[i] +
+ " " +
+ vdds[i];
+ }
+ WRITE = Rootcommands.runRootCommand("mount -o rw,remount -t ext4 /dev/block/mmcblk0p12 /system");
+ if(WRITE) {
+ }
}
}
View
4 src/com/ideos/x5settings/X5settings.java
@@ -68,9 +68,9 @@ else if (position == 5)
else if (position == 6)
myIntent = new Intent(v.getContext(), Sound.class);
else if (position == 7)
- myIntent = new Intent(v.getContext(), Vdd.class);
+ myIntent = new Intent(v.getContext(), Misc.class);
else if (position == 8)
- myIntent = new Intent(v.getContext(), About.class);
+ myIntent = new Intent(v.getContext(), Vdd.class);
else
myIntent = null;
if (ROOT)
Please sign in to comment.
Something went wrong with that request. Please try again.