CommonUtil.java 文件源码

java
阅读 39 收藏 0 点赞 0 评论 0

项目:OSMonitor.Legacy 作者:
public static boolean checkExtraStore(PreferenceActivity activity)
{
    boolean flag = false;
    if(Integer.parseInt(Build.VERSION.SDK) >= 8)
    {
        // use Reflection to avoid errors (for cupcake 1.5)
        Method MethodList[] = activity.getClass().getMethods();
        for(int checkMethod = 0; checkMethod < MethodList.length; checkMethod++)
        {
            if(MethodList[checkMethod].getName().indexOf("ApplicationInfo") != -1)
            {
                try{
                    if((((ApplicationInfo) MethodList[checkMethod].invoke(activity , new Object[]{})).flags & 0x40000 /* ApplicationInfo.FLAG_EXTERNAL_STORAGE*/ ) != 0 )
                        flag = true;
                }
                catch(Exception e) {}
            }
        }
    }
    return flag;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号