我正在创建一个应用程序,通过键或模式锁锁定所有其他手机应用程序 但它不适用于4.0或更高版本
以下是调用块活动的代码,但它不是在4.0中调用..
try {
Process process;
process = Runtime.getRuntime().exec(ClearLogCatCommand);
process = Runtime.getRuntime().exec(LogCatCommand);
br = new BufferedReader(new InputStreamReader(process.getInputStream()));
String line;
// Check if it matches the pattern
while(((line=br.readLine()) != null) && !this.isInterrupted()){
Log.d("Detector", "RUN"+line);
// Ignore launchers
if (line.contains("cat=[" + Intent.CATEGORY_HOME + "]")) continue;
Matcher m = ActivityNamePattern.matcher(line);
//Log.d("Detector","match"+m);
if (!m.find()) continue;
//Log.d("Detector","continue"+m);
if (m.groupCount()<2){
// Log.d("Detector", "Unknown problem while matching logcat output. Might be SDK version?");
//Log.d("Detector","group"+m);
continue;
}
if (mListener!=null) mListener.onActivityStarting(m.group(1), m.group(2));
Log.i("Detector", "Found activity launching: " + m.group(1) + " / " + m.group(2));
}
} catch (IOException e) {
e.printStackTrace();
}