Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkByHasSameUid 方法中filter变量返回空 会造成空指针 #1

Closed
wilder-ness opened this issue Jun 21, 2018 · 2 comments
Closed

Comments

@wilder-ness
Copy link

wilder-ness commented Jun 21, 2018

 public boolean checkByHasSameUid() {
        String filter = getUidStrFormat();

        String result = CommandUtil.getSingleInstance().exec("ps");
        if (result == null || result.isEmpty()) {
            return false;
        }

        String[] lines = result.split("\n");
        if (lines == null || lines.length <= 0) {
            return false;
        }

        int exitDirCount = 0;

        for (int i = 0; i < lines.length; i++) {
### //如果filter 为空 contains 会报空指针异常

            if (lines[i].contains(filter)) {  
                int pkgStartIndex = lines[i].lastIndexOf(" ");
                String processName = lines[i].substring(pkgStartIndex <= 0
                        ? 0 : pkgStartIndex + 1, lines[i].length());
                File dataFile = new File(String.format("/data/data/%s", processName, Locale.CHINA));
                if (dataFile.exists()) {
                    exitDirCount++;
                }
            }
        }

        return exitDirCount > 1;
    }
lamster2018 pushed a commit that referenced this issue Jun 21, 2018
@lamster2018
Copy link
Owner

就是这个bug帮助我多了一条检测模拟器的思路,但是这个bug就忘记改了,谢谢你的提醒

@wilder-ness
Copy link
Author

wilder-ness commented Jun 21, 2018

对了- 还有个思路。。就是某些分身软件的 appName 后面会加分身两个字。这个并不是身靠谱的检测方式。
比如多开分身,还有这个多开分身检测不出来。

我想问个问题。就是这类的分身软件创建的app 获取的packageInfo 这里的内容是能作假的么?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants