1、ToolsActivity.java
package com.waterworld.tools;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import android.content.Intent;
import android.os.Bundle;
import android.preference.ListPreference;
import android.preference.Preference;
import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
import android.preference.SwitchPreference;
import android.provider.Settings;
import android.util.Log;
public class ToolsActivity extends PreferenceActivity implements OnPreferenceChangeListener {
private final static String TAG = "ToolsActivity";
private static final String OTG_PATH = "/sys/hw_info/otg_conctrl";
private static final String CPU_PATH = "/proc/ppm/policy/ut_fix_freq_idx";
private static final String LIGHT_PATH = "/sys/hw_info/assistant_light_gpio";
private static final String HALL_PATH = "/sys/hw_info/irtx_pwm";
private static final String ETHERNET_PATH = "/sys/hw_info/rs485_gpio9_en";
private static final String ACCELEROMETER_PATH = "/sys/bus/platform/drivers/gsen/mc3416_enable";
private static final String SELECT_LAUNCHER_MODE_PREFERENCE = "select_launcher_mode_preference";
private static final String SELECT_OTG_USB_EXCHANGE_PREFERENCE = "select_otg_usb_exchange_preference";
private static final String SELECT_CPU_FREQ_PREFERENCE = "select_cpu_freq_preference";
private static final String SELECT_FONGT_LIGHT_PREFERENCE = "select_flash_light_preference";
private static final String TOGGLE_NAV_CONTROL_PREFERENCE = "toggle_nav_control_preference";
private static final String TOGGLE_STATUS_CONTROL_PREFERENCE = "toggle_status_control_preference";
private static final String TOGGLE_HALL_CONTROL_PREFERENCE = "toggle_hall_control_preference";
private static final String TOGGLE_ETHERNET_CONTROL_PREFERENCE = "toggle_ethernet_control_preference";
private static final String TOGGLE_ACCELE_CONTROL_PREFERENCE = "toggle_accele_control_preference";
private static final String TOGGLE_CALL_CONTROL_PREFERENCE = "toggle_call_control_preference";
private final Map<String, String> mLauncherModeValueToTitleMap = new HashMap<>();
private final Map<String, String> mOtgUsbExchangeValueToTitleMap = new HashMap<>();
private final Map<String, String> mCpuFreqValueToTitleMap = new HashMap<>();
private final Map<String, String> mFontLightValueToTitleMap = new HashMap<>();
private ListPreference mSelectOtgUsbExchangePreference;
private ListPreference mSelectLauncherModePreference;
private ListPreference mSelectCpuFreqPreference;
private ListPreference mSelectFontLightPreference;
private SwitchPreference mToggleNavControlPreference;
private SwitchPreference mToggleStatusControlPreference;
private SwitchPreference mToggleHallControlPreference;
private SwitchPreference mToggleEthernetControlPreference;
private SwitchPreference mToggleAcceleControlPreference;
private SwitchPreference mToggleCallControlPreference;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.i(TAG, "---onCreat---");
// setContentView(R.layout.tools_settings);
addPreferencesFromResource(R.layout.tools_settings);
initializeAllPreferences();
}
@Override
protected void onResume() {
// TODO 自动生成的方法存根
updateSystemPreferences();
super.onResume();
}
@Override
protected void onDestroy() {
// TODO 自动生成的方法存根
super.onDestroy();
}
private void initializeAllPreferences() {
// Launcher Mode
mSelectLauncherModePreference = (ListPreference) findPreference(
SELECT_LAUNCHER_MODE_PREFERENCE);
mSelectLauncherModePreference.setOnPreferenceChangeListener(this);
if (mLauncherModeValueToTitleMap.size() == 0) {
String[] launcherModeValues = getResources()
.getStringArray(R.array.select_launcher_mode_preference_values);
String[] launcherModeTitles = getResources()
.getStringArray(R.array.select_launcher_mode_preference_titles);
final int launcherModeValuesCount = launcherModeValues.length;
for (int i = 0; i < launcherModeValuesCount; i++) {
mLauncherModeValueToTitleMap.put(launcherModeValues[i],
launcherModeTitles[i]);
}
}
// OTG and USB exchange
mSelectOtgUsbExchangePreference = (ListPreference) findPreference(
SELECT_OTG_USB_EXCHANGE_PREFERENCE);
mSelectOtgUsbExchangePreference.setOnPreferenceChangeListener(this);
if (mOtgUsbExchangeValueToTitleMap.size() == 0) {
String[] otgUsbExchangeValues = getResources()
.getStringArray(R.array.select_otg_usb_exchange_preference_values);
String[] otgUsbExchangeTitles = getResources()
.getStringArray(R.array.select_otg_usb_exchange_preference_titles);
final int otgUsbExchangeValuesCount = otgUsbExchangeValues.length;
for (int i = 0; i < otgUsbExchangeValuesCount; i++) {
mOtgUsbExchangeValueToTitleMap.put(otgUsbExchangeValues[i],
otgUsbExchangeTitles[i]);
}
}
// CPU Freq
mSelectCpuFreqPreference = (ListPreference) findPreference(SELECT_CPU_FREQ_PREFERENCE);
mSelectCpuFreqPreference.setOnPreferenceChangeListener(this);
if (mCpuFreqValueToTitleMap.size() == 0) {
String[] cpuFreqValues = getResources()
.getStringArray(R.array.select_cpu_freq_preference_values);
String[] cpuFreqTitles = getResources()
.getStringArray(R.array.select_cpu_freq_preference_titles);
final int cpuFreqValuesCount = cpuFreqValues.length;
for (int i = 0; i < cpuFreqValuesCount; i++) {
mCpuFreqValueToTitleMap.put(cpuFreqValues[i], cpuFreqTitles[i]);
}
}
// Font Light
mSelectFontLightPreference = (ListPreference) findPreference(SELECT_FONGT_LIGHT_PREFERENCE);
mSelectFontLightPreference.setOnPreferenceChangeListener(this);
if (mFontLightValueToTitleMap.size() == 0) {
String[] fontLightValues = getResources()
.getStringArray(R.array.select_flash_light_preference_values);
String[] cpuFreqTitles = getResources()
.getStringArray(R.array.select_flash_light_preference_titles);
final int cpuFreqValuesCount = fontLightValues.length;
for (int i = 0; i < cpuFreqValuesCount; i++) {
mFontLightValueToTitleMap.put(fontLightValues[i], cpuFreqTitles[i]);
}
}
// Nav Control
mToggleNavControlPreference = (SwitchPreference) findPreference(
TOGGLE_NAV_CONTROL_PREFERENCE);
// Status Control
mToggleStatusControlPreference = (SwitchPreference) findPreference(
TOGGLE_STATUS_CONTROL_PREFERENCE);
// Hall Control
mToggleHallControlPreference = (SwitchPreference) findPreference(
TOGGLE_HALL_CONTROL_PREFERENCE);
// Ethernet Control
mToggleEthernetControlPreference = (SwitchPreference) findPreference(
TOGGLE_ETHERNET_CONTROL_PREFERENCE);
// Accele Control
mToggleAcceleControlPreference = (SwitchPreference) findPreference(
TOGGLE_ACCELE_CONTROL_PREFERENCE);
// Call Control
mToggleCallControlPreference = (SwitchPreference) findPreference(
TOGGLE_CALL_CONTROL_PREFERENCE);
}
private void updateSystemPreferences() {
// Launcher Mode
String launcherValue = Settings.System.getString(getContentResolver(), "LAUNCHER_MODE");
if (launcherValue == null || "".equals(launcherValue)){
launcherValue = "0";
}
mSelectLauncherModePreference.setValue(launcherValue);
mSelectLauncherModePreference.setSummary(mLauncherModeValueToTitleMap.get(launcherValue));
// OTG USB EXchange
String otgValue = getNodeValue(OTG_PATH);
mSelectOtgUsbExchangePreference.setValue(otgValue);
mSelectOtgUsbExchangePreference.setSummary(mOtgUsbExchangeValueToTitleMap.get(otgValue));
// Cpu Freq
String cpuFreqValue = getNodeValue(CPU_PATH);
mSelectCpuFreqPreference.setValue(cpuFreqValue);
mSelectCpuFreqPreference.setSummary(mCpuFreqValueToTitleMap.get(cpuFreqValue));
// Font Light
String fontLightValue = getNodeValue(LIGHT_PATH);
mSelectFontLightPreference.setValue(fontLightValue);
mSelectFontLightPreference.setSummary(mFontLightValueToTitleMap.get(fontLightValue));
// Nav CONTROL
int navMode = Settings.System.getInt(this.getContentResolver(), Settings.System.SHOW_NAV_BAR, 1);
Log.i(TAG, "[updateSystemPreferences]----navMode:" + navMode);
mToggleNavControlPreference.setChecked(navMode == 1);
// Status CONTROL
int statusMode = Settings.System.getInt(this.getContentResolver(), Settings.System.SHOW_STATUS_BAR, 1);
Log.i(TAG, "[updateSystemPreferences]----statusMode:" + statusMode);
mToggleStatusControlPreference.setChecked(statusMode == 1);
// HALL CONTROL
updateHardWareControlCheckbox(mToggleHallControlPreference, HALL_PATH);
// Ethernet CONTROL
updateHardWareControlCheckbox(mToggleEthernetControlPreference, ETHERNET_PATH);
// Accele CONTROL
updateHardWareControlCheckbox(mToggleAcceleControlPreference, ACCELEROMETER_PATH);
// Call CONTROL
int callMode = Settings.System.getInt(this.getContentResolver(), "CALL_MODE", 1);
Log.i(TAG, "[updateSystemPreferences]----callMode:" + callMode);
mToggleCallControlPreference.setChecked(callMode == 1);
}
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
// TODO 自动生成的方法存根
if (mToggleNavControlPreference == preference) {
handleNavControlPreferenceClick();
return true;
} else if (mToggleStatusControlPreference == preference) {
handleStatusControlPreferenceClick();
return true;
} else if (mToggleHallControlPreference == preference) {
handleHallControlPreferenceClick();
return true;
} else if (mToggleEthernetControlPreference == preference) {
handleEthernetControlPreferenceClick();
return true;
} else if (mToggleAcceleControlPreference == preference) {
handleAcceleControlPreferenceClick();
return true;
} else if (mToggleCallControlPreference == preference) {
handleCallControlPreferenceClick();
return true;
}
return super.onPreferenceTreeClick(preferenceScreen, preference);
}
private void handleNavControlPreferenceClick() {
Log.i(TAG, "[handleNavControlPreferenceClick]----isChecked:" + mToggleNavControlPreference.isChecked());
Settings.System.putInt(getContentResolver(), Settings.System.SHOW_NAV_BAR,
(mToggleNavControlPreference.isChecked() ? 1:0));
if (mToggleNavControlPreference.isChecked()) {
sendControlMode("WATERWORLD_SHOW_NAVIBAR");
} else {
sendControlMode("WATERWORLD_HIDE_NAVIBAR");
}
}
private void handleStatusControlPreferenceClick() {
Log.i(TAG, "[handleStatusControlPreferenceClick]----isChecked:" + mToggleStatusControlPreference.isChecked());
Settings.System.putInt(getContentResolver(), Settings.System.SHOW_STATUS_BAR,
(mToggleStatusControlPreference.isChecked() ? 1:0));
if (mToggleStatusControlPreference.isChecked()) {
sendControlMode("WATERWORLD_SHOW_STATUSBAR");
} else {
sendControlMode("WATERWORLD_HIDE_STATUSBAR");
}
}
private void handleHallControlPreferenceClick() {
Log.i(TAG, "[handleHallControlPreferenceClick]----isChecked:" + mToggleHallControlPreference.isChecked());
setNodeValue(mToggleHallControlPreference.isChecked()
? "1" : "0", HALL_PATH);
}
private void handleEthernetControlPreferenceClick() {
Log.i(TAG, "[handleEthernetControlPreferenceClick]----isChecked:" + mToggleEthernetControlPreference.isChecked());
setNodeValue(mToggleEthernetControlPreference.isChecked()
? "1" : "0", ETHERNET_PATH);
}
private void handleAcceleControlPreferenceClick() {
Log.i(TAG, "[handleAcceleControlPreferenceClick]----isChecked:" + mToggleAcceleControlPreference.isChecked());
setNodeValue(mToggleAcceleControlPreference.isChecked()
? "1" : "0", ACCELEROMETER_PATH);
}
private void handleCallControlPreferenceClick() {
Log.i(TAG, "[handleCallControlPreferenceClick]----isChecked:" + mToggleCallControlPreference.isChecked());
Settings.System.putInt(getContentResolver(), "CALL_MODE",
(mToggleCallControlPreference.isChecked() ? 1:0));
}
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (mSelectLauncherModePreference == preference) {
handleLauncherModePreferenceChange((String) newValue);
return true;
} else if (mSelectOtgUsbExchangePreference == preference) {
handleOtgUsbExchangePreferenceChange((String) newValue);
return true;
} else if (mSelectCpuFreqPreference == preference) {
handleCpuFreqPreferenceChange((String) newValue);
return true;
} else if (mSelectFontLightPreference == preference) {
handleFontLightPreferenceChange((String) newValue);
return true;
}
return false;
}
private void handleLauncherModePreferenceChange(String stringValue) {
//setNodeValue(stringValue, OTG_PATH);
Settings.System.putString(getContentResolver(), "LAUNCHER_MODE", stringValue);
mSelectLauncherModePreference.setSummary(mLauncherModeValueToTitleMap.get(stringValue));
}
private void handleOtgUsbExchangePreferenceChange(String stringValue) {
setNodeValue(stringValue, OTG_PATH);
mSelectOtgUsbExchangePreference.setSummary(mOtgUsbExchangeValueToTitleMap.get(stringValue));
}
private void handleCpuFreqPreferenceChange(String stringValue) {
setNodeValue(stringValue, CPU_PATH);
mSelectCpuFreqPreference.setSummary(mCpuFreqValueToTitleMap.get(stringValue));
}
private void handleFontLightPreferenceChange(String stringValue) {
setNodeValue(stringValue, LIGHT_PATH);
mSelectFontLightPreference.setSummary(mFontLightValueToTitleMap.get(stringValue));
}
private void setNodeValue(String str, String path) {
Log.i(TAG, "[setNodeValue]----str:" + str + " path:" + path);
try {
BufferedWriter bufWriter = null;
bufWriter = new BufferedWriter(new FileWriter(path));
bufWriter.write(str);
bufWriter.close();
if (path.equals(OTG_PATH)) {
Settings.System.putString(this.getContentResolver(), "USB_OTG_MODE", str);
}
} catch (IOException e) {
e.printStackTrace();
// Log.e(TAG, "can't write the " + path);
}
}
private String getNodeValue(String path) {
String prop = "0";
try {
BufferedReader reader = new BufferedReader(new FileReader(path));
prop = reader.readLine();
} catch (IOException e) {
e.printStackTrace();
}
if (prop.contains("freq")) {
prop = prop.substring(25);
}
Log.d(TAG, "[getNodeValue]---prop:" + prop + " path:" + path);
return prop;
}
private void updateHardWareControlCheckbox(SwitchPreference preference, String path) {
String vale = getNodeValue(path);
preference.setChecked(vale.equals("1") ? true : false);
}
public void sendControlMode(String str) {
Log.i(TAG, "[sendControlMode]----str:" + str);
Intent intent = new Intent(str);
sendBroadcast(intent);
}
}
2、SdCardUpgradeProcess.java 实现系统本地升级
package com.waterworld.tools;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.os.PowerManager;
import android.os.RecoverySystem;
import android.util.Log;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.waterworld.tools.R;
public class SdCardUpgradeProcess extends Activity implements RecoverySystem.ProgressListener {
private static final String TAG = "SdCardUpgrade";
private static String updatePath = "/sdcard/update/update.zip";
private static String updateDesPath = "/data/ota_package/update.zip";
private ProgressBar mProcessbar;
private TextView mUpdateStep;
private TextView copyFile;
private TextView verifyFile;
private TextView mNotify;
private boolean isVerifyComplete = false;
private boolean isCopyComplete = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.i(TAG, "--onCreat--");
setContentView(R.layout.sdcardupgrade_processbar);
mUpdateStep = (TextView) findViewById(R.id.step_number);
copyFile = (TextView) findViewById(R.id.copy_file_title);
verifyFile = (TextView) findViewById(R.id.verify_file_title);
mNotify = (TextView) findViewById(R.id.update_notify);
mProcessbar = (ProgressBar) findViewById(R.id.processbar);
mProcessbar.setMax(110);
mProcessbar.setProgress(0);
mProcessbar.setIndeterminate(false);
runnable.start();
}
Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
int num = msg.arg1;
mProcessbar.setProgress(num);
mUpdateStep.setText(num + "%");
if (!isCopyComplete) {
copyFile.setText(getString(R.string.copy_file));
} else if (isCopyComplete && !isVerifyComplete) {
copyFile.setText(getString(R.string.copy_file_completed));
verifyFile.setText(getString(R.string.verify_process));
} else {
verifyFile.setText(getString(R.string.verify_process_completed));
mNotify.setText(getString(R.string.update_system_begin));
}
}
};
Thread runnable = new Thread() {
@Override
public void run() {
Log.d(TAG, "Start update .............");
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK,
"SdCardUpgrade ProcessBar");
try {
wl.acquire();// 升级保持亮屏状态
copyFile(updatePath, updateDesPath);
File newFile = new File(updateDesPath);
RecoverySystem.verifyPackage(newFile, SdCardUpgradeProcess.this, null);
Log.d(TAG, "Verify package complete.");
RecoverySystem.installPackage(SdCardUpgradeProcess.this, newFile);
} catch (Exception e) {
Log.e(TAG, e.getMessage(), e);
} finally {
wl.release();
}
}
};
public boolean copyFile(String oldPath, String newPath) {
Log.d(TAG, "Start copyFile oldPath:" + oldPath + " newPath:" +newPath);
try {
File oldFile = new File(oldPath);
if (!oldFile.exists() || !oldFile.isFile() || !oldFile.canRead()) {
Log.e(TAG, "copyFile: oldFile not exist, not file or cannot read.");
copyFile.setText(getString(R.string.install_file_fail));
return false;
}
FileInputStream fileInputStream = new FileInputStream(oldPath);
FileOutputStream fileOutputStream = new FileOutputStream(newPath);
byte[] buffer = new byte[1024];
long size = new File(oldPath).length();
int byteRead;
long transferSize = 0;
int progress = 0;
while (-1 != (byteRead = fileInputStream.read(buffer))) {
fileOutputStream.write(buffer, 0, byteRead);
transferSize += byteRead;
progress = (int) (transferSize * 100 / size);
Log.d(TAG, "copyFile --- progress=" + progress);
Message msg = Message.obtain();
msg.arg1 = progress;
mHandler.sendMessage(msg);
}
fileInputStream.close();
fileOutputStream.flush();
fileOutputStream.close();
isCopyComplete = true;
Log.d(TAG, "copyFile package complete.");
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
@Override
public void onProgress(int progress) {
Log.d(TAG, "progress=" + progress);
Message msg = Message.obtain();
msg.arg1 = progress;
if (progress == 100) {
isVerifyComplete = true;
}
mHandler.sendMessage(msg);
}
@Override
protected void onResume() {
// TODO 自动生成的方法存根
super.onResume();
}
@Override
protected void onDestroy() {
// TODO 自动生成的方法存根
super.onDestroy();
}
}
3、tools_settings.xml
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:persistent="true"
android:title="@string/app_name" >
<ListPreference
android:entries="@array/select_launcher_mode_preference_titles"
android:entryValues="@array/select_launcher_mode_preference_values"
android:key="select_launcher_mode_preference"
android:persistent="false"
android:title="@string/laucher_mode" />
<ListPreference
android:entries="@array/select_otg_usb_exchange_preference_titles"
android:entryValues="@array/select_otg_usb_exchange_preference_values"
android:key="select_otg_usb_exchange_preference"
android:persistent="false"
android:title="@string/otg_usb_exchange" />
<ListPreference
android:entries="@array/select_cpu_freq_preference_titles"
android:entryValues="@array/select_cpu_freq_preference_values"
android:key="select_cpu_freq_preference"
android:persistent="false"
android:title="@string/cpu_freq" />
<ListPreference
android:entries="@array/select_flash_light_preference_titles"
android:entryValues="@array/select_flash_light_preference_values"
android:key="select_flash_light_preference"
android:persistent="false"
android:title="@string/flash_light" />
<SwitchPreference
android:key="toggle_nav_control_preference"
android:persistent="false"
android:title="@string/nav_control" />
<SwitchPreference
android:key="toggle_status_control_preference"
android:persistent="false"
android:title="@string/status_control" />
<SwitchPreference
android:key="toggle_hall_control_preference"
android:persistent="false"
android:title="@string/hall_control" />
<SwitchPreference
android:key="toggle_ethernet_control_preference"
android:persistent="false"
android:title="@string/ethernet_title" />
<SwitchPreference
android:key="toggle_accele_control_preference"
android:persistent="false"
android:title="@string/accele_title" />
<SwitchPreference
android:key="toggle_call_control_preference"
android:persistent="false"
android:title="@string/call_title" />
<Preference
android:key="update_preference_screen"
android:summary="@string/accessibility_update_preference_summary"
android:title="@string/accessibility_update_preference_title" >
<intent
android:action="waterworld.intent.action.UPDATE_SYSTEM"
android:targetClass="com.waterworld.tools.SdCardUpgradeProcess"
android:targetPackage="com.waterworld.tools" />
</Preference>
</PreferenceScreen>
4、sdcardupgrade_processbar.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="400dp"
android:layout_height="260dp"
android:layout_gravity="center"
android:background="#666666"
android:orientation="vertical" >
<TextView
android:id="@+id/update_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="20dp"
android:focusable="true"
android:text="@string/install_title"
android:textColor="#FFFFFF"
android:textSize="25dp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ProgressBar
android:id="@+id/processbar"
style="@android:style/Widget.Holo.ProgressBar.Horizontal"
android:layout_width="260dp"
android:layout_height="wrap_content"
android:layout_marginTop="5dp" />
</LinearLayout>
<TextView
android:id="@+id/step_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:textColor="#FFFFFF"
android:textSize="20dp" />
</LinearLayout>
<TextView
android:id="@+id/copy_file_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:focusable="true"
android:textColor="#FFFFFF"
android:textSize="20dp" />
<TextView
android:id="@+id/verify_file_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:textColor="#FFFFFF"
android:textSize="20dp" />
<TextView
android:id="@+id/update_notify"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:textColor="#FFFFFF"
android:textSize="20dp" />
<ImageView
android:id="@+id/update_complete"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp" />
</LinearLayout>
5、arrays.xml
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- Display settings. The delay in inactivity before the screen is turned off. These are shown in a list dialog. -->
<string-array name="screen_timeout_entries">
<item>15 seconds</item>
<item>30 seconds</item>
<item>1 minute</item>
<item>2 minutes</item>
<item>5 minutes</item>
<item>10 minutes</item>
<item>30 minutes</item>
</string-array>
<!-- Do not translate. -->
<string-array name="screen_timeout_values" translatable="false">
<!-- Do not translate. -->
<item>15000</item>
<!-- Do not translate. -->
<item>30000</item>
<!-- Do not translate. -->
<item>60000</item>
<!-- Do not translate. -->
<item>120000</item>
<!-- Do not translate. -->
<item>300000</item>
<!-- Do not translate. -->
<item>600000</item>
<!-- Do not translate. -->
<item>1800000</item>
</string-array>
<!-- Display settings. The delay in inactivity before the dream is shown. These are shown in a list dialog. -->
<string-array name="dream_timeout_entries">
<item>Never</item>
<item>15 seconds</item>
<item>30 seconds</item>
<item>1 minute</item>
<item>2 minutes</item>
<item>5 minutes</item>
<item>10 minutes</item>
<item>30 minutes</item>
</string-array>
<!-- Do not translate. -->
<string-array name="dream_timeout_values" translatable="false">
<!-- Do not translate. -->
<item>0</item>
<!-- Do not translate. -->
<item>15000</item>
<!-- Do not translate. -->
<item>30000</item>
<!-- Do not translate. -->
<item>60000</item>
<!-- Do not translate. -->
<item>120000</item>
<!-- Do not translate. -->
<item>300000</item>
<!-- Do not translate. -->
<item>600000</item>
<!-- Do not translate. -->
<item>1800000</item>
</string-array>
<string-array name="select_flash_light_preference_titles">
<item>OFF</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
</string-array>
<string-array name="select_flash_light_preference_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
</string-array>
<!-- Security settings. The delay after screen is turned off until device locks.
These are shown in a list dialog. -->
<string-array name="lock_after_timeout_entries">
<item>Immediately</item>
<item>5 seconds</item>
<item>15 seconds</item>
<item>30 seconds</item>
<item>1 minute</item>
<item>2 minutes</item>
<item>5 minutes</item>
<item>10 minutes</item>
<item>30 minutes</item>
</string-array>
<!-- Do not translate. -->
<string-array name="lock_after_timeout_values" translatable="false">
<!-- Do not translate. -->
<item>0</item>
<!-- Do not translate. -->
<item>5000</item>
<!-- Do not translate. -->
<item>15000</item>
<!-- Do not translate. -->
<item>30000</item>
<!-- Do not translate. -->
<item>60000</item>
<!-- Do not translate. -->
<item>120000</item>
<!-- Do not translate. -->
<item>300000</item>
<!-- Do not translate. -->
<item>600000</item>
<!-- Do not translate. -->
<item>1800000</item>
</string-array>
<string-array name="select_otg_usb_exchange_preference_titles">
<item>Bottom USB</item>
<item>Bottom OTG</item>
<item>BACK OTG</item>
</string-array>
<string-array name="select_otg_usb_exchange_preference_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string-array name="select_launcher_mode_preference_values" translatable="false">
<item>0</item>
<item>1</item>
</string-array>
<string-array name="select_launcher_mode_preference_titles">
<item>原生Launcher</item>
<item>中控启动器</item>
</string-array>
<string-array name="select_cpu_freq_preference_titles">
<item>Dynamic Frequency</item>
<item>1495000</item>
<item>1378000</item>
<item>1274000</item>
<item>1170000</item>
<item>1105000</item>
<item>1053000</item>
<item>1001000</item>
<item>962000</item>
<item>910000</item>
<item>845000</item>
<item>702000</item>
<item>624000</item>
<item>546000</item>
<item>416000</item>
<item>338000</item>
<item>299000</item>
</string-array>
<string-array name="select_cpu_freq_preference_values" translatable="false">
<item>-1</item>
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>10</item>
<item>11</item>
<item>12</item>
<item>13</item>
<item>14</item>
<item>15</item>
</string-array>
</resources>
6、strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Other Settings</string>
<string name="laucher_mode">Laucher Mode</string>
<string name="otg_usb_exchange">OTG Mode</string>
<string name="cpu_freq">CPU Freq Control</string>
<string name="flash_light">Front Light</string>
<string name="hall_control">Hall Control</string>
<string name="ethernet_title">Ethernet</string>
<string name="accele_title">Accelerometer</string>
<string name="call_title">Block Call and SMS</string>
<string name="accessibility_update_preference_title">System Upgrade</string>
<string name="accessibility_update_preference_summary">Copy upgrade file to the corresponding directory</string>
<string name="install_title">Do not operate during system upgrade</string>
<string name="install_file_fail">Upgrade file not found,Press back key to exit!</string>
<string name="copy_file">Upgrade file is being copied...</string>
<string name="copy_file_completed">Upgrade file copy completed</string>
<string name="verify_process">File verification...</string>
<string name="verify_process_completed">File verification completed</string>
<string name="update_system_begin">The system is about to restart!</string>
<string name="nav_control">Nav Bar</string>
<string name="status_control">Status Bar</string>
</resources>