package com.mySecretary.util;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningServiceInfo;
import android.app.ActivityManager.RunningTaskInfo;
import android.content.Context;
import android.telephony.TelephonyManager;
import android.util.DisplayMetrics;
import android.util.Log;
public class FetchData {
private static StringBuffer buffer;
//cpu info
public static String fetch_cup_info(){
String result =null;
CMDExecute cmdexe = new CMDExecute();
try{
String[] args={"/system/bin/cat","/proc/cpuinfo"};
result=cmdexe.run(args, "/system/bin/");
Log.i("result","result="+result);
}catch(IOException ex){
ex.printStackTrace();
}
return result;
}
//disk info
public static String fetch_disk_info(){
String result = null;
CMDExecute cmdexe=new CMDExecute();
try{
String[] args={"/system/bin/df"};
result=cmdexe.run(args, "/system/bin/");
}catch(IOException ex){
ex.printStackTrace();
}
return result;
}
//netstat info
public static String fetch_netstat_info(){
String result = null;
CMDExecute cmdexe=new CMDExecute();
try{
String[] args={"/system/bin/netstat"};
result=cmdexe.run(args, "/system/bin/");
}catch(IOException ex){
ex.printStackTrace();
}
return result;
}
//netstat info
public static String fetch_version_info(){
String result =null;
CMDExecute cmdexe=new CMDExecute();
try{
String[] args={"/system/bin/cat","/proc/version"};
result = cmdexe.run(args, "/system/bin/");
}catch(IOException ex){
ex.printStackTrace();
}
return result;
}
//netstat info
public static String fetch_dmesg_info(){
Log.i("fetch_dmesg_info", "start....");
String result=null;
CMDExecute cmdexe= new CMDExecute();
try{
String[] args={"/system/bin/dmesg"};
result=cmdexe.run(args, "/system/bin/");
}catch(IOException ex){
Log.i("fetch_dmesg_info","ex="+ex.toString());
}
return result;
}
//fetch_process_info
public static String fetch_process_info(){
Log.i("fetch_process_info","start....");
String result = null;
CMDExecute cmdexe=new CMDExecute();
try{
String[] args={"/system/bin/top","-n","1"};
result=cmdexe.run(args, "/system/bin/");
}catch(IOException ex){
Log.i("fetch_process_info","ex="+ex.toString());
}
return result;
}
//fetch_process_info
public static String fetch_netcfg_info(){
Log.i("fetch_process_info", "start....");
String result = null;
CMDExecute cmdexe = new CMDExecute();
try{
String[] args={"/system/bin/netcfg"};
result=cmdexe.run(args, "/system/bin/");
}catch(IOException ex){
Log.i("fetch_process_info","ex="+ex.toString());
}
return result;
}
//fetch_mount_info
public static String fetch_mount_info(){
Log.i("fetch_process_info","start...");
String result=null;
CMDExecute cmdexe= new CMDExecute();
try{
String[]args={"/system/bin/mount"};
result=cmdexe.run(args,"/system/bin/");
}catch(IOException ex){
Log.i("fetch_process_info","ex="+ex.toString());
}
return result;
}
public static String fetch_tel_status(Context cx){
String result = null;
TelephonyManager tm = (TelephonyManager) cx.getSystemService(Context.TELEPHONY_SERVICE);
String str="";
str+="DeviceId(IMEI)="+tm.getDeviceId()+"\n";
str+="DeviceSoftwareVersion="+tm.getDeviceSoftwareVersion()+"\n";
str+="Line1Number="+tm.getLine1Number()+"\n";
str+="NetworkCountryIso"+tm.getNetworkCountryIso()+"\n";
str+="NetworkOperator="+tm.getNetworkOperator()+"\n";
str+="NetworkOperatorName="+tm.getNetworkOperatorName()+"\n";
str+="NetworkType="+tm.getNetworkType()+"\n";
str+="PhoneTypeq="+tm.getPhoneType()+"\n";
str+="SimCountryIso="+tm.getSimCountryIso()+"\n";
str+="SimOperator="+tm.getSimOperator()+"\n";
str+="SimOperatorName="+tm.getSimOperatorName()+"\n";
str+="SimSerialNumber="+tm.getSimSerialNumber()+"\n";
str += "SimState = " + tm.getSimState() + "\n";
str += "SubscriberId(IMSI) = " + tm.getSubscriberId() + "\n";
str += "VoiceMailNumber = " + tm.getVoiceMailNumber() + "\n";
int mcc = cx.getResources().getConfiguration().mcc;
int mnc = cx.getResources().getConfiguration().mnc;
str += "IMSI MCC (Mobile Country Code):" + String.valueOf(mcc) + "\n";
str += "IMSI MNC (Mobile Network Code):" + String.valueOf(mnc) + "\n";
result = str;
return result;
}
//查看系统内存
public static String getMemoryInfo(Context context){
StringBuffer memoryInfo=new StringBuffer();
final ActivityManager activityManager=(ActivityManager)context .getSystemService(Context.ACTIVITY_SERVICE);
ActivityManager.MemoryInfo outInfo=new ActivityManager.MemoryInfo();
activityManager.getMemoryInfo(outInfo);
memoryInfo.append("\nTotal Available Memory:").append(outInfo.availMem>>10).append("k");
memoryInfo.append("\nTotal Available Memory:").append(outInfo.availMem>>20).append("M");
memoryInfo.append("\nIn low memory situation:").append(outInfo.lowMemory);
String result=null;
CMDExecute cmdexe= new CMDExecute();
try{
String[] args={"/system/bin/cat","/proc/meminfo"};
result=cmdexe.run(args, "/system/bin/");
}catch(IOException ex){
Log.i("fetch_process_info","ex="+ex.toString());
}
return memoryInfo.toString()+"\n\n"+result;
}
//系统信息查看方法
private static String initProperty(String description,String propertyStr){
if(buffer==null){
buffer=new StringBuffer();
}
buffer.append(description).append(":");
buffer.append(System.getProperty(propertyStr)).append("\n");
return buffer.toString();
}
public static String getSystemProperty(){
buffer = new StringBuffer();
initProperty("java.vendor.url", "java.vendor.url");
initProperty("java.class.path", "java.class.path");
initProperty("user.home", "user.home");
initProperty("java.class.version", "java.class.version");
initProperty("os.version", "os.version");
initProperty("java.vendor", "java.vendor");
initProperty("user.dir", "user.dir");
initProperty("user.timezone", "user.timezone");
initProperty("path.separator", "path.separator");
initProperty(" os.name", " os.name");
initProperty("os.arch", "os.arch");
initProperty("line.separator", "line.separator");
initProperty("file.separator", "file.separator");
initProperty("user.name", "user.name");
initProperty("java.version", "java.version");
initProperty("java.home", "java.home");
return buffer.toString();
}
//获取显示屏信息
public static String getDisplayMetrics(Context cx) {
String str = "";
DisplayMetrics dm = new DisplayMetrics();
dm = cx.getApplicationContext().getResources().getDisplayM
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Android手机小秘书.zip (61个子文件)
MySecretary
.project 847B
default.properties 362B
bin
com
mySecretary
R$string.class 484B
R$layout.class 601B
ShowInfo.class 4KB
R$drawable.class 716B
System.class 4KB
R.class 510B
Runing.class 4KB
ShowInfo$1.class 946B
R$attr.class 331B
wenjian.class 5KB
Hardware.class 4KB
Software$1.class 789B
util
FetchData.class 11KB
PreferencesUtil.class 893B
ToolHelper.class 769B
CMDExecute.class 2KB
R$id.class 544B
Software.class 4KB
infos.class 4KB
resources.ap_ 34KB
MySecretary.apk 49KB
classes.dex 28KB
proguard.cfg 1KB
AndroidManifest.xml 951B
src
com
mySecretary
ShowInfo.java 3KB
System.java 3KB
Hardware.java 3KB
Software.java 2KB
wenjian.java 3KB
Runing.java 3KB
infos.java 3KB
util
FetchData.java 10KB
PreferencesUtil.java 1009B
ToolHelper.java 359B
CMDExecute.java 888B
res
values
strings.xml 290B
layout
file_row.xml 1KB
files.xml 322B
runing.xml 322B
infos.xml 327B
item_row.xml 897B
main.xml 375B
showinfo.xml 727B
info_row.xml 895B
drawable-ldpi
file_explorer.png 2KB
hardware.png 5KB
system.png 2KB
file_doc.png 1KB
file_paranet.png 2KB
file_root.png 1KB
running.png 5KB
files.png 2KB
directory.png 652B
software.png 2KB
icon.png 2KB
drawable-hdpi
icon.png 4KB
drawable-mdpi
icon.png 3KB
.classpath 280B
gen
com
mySecretary
R.java 2KB
assets
共 61 条
- 1
资源评论
WWWS123NHM
- 粉丝: 1
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功