9586-19586/? D/AccessibilityManager: at com.dianping.base.app.NovaActivity.setContentView(NovaActivity.java:722)
9586-19586/? D/AccessibilityManager: at com.dianping.main.guide.MainActivity.setOnContentView(MainActivity.java:339)
9586-19586/? D/AccessibilityManager: at com.dianping.base.basic.FragmentTabActivity.onCreate(FragmentTabActivity.java:51)
9586-19586/? D/AccessibilityManager: at com.dianping.base.widget.NovaFragmentTabActivity.onCreate(NovaFragmentTabActivity.java:26)
9586-19586/? D/AccessibilityManager: at com.dianping.main.guide.MainActivity.onCreate(MainActivity.java:169)
9586-19586/? D/AccessibilityManager: at com.dianping.v1.NovaMainActivity.onCreate(NovaMainActivity.java:15)
if (!checkSignature()) {
Process.killProcess(Process.myPid());
}
`checkSignature` 函数:
private boolean checkSignature()
{
try
{
Signature[] arrayOfSignature = getPackageManager().getPackageInfo(getPackageName(), 64).signatures; //获得签名数组
if (arrayOfSignature != null)
{
if (arrayOfSignature.length == 0) {
return false;
}
int j = arrayOfSignature.length;
int i = 0;
while (i < j) //如果数组中的某个元素值与 'ac6fc3fe' 相等,返回校验成功;如果直到结束也没有相等的元素,返回失败
{ //只比较一个特定的元素,可能也是为了不把整个签名泄露出来,同时也做到了一定程度的校验
String str = Integer.toHexString(arrayOfSignature[i].toCharsString().hashCode());
if (!"ac6fc3fe".equalsIgnoreCase(str))
{
boolean bool = "600cf559".equalsIgnoreCase(str); //这个比较好像没用
if (!bool) {}
}
else
{
return true;
}
i += 1;
}
}
return false;
}
catch (Exception localException) {}
}
相关 API:
`public Signature[] signatures`
Array of all signatures read from the package file. This is only filled in if the flag GET_SIGNATURES was set.
`public static final int GET_SIGNATURES`
PackageInfo flag: return information about the signatures included in the package.
Constant Value: 64 (0x00000040)
`public boolean equalsIgnoreCase (String string)`
Compares the given string to this string ignoring case.
The strings are compared one char at a time.