Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_47647075
emmagee
提交
6f1f27df
E
emmagee
项目概览
weixin_47647075
/
emmagee
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
emmagee
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
6f1f27df
编写于
8月 13, 2013
作者:
A
andrewleo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
commit
上级
2771437c
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
48 addition
and
2 deletion
+48
-2
src/com/netease/qa/emmagee/service/EmmageeService.java
src/com/netease/qa/emmagee/service/EmmageeService.java
+43
-2
src/com/netease/qa/emmagee/utils/CurrentInfo.java
src/com/netease/qa/emmagee/utils/CurrentInfo.java
+5
-0
未找到文件。
src/com/netease/qa/emmagee/service/EmmageeService.java
浏览文件 @
6f1f27df
...
...
@@ -19,6 +19,7 @@ package com.netease.qa.emmagee.service;
import
java.io.BufferedWriter
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.OutputStreamWriter
;
...
...
@@ -31,10 +32,13 @@ import java.util.Properties;
import
android.app.Activity
;
import
android.app.PendingIntent
;
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.net.wifi.WifiManager
;
import
android.os.BatteryManager
;
import
android.os.Build
;
import
android.os.Handler
;
import
android.os.IBinder
;
...
...
@@ -52,13 +56,14 @@ import android.widget.ImageView;
import
android.widget.TextView
;
import
android.widget.Toast
;
import
com.netease.qa.emmagee.R
;
import
com.netease.qa.emmagee.activity.MainPageActivity
;
import
com.netease.qa.emmagee.utils.CpuInfo
;
import
com.netease.qa.emmagee.utils.CurrentInfo
;
import
com.netease.qa.emmagee.utils.EncryptData
;
import
com.netease.qa.emmagee.utils.MailSender
;
import
com.netease.qa.emmagee.utils.MemoryInfo
;
import
com.netease.qa.emmagee.utils.MyApplication
;
import
com.netease.qa.emmagee.R
;
/**
* Service running in background
...
...
@@ -104,6 +109,12 @@ public class EmmageeService extends Service {
public
static
String
resultFilePath
;
public
static
boolean
isStop
=
false
;
private
String
totalBatt
;
private
String
currentBatt
;
private
String
temperature
;
private
String
voltage
;
private
CurrentInfo
currentInfo
;
@Override
public
void
onCreate
()
{
Log
.
i
(
LOG_TAG
,
"onCreate"
);
...
...
@@ -115,6 +126,37 @@ public class EmmageeService extends Service {
fomart
.
setMaximumFractionDigits
(
2
);
fomart
.
setMinimumFractionDigits
(
0
);
des
=
new
EncryptData
(
"emmagee"
);
currentInfo
=
new
CurrentInfo
();
registerReceiver
(
new
BatteryInfoBroadcastReceiver
(),
new
IntentFilter
(
"android.intent.action.BATTERY_CHANGED"
));
}
/**
* 电池信息监控监听器
*
* @author hz_liuxiao@corp.netease.com
*
*/
public
class
BatteryInfoBroadcastReceiver
extends
BroadcastReceiver
{
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
if
(
Intent
.
ACTION_BATTERY_CHANGED
.
equals
(
intent
.
getAction
()))
{
int
level
=
intent
.
getIntExtra
(
BatteryManager
.
EXTRA_LEVEL
,
0
);
int
scale
=
intent
.
getIntExtra
(
BatteryManager
.
EXTRA_SCALE
,
-
1
);
currentBatt
=
String
.
valueOf
(
level
*
100
/
scale
)
+
"%"
;
voltage
=
String
.
valueOf
(
intent
.
getIntExtra
(
BatteryManager
.
EXTRA_VOLTAGE
,
-
1
)
*
1.0
/
1000
);
temperature
=
String
.
valueOf
(
intent
.
getIntExtra
(
BatteryManager
.
EXTRA_TEMPERATURE
,
-
1
)
*
1.0
/
10
);
}
}
}
@Override
...
...
@@ -449,7 +491,6 @@ public class EmmageeService extends Service {
"测试结果未成功发送至邮箱,结果保存在:"
+
EmmageeService
.
resultFilePath
,
Toast
.
LENGTH_LONG
).
show
();
}
super
.
onDestroy
();
stopForeground
(
true
);
}
...
...
src/com/netease/qa/emmagee/utils/CurrentInfo.java
0 → 100644
浏览文件 @
6f1f27df
package
com.netease.qa.emmagee.utils
;
public
class
CurrentInfo
{
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录