Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_47647075
emmagee
提交
2533df93
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 搜索 >>
提交
2533df93
编写于
2月 28, 2013
作者:
A
andrewleo2013
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine code according to checkstyle
上级
87558e2f
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
62 addition
and
26 deletion
+62
-26
src/com/netease/qa/emmagee/activity/MainPageActivity.java
src/com/netease/qa/emmagee/activity/MainPageActivity.java
+6
-4
src/com/netease/qa/emmagee/activity/SettingsActivity.java
src/com/netease/qa/emmagee/activity/SettingsActivity.java
+8
-4
src/com/netease/qa/emmagee/service/EmmageeService.java
src/com/netease/qa/emmagee/service/EmmageeService.java
+8
-4
src/com/netease/qa/emmagee/utils/CpuInfo.java
src/com/netease/qa/emmagee/utils/CpuInfo.java
+13
-8
src/com/netease/qa/emmagee/utils/MemoryInfo.java
src/com/netease/qa/emmagee/utils/MemoryInfo.java
+6
-2
src/com/netease/qa/emmagee/utils/MyApplication.java
src/com/netease/qa/emmagee/utils/MyApplication.java
+5
-1
src/com/netease/qa/emmagee/utils/ProcessInfo.java
src/com/netease/qa/emmagee/utils/ProcessInfo.java
+6
-2
src/com/netease/qa/emmagee/utils/Programe.java
src/com/netease/qa/emmagee/utils/Programe.java
+5
-0
src/com/netease/qa/emmagee/utils/TrafficInfo.java
src/com/netease/qa/emmagee/utils/TrafficInfo.java
+5
-1
未找到文件。
src/com/netease/qa/emmagee/activity/MainPageActivity.java
浏览文件 @
2533df93
...
...
@@ -54,16 +54,15 @@ import com.netease.qa.emmagee.utils.Programe;
import
com.netease.qa.emmagee.R
;
/**
* Main Page of Emmagee.
* @author andrewleo
* Main Page of Emmagee
*
*/
public
class
MainPageActivity
extends
Activity
{
private
final
String
LOG_TAG
=
"Emmagee-"
private
static
final
String
LOG_TAG
=
"Emmagee-"
+
MainPageActivity
.
class
.
getSimpleName
();
private
final
int
TIMEOUT
=
20000
;
private
static
final
int
TIMEOUT
=
20000
;
private
List
<
Programe
>
processList
;
private
ProcessInfo
processInfo
;
...
...
@@ -265,6 +264,9 @@ public class MainPageActivity extends Activity {
List
<
Programe
>
programe
;
int
tempPosition
=
-
1
;
/**
* save status of all installed processes
*/
class
Viewholder
{
TextView
txtAppName
;
ImageView
imgViAppIcon
;
...
...
src/com/netease/qa/emmagee/activity/SettingsActivity.java
浏览文件 @
2533df93
...
...
@@ -36,9 +36,13 @@ import android.widget.Toast;
import
com.netease.qa.emmagee.R
;
/**
* Setting Page of Emmagee
*
*/
public
class
SettingsActivity
extends
Activity
{
private
final
String
LOG_TAG
=
"Emmagee-"
private
static
final
String
LOG_TAG
=
"Emmagee-"
+
SettingsActivity
.
class
.
getSimpleName
();
private
CheckBox
chkFloat
;
...
...
@@ -64,13 +68,13 @@ public class SettingsActivity extends Activity {
try
{
raf
=
new
RandomAccessFile
(
settingTempFile
,
"r"
);
String
f
=
raf
.
readLine
();
if
(
f
==
null
||
(
f
!=
null
&&
f
.
equals
(
""
)))
{
if
(
f
==
null
||
(
""
.
equals
(
f
)))
{
time
=
"5"
;
}
else
{
time
=
f
;
}
String
tag
=
raf
.
readLine
();
if
(
tag
!=
null
&&
tag
.
equals
(
"false"
))
{
if
(
"false"
.
equals
(
tag
))
{
floatingTag
=
false
;
}
raf
.
close
();
...
...
@@ -92,7 +96,7 @@ public class SettingsActivity extends Activity {
Toast
.
makeText
(
SettingsActivity
.
this
,
"输入数据无效,请重新输入"
,
Toast
.
LENGTH_LONG
).
show
();
edtTime
.
setText
(
""
);
}
else
if
(
time
.
equals
(
""
)
||
Long
.
parseLong
(
time
)
==
0
)
{
}
else
if
(
""
.
equals
(
time
)
||
Long
.
parseLong
(
time
)
==
0
)
{
Toast
.
makeText
(
SettingsActivity
.
this
,
"输入数据为空,请重新输入"
,
Toast
.
LENGTH_LONG
).
show
();
edtTime
.
setText
(
""
);
...
...
src/com/netease/qa/emmagee/service/EmmageeService.java
浏览文件 @
2533df93
...
...
@@ -53,6 +53,10 @@ import com.netease.qa.emmagee.utils.MemoryInfo;
import
com.netease.qa.emmagee.utils.MyApplication
;
import
com.netease.qa.emmagee.R
;
/**
* Service running in background
*
*/
public
class
EmmageeService
extends
Service
{
private
final
static
String
LOG_TAG
=
"Emmagee-"
...
...
@@ -151,7 +155,7 @@ public class EmmageeService extends Service {
RandomAccessFile
raf
=
new
RandomAccessFile
(
new
File
(
settingTempFile
),
"r"
);
time
=
raf
.
readLine
();
isFloating
=
raf
.
readLine
().
equals
(
"true"
)
?
true
:
false
;
isFloating
=
(
"true"
.
equals
(
raf
.
readLine
())
)
?
true
:
false
;
raf
.
close
();
}
catch
(
IOException
e
)
{
time
=
"5"
;
...
...
@@ -322,8 +326,8 @@ public class EmmageeService extends Service {
processCpuRatio
=
processInfo
.
get
(
0
);
totalCpuRatio
=
processInfo
.
get
(
1
);
trafficSize
=
processInfo
.
get
(
2
);
if
(
trafficSize
!=
null
&&
!
trafficSize
.
equals
(
""
)
&&
!
trafficSize
.
equals
(
"-1"
))
{
if
(
""
.
equals
(
trafficSize
)
&&
!
(
"-1"
.
equals
(
trafficSize
)
))
{
tempTraffic
=
Integer
.
parseInt
(
trafficSize
);
if
(
tempTraffic
>
1024
)
{
isMb
=
true
;
...
...
@@ -336,7 +340,7 @@ public class EmmageeService extends Service {
+
freeMemoryKb
+
"MB"
);
txtTotalMem
.
setText
(
"占用CPU:"
+
processCpuRatio
+
"%"
+
",总体CPU:"
+
totalCpuRatio
+
"%"
);
if
(
trafficSize
.
equals
(
"-1"
))
{
if
(
"-1"
.
equals
(
trafficSize
))
{
txtTraffic
.
setText
(
"本程序或本设备不支持流量统计"
);
}
else
if
(
isMb
)
txtTraffic
.
setText
(
"消耗流量:"
+
fomart
.
format
(
trafficMb
)
...
...
src/com/netease/qa/emmagee/utils/CpuInfo.java
浏览文件 @
2533df93
...
...
@@ -29,6 +29,10 @@ import com.netease.qa.emmagee.service.EmmageeService;
import
android.content.Context
;
import
android.util.Log
;
/**
* operate CPU information
*
*/
public
class
CpuInfo
{
private
static
final
String
LOG_TAG
=
"Emmagee-"
...
...
@@ -46,7 +50,7 @@ public class CpuInfo {
private
long
lastestTraffic
;
private
long
traffic
;
private
TrafficInfo
trafficInfo
;
private
ArrayList
<
String
>
C
puUsedRatio
;
private
ArrayList
<
String
>
c
puUsedRatio
;
private
long
totalCpu2
;
private
long
processCpu2
;
private
long
idleCpu2
;
...
...
@@ -61,7 +65,7 @@ public class CpuInfo {
formatterFile
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
mi
=
new
MemoryInfo
();
totalMemorySize
=
mi
.
getTotalMemory
();
C
puUsedRatio
=
new
ArrayList
<
String
>();
c
puUsedRatio
=
new
ArrayList
<
String
>();
}
/**
...
...
@@ -141,7 +145,7 @@ public class CpuInfo {
fomart
.
setMinimumFractionDigits
(
2
);
readCpuStat
();
C
puUsedRatio
.
clear
();
c
puUsedRatio
.
clear
();
try
{
Calendar
cal
=
Calendar
.
getInstance
();
...
...
@@ -160,7 +164,8 @@ public class CpuInfo {
processCpuRatio
=
fomart
.
format
(
100
*
((
double
)
(
processCpu
-
processCpu2
)
/
(
double
)
(
totalCpu
-
totalCpu2
)));
totalCpuRatio
=
fomart
.
format
(
100
*
((
double
)
((
totalCpu
-
idleCpu
)
-
(
totalCpu2
-
idleCpu2
))
/
(
double
)
(
totalCpu
-
totalCpu2
)));
.
format
(
100
*
((
double
)
((
totalCpu
-
idleCpu
)
-
(
totalCpu2
-
idleCpu2
))
/
(
double
)
(
totalCpu
-
totalCpu2
)));
long
pidMemory
=
mi
.
getPidMemorySize
(
pid
,
context
);
String
pMemory
=
fomart
.
format
((
double
)
pidMemory
/
1024
);
long
freeMemory
=
mi
.
getFreeMemorySize
(
context
);
...
...
@@ -186,14 +191,14 @@ public class CpuInfo {
totalCpu2
=
totalCpu
;
processCpu2
=
processCpu
;
idleCpu2
=
idleCpu
;
C
puUsedRatio
.
add
(
processCpuRatio
);
C
puUsedRatio
.
add
(
totalCpuRatio
);
C
puUsedRatio
.
add
(
String
.
valueOf
(
traffic
));
c
puUsedRatio
.
add
(
processCpuRatio
);
c
puUsedRatio
.
add
(
totalCpuRatio
);
c
puUsedRatio
.
add
(
String
.
valueOf
(
traffic
));
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
// PttService.closeOpenedStream()
}
return
C
puUsedRatio
;
return
c
puUsedRatio
;
}
...
...
src/com/netease/qa/emmagee/utils/MemoryInfo.java
浏览文件 @
2533df93
...
...
@@ -25,6 +25,10 @@ import android.content.Context;
import
android.os.Debug
;
import
android.util.Log
;
/**
* operate memory information
*
*/
public
class
MemoryInfo
{
private
static
final
String
LOG_TAG
=
"Emmagee-"
...
...
@@ -100,7 +104,7 @@ public class MemoryInfo {
/**
* get the sdk version of phone.
*
*
* @return sdk version
*/
public
String
getSDKVersion
()
{
...
...
@@ -109,7 +113,7 @@ public class MemoryInfo {
/**
* get phone type.
*
*
* @return phone type
*/
public
String
getPhoneType
()
{
...
...
src/com/netease/qa/emmagee/utils/MyApplication.java
浏览文件 @
2533df93
...
...
@@ -19,8 +19,12 @@ package com.netease.qa.emmagee.utils;
import
android.app.Application
;
import
android.view.WindowManager
;
/**
* my application class
*
*/
public
class
MyApplication
extends
Application
{
private
WindowManager
.
LayoutParams
wmParams
=
new
WindowManager
.
LayoutParams
();
public
WindowManager
.
LayoutParams
getMywmParams
()
{
...
...
src/com/netease/qa/emmagee/utils/ProcessInfo.java
浏览文件 @
2533df93
...
...
@@ -28,12 +28,16 @@ import android.content.pm.ApplicationInfo;
import
android.content.pm.PackageManager
;
import
android.util.Log
;
/**
* get information of processes
*
*/
public
class
ProcessInfo
{
private
final
String
LOG_TAG
=
"Emmagee-"
private
static
final
String
LOG_TAG
=
"Emmagee-"
+
ProcessInfo
.
class
.
getSimpleName
();
private
final
String
PACKAGE_NAME
=
"com.netease.qa.emmagee"
;
private
static
final
String
PACKAGE_NAME
=
"com.netease.qa.emmagee"
;
/**
* get information of all running processes,including package name ,process
...
...
src/com/netease/qa/emmagee/utils/Programe.java
浏览文件 @
2533df93
...
...
@@ -18,6 +18,11 @@ package com.netease.qa.emmagee.utils;
import
android.graphics.drawable.Drawable
;
/**
* details of installed processes ,including
* icon,packagename,pid,uid,processname
*
*/
public
class
Programe
{
private
Drawable
icon
;
private
String
processName
;
...
...
src/com/netease/qa/emmagee/utils/TrafficInfo.java
浏览文件 @
2533df93
...
...
@@ -22,6 +22,10 @@ import java.io.RandomAccessFile;
import
android.util.Log
;
/**
* information of network traffic
*
*/
public
class
TrafficInfo
{
private
static
final
String
LOG_TAG
=
"Emmagee-"
...
...
@@ -72,6 +76,6 @@ public class TrafficInfo {
if
(
rcvTraffic
==
-
1
||
sndTraffic
==
-
1
)
{
return
-
1
;
}
else
return
(
rcvTraffic
+
sndTraffic
)
;
return
rcvTraffic
+
sndTraffic
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录