Android->Setting:Add the save log option at Developer options
This commit is contained in:
@ -642,3 +642,16 @@ service drawpath /system/bin/drawpath
|
||||
class main
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
service catlog /system/bin/busybox sh /system/bin/cat_log.sh
|
||||
disabled
|
||||
oneshot
|
||||
|
||||
# on property:sys.boot_completed=1
|
||||
# start catlog
|
||||
|
||||
on property:app.logsave.start=1
|
||||
start catlog
|
||||
|
||||
on property:app.logsave.start=0
|
||||
stop catlog
|
||||
|
||||
@ -2254,6 +2254,16 @@
|
||||
<category android:name="android.intent.category.VOICE_LAUNCH" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<receiver
|
||||
android:name=".BootReceiver"
|
||||
>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
|
||||
</receiver>
|
||||
<!--$_rbox_$_modify_$_end-->
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
@ -1441,6 +1441,7 @@
|
||||
<string name="bugreport_in_power" msgid="7923901846375587241">"错误报告快捷方式"</string>
|
||||
<string name="bugreport_in_power_summary" msgid="1778455732762984579">"在电源菜单中显示用于提交错误报告的按钮"</string>
|
||||
<string name="keep_screen_on" msgid="1146389631208760344">"不锁定屏幕"</string>
|
||||
<string name="enable_log_save">启用日志保存</string>
|
||||
<string name="keep_screen_on_summary" msgid="2173114350754293009">"充电时屏幕不会休眠"</string>
|
||||
<string name="bt_hci_snoop_log" msgid="3340699311158865670">"启用蓝牙 HCI 信息收集日志"</string>
|
||||
<string name="bt_hci_snoop_log_summary" msgid="730247028210113851">"捕获单个文件中的所有蓝牙 HCI 包"</string>
|
||||
|
||||
@ -3408,6 +3408,7 @@
|
||||
<string name="bugreport_in_power_summary">Show a button in the power menu for taking a bug report</string>
|
||||
<!-- Setting Checkbox title whether to keep the screen on when plugged in to a power source -->
|
||||
<string name="keep_screen_on">Stay awake</string>
|
||||
<string name="enable_log_save">Enable logging to save</string>
|
||||
<!-- setting Checkbox summary whether to keep the screen on when plugged in -->
|
||||
<string name="keep_screen_on_summary">Screen will never sleep while charging</string>
|
||||
<!-- Setting Checkbox title whether to enable bluetooth HCI snoop log -->
|
||||
|
||||
@ -31,6 +31,10 @@
|
||||
android:targetPackage="com.android.settings"
|
||||
android:targetClass="com.android.settings.SetFullBackupPassword" />
|
||||
</PreferenceScreen>
|
||||
<SwitchPreference
|
||||
android:key="enable_log_save"
|
||||
android:title="@string/enable_log_save"
|
||||
/>
|
||||
|
||||
<SwitchPreference
|
||||
android:key="keep_screen_on"
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
package com.android.settings;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
import android.os.SystemProperties;
|
||||
|
||||
public class BootReceiver extends BroadcastReceiver{
|
||||
|
||||
@Override
|
||||
public void onReceive(Context arg0, Intent arg1) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
String action = arg1.getAction();
|
||||
if(action.equals(Intent.ACTION_BOOT_COMPLETED))
|
||||
{
|
||||
SharedPreferences shared = arg0.getSharedPreferences("com.android.settings_preferences", Context.MODE_PRIVATE);
|
||||
boolean enable_log_save = shared.getBoolean("enable_log_save", false);
|
||||
if(enable_log_save)
|
||||
SystemProperties.set("app.logsave.start","1");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -94,6 +94,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
||||
private static final String CLEAR_ADB_KEYS = "clear_adb_keys";
|
||||
private static final String ENABLE_TERMINAL = "enable_terminal";
|
||||
private static final String KEEP_SCREEN_ON = "keep_screen_on";
|
||||
private static final String ENABLE_LOG_SAVE = "enable_log_save";
|
||||
private static final String BT_HCI_SNOOP_LOG = "bt_hci_snoop_log";
|
||||
private static final String ENABLE_OEM_UNLOCK = "oem_unlock_enable";
|
||||
private static final String ALLOW_MOCK_LOCATION = "allow_mock_location";
|
||||
@ -163,6 +164,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
||||
|
||||
private static final int RESULT_DEBUG_APP = 1000;
|
||||
|
||||
private static final String ENABLE_LOG_FILE="/mnt/sdcard/.enable_logsave";
|
||||
|
||||
private static final String PERSISTENT_DATA_BLOCK_PROP = "ro.frp.pst";
|
||||
|
||||
private static final int REQUEST_CODE_ENABLE_OEM_UNLOCK = 0;
|
||||
@ -187,6 +190,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
||||
private Preference mBugreport;
|
||||
private SwitchPreference mBugreportInPower;
|
||||
private SwitchPreference mKeepScreenOn;
|
||||
private SwitchPreference mEnableLogSave;
|
||||
private SwitchPreference mBtHciSnoopLog;
|
||||
private SwitchPreference mEnableOemUnlock;
|
||||
private SwitchPreference mAllowMockLocation;
|
||||
@ -303,6 +307,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
||||
mBugreport = findPreference(BUGREPORT);
|
||||
mBugreportInPower = findAndInitSwitchPref(BUGREPORT_IN_POWER_KEY);
|
||||
mKeepScreenOn = findAndInitSwitchPref(KEEP_SCREEN_ON);
|
||||
mEnableLogSave = findAndInitSwitchPref(ENABLE_LOG_SAVE);
|
||||
mBtHciSnoopLog = findAndInitSwitchPref(BT_HCI_SNOOP_LOG);
|
||||
mEnableOemUnlock = findAndInitSwitchPref(ENABLE_OEM_UNLOCK);
|
||||
if (!showEnableOemUnlockPreference()) {
|
||||
@ -1420,6 +1425,13 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
|
||||
Settings.Global.STAY_ON_WHILE_PLUGGED_IN,
|
||||
mKeepScreenOn.isChecked() ?
|
||||
(BatteryManager.BATTERY_PLUGGED_AC | BatteryManager.BATTERY_PLUGGED_USB) : 0);
|
||||
} else if (preference == mEnableLogSave) {
|
||||
if(mEnableLogSave.isChecked())
|
||||
{
|
||||
SystemProperties.set("app.logsave.start","1");
|
||||
}else{
|
||||
SystemProperties.set("app.logsave.start","0");
|
||||
}
|
||||
} else if (preference == mBtHciSnoopLog) {
|
||||
writeBtHciSnoopLogOptions();
|
||||
} else if (preference == mEnableOemUnlock) {
|
||||
|
||||
Reference in New Issue
Block a user