Skip to content

Commit

Permalink
Add misc, voice volume factor
Browse files Browse the repository at this point in the history
start vdd
  • Loading branch information
stocky89 committed Oct 3, 2011
1 parent e335d55 commit f9e3618
Show file tree
Hide file tree
Showing 12 changed files with 227 additions and 23 deletions.
1 change: 1 addition & 0 deletions AndroidManifest.xml
Expand Up @@ -21,6 +21,7 @@
<activity android:name="Sound"></activity> <activity android:name="Sound"></activity>
<activity android:name="Vdd"></activity> <activity android:name="Vdd"></activity>
<activity android:name="About"></activity> <activity android:name="About"></activity>
<activity android:name="Misc"></activity>


</application> </application>


Expand Down
12 changes: 12 additions & 0 deletions 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>
13 changes: 13 additions & 0 deletions res/layout/sound.xml
Expand Up @@ -4,6 +4,19 @@
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="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" <CheckBox android:text="@string/use_phone_mic"
android:id="@+id/checkBox1" android:layout_width="wrap_content" android:id="@+id/checkBox1" android:layout_width="wrap_content"
android:layout_height="wrap_content"></CheckBox> android:layout_height="wrap_content"></CheckBox>
Expand Down
10 changes: 4 additions & 6 deletions res/layout/vdd.xml
Expand Up @@ -4,11 +4,9 @@
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:gravity="right"> 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> <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: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"> <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>
<requestFocus></requestFocus> <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>
</EditText> <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>
<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>


</RelativeLayout> </RelativeLayout>
4 changes: 2 additions & 2 deletions res/values-pt/strings.xml
Expand Up @@ -13,6 +13,7 @@
<string name="use_phone_mic">Força o uso do microfone to telemóvel com o headset</string> <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="speakerphone_echo_fix">Fix para o echo do microfone</string>
<string name="disable_keypad_leds">Disable keypad LEDs</string> <string name="disable_keypad_leds">Disable keypad LEDs</string>
<string name="volumefactor">Voice volume</string>
<string-array name="menuItems_array"> <string-array name="menuItems_array">
<item>Teclas Haptic Feedback</item> <item>Teclas Haptic Feedback</item>
<item>Filtro do Touchscreen</item> <item>Filtro do Touchscreen</item>
Expand All @@ -21,8 +22,7 @@
<item>Frequência e escalonador do CPU</item> <item>Frequência e escalonador do CPU</item>
<item>Sequenciador I/O</item> <item>Sequenciador I/O</item>
<item>Definições de som</item> <item>Definições de som</item>
<item>Dynamic Undervolting</item> <item>Miscellaneous</item>
<item>About X5settings</item>
</string-array> </string-array>
<string-array name="sel_storage"> <string-array name="sel_storage">
<item>Armazenamento Interno</item> <item>Armazenamento Interno</item>
Expand Down
4 changes: 2 additions & 2 deletions res/values-zh/strings.xml
Expand Up @@ -15,6 +15,7 @@
<string name="use_phone_mic">强制使用耳机麦克风</string> <string name="use_phone_mic">强制使用耳机麦克风</string>
<string name="speakerphone_echo_fix">修复扬声器回声</string> <string name="speakerphone_echo_fix">修复扬声器回声</string>
<string name="disable_keypad_leds">临时关闭键盘LED显示</string> <string name="disable_keypad_leds">临时关闭键盘LED显示</string>
<string name="volumefactor">Voice volume</string>
<string-array name="menuItems_array"> <string-array name="menuItems_array">
<item>软键盘震动强度</item> <item>软键盘震动强度</item>
<item>触摸屏过滤器</item> <item>触摸屏过滤器</item>
Expand All @@ -23,8 +24,7 @@
<item>CPU 频率管理 </item> <item>CPU 频率管理 </item>
<item>I/O 调度</item> <item>I/O 调度</item>
<item>音频设置</item> <item>音频设置</item>
<item>动态低电压设置</item> <item>Miscellaneous</item>
<item>关于 U8800设置</item>
</string-array> </string-array>
<string-array name="sel_storage"> <string-array name="sel_storage">
<item>內部存储器</item> <item>內部存储器</item>
Expand Down
6 changes: 4 additions & 2 deletions res/values/strings.xml
Expand Up @@ -15,6 +15,9 @@
<string name="use_phone_mic">Force phone mic with headset</string> <string name="use_phone_mic">Force phone mic with headset</string>
<string name="speakerphone_echo_fix">Fix speakerphone echo</string> <string name="speakerphone_echo_fix">Fix speakerphone echo</string>
<string name="disable_keypad_leds">Disable keypad LEDs</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"> <string-array name="menuItems_array">
<item>Softkey Haptic Feedback</item> <item>Softkey Haptic Feedback</item>
<item>Touchscreen Filter</item> <item>Touchscreen Filter</item>
Expand All @@ -23,8 +26,7 @@
<item>CPU Frequency and Governor</item> <item>CPU Frequency and Governor</item>
<item>I/O Scheduler</item> <item>I/O Scheduler</item>
<item>Audio Settings</item> <item>Audio Settings</item>
<item>Dynamic Undervolting</item> <item>Miscellaneous</item>
<item>About X5settings</item>
</string-array> </string-array>
<string-array name="sel_storage"> <string-array name="sel_storage">
<item>Internal Storage</item> <item>Internal Storage</item>
Expand Down
2 changes: 1 addition & 1 deletion src/com/ideos/x5settings/Haptic.java
Expand Up @@ -75,7 +75,7 @@ public void onStopTrackingTouch(SeekBar seekBar) {
public void setVibrate(Boolean vibrate){ public void setVibrate(Boolean vibrate){
boolean WRITE = false; boolean WRITE = false;
int newVibeLength = 0; 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"); WRITE = Rootcommands.runRootCommand("mount -o rw,remount -t ext4 /dev/block/mmcblk0p12 /system");
if(WRITE) { if(WRITE) {
Rootcommands.runRootCommand("echo -e 'echo "+newVibeLength+" > /sys/module/synaptics_i2c_rmi_1564/parameters/vibrate\n" + Rootcommands.runRootCommand("echo -e 'echo "+newVibeLength+" > /sys/module/synaptics_i2c_rmi_1564/parameters/vibrate\n" +
Expand Down
82 changes: 82 additions & 0 deletions 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");

This comment has been minimized.

Copy link
@icehong

icehong Oct 4, 2011

Contributor

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 ?

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());
}

}
}
38 changes: 35 additions & 3 deletions src/com/ideos/x5settings/Sound.java
Expand Up @@ -9,12 +9,16 @@
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.SeekBar;
import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;


public class Sound extends Activity{ public class Sound extends Activity{
private Button applyButton; private Button applyButton;
private CheckBox forceHeadset; private CheckBox forceHeadset;
private CheckBox speakerphoneEcho; private CheckBox speakerphoneEcho;
private SeekBar seekBar;
private TextView seekBarValue;


public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
Expand All @@ -23,14 +27,29 @@ public void onCreate(Bundle savedInstanceState) {
applyButton = (Button) findViewById(R.id.button1); applyButton = (Button) findViewById(R.id.button1);
forceHeadset = (CheckBox) findViewById(R.id.checkBox1); forceHeadset = (CheckBox) findViewById(R.id.checkBox1);
speakerphoneEcho = (CheckBox) findViewById(R.id.checkBox2); 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() { applyButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) { public void onClick(View view) {
setSound(); setSound();
} }
}); });

getSoundSettings();
} }


public void setSound(){ public void setSound(){
Expand All @@ -52,6 +71,7 @@ public void setSound(){
headsetSwitch+"\n"+ headsetSwitch+"\n"+
echoFix + echoFix +
"' > /etc/init.d/15sound"); "' > /etc/init.d/15sound");
Rootcommands.runRootCommand("echo " + seekBar.getProgress() + " > /system/etc/volumefactor.txt");
Rootcommands.runRootCommand("chmod +x /system/etc/init.d/15sound"); Rootcommands.runRootCommand("chmod +x /system/etc/init.d/15sound");
Rootcommands.runRootCommand("mount -o ro,remount -t ext4 /dev/block/mmcblk0p12 /system"); Rootcommands.runRootCommand("mount -o ro,remount -t ext4 /dev/block/mmcblk0p12 /system");
WRITE = false; WRITE = false;
Expand All @@ -64,7 +84,7 @@ public void setSound(){
} }


public void getSoundSettings() { public void getSoundSettings() {
String settings[] = {null, null}; String settings[] = {null, null, null};
try { try {
FileReader input = new FileReader("/sys/module/snd_soc_msm7kv2/parameters/headset_mic_switch"); FileReader input = new FileReader("/sys/module/snd_soc_msm7kv2/parameters/headset_mic_switch");
BufferedReader reader = new BufferedReader(input); BufferedReader reader = new BufferedReader(input);
Expand All @@ -79,11 +99,23 @@ public void getSoundSettings() {


settings[1] = reader.readLine(); 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[0])==1) forceHeadset.setChecked(true);
if (Integer.valueOf(settings[1])==1) speakerphoneEcho.setChecked(true); if (Integer.valueOf(settings[1])==1) speakerphoneEcho.setChecked(true);
seekBar.setProgress(Integer.valueOf(settings[2]));
} catch (Exception e) { } catch (Exception e) {
Log.d("X5 Settings", "Unexpected error: "+e.getMessage()); Log.d("X5 Settings", "Unexpected error: "+e.getMessage());
} }

} }
} }
74 changes: 69 additions & 5 deletions src/com/ideos/x5settings/Vdd.java
Expand Up @@ -3,19 +3,83 @@
import java.io.BufferedReader; import java.io.BufferedReader;


import android.app.Activity; import android.app.Activity;
import android.view.View;
import android.widget.Button; import android.widget.Button;
import android.os.Bundle; import android.os.Bundle;
import android.widget.CheckBox; import android.widget.AdapterView;
import android.widget.SeekBar; import android.widget.ArrayAdapter;
import android.widget.TextView; import android.widget.Spinner;
import android.view.View; import android.widget.EditText;
import android.util.Log; import android.util.Log;
import android.widget.Toast; import android.widget.Toast;


public class Vdd extends Activity { 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) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.vdd); 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) {
}
} }
} }
4 changes: 2 additions & 2 deletions src/com/ideos/x5settings/X5settings.java
Expand Up @@ -68,9 +68,9 @@ else if (position == 5)
else if (position == 6) else if (position == 6)
myIntent = new Intent(v.getContext(), Sound.class); myIntent = new Intent(v.getContext(), Sound.class);
else if (position == 7) else if (position == 7)
myIntent = new Intent(v.getContext(), Vdd.class); myIntent = new Intent(v.getContext(), Misc.class);
else if (position == 8) else if (position == 8)
myIntent = new Intent(v.getContext(), About.class); myIntent = new Intent(v.getContext(), Vdd.class);
else else
myIntent = null; myIntent = null;
if (ROOT) if (ROOT)
Expand Down

0 comments on commit f9e3618

Please sign in to comment.