Commit 3fc9ca83 authored by 胡江林's avatar 胡江林

判断topActivity逻辑优化。

parent 8099d45f
......@@ -9,6 +9,7 @@ import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.IBinder;
import android.text.TextUtils;
import android.util.Log;
import java.util.concurrent.Executors;
......@@ -96,9 +97,9 @@ public class DaemonService extends Service {
String result = ApkUtil.execSuCmd1("dumpsys activity | grep \"mResumedActivity\"");
int start = result.indexOf("u0") + 3;
int end = result.indexOf("/");
Log.d(TAG, "s: " + start + " end:" + end + " result:" + result);
if (start < 0 || end < 0 || end <= start) {
return false;
if (TextUtils.isEmpty(result) || start < 0 || end < 0 || end <= start) {
return true;
}
//Log.d(TAG, "s: " + start + " end:" + end + " result:" + result);
String top = result.substring(start, end);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment