- 注册时间
- 2013-4-19
- 最后登录
- 2024-9-26
- 阅读权限
- 200
- 积分
- 6404
- 精华
- 0
- 帖子
- 640
|
判断与反判断(暂时这个名字,需要起个响亮的名字)
1.判断sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT)
反判断./core/java/android/hardware/SensorManager.java if (type ==5 ) return new Sensor();
2.判断bluetoothAdapter.getName();
反判断./core/java/android/bluetooth/BluetoothAdapter.java getName() 函数 直接返回 “btname”
3.判断cat /proc/cpuinfo
反判断:kernel/arch/x86/kernel/cpu/proc.c show_cpuinfo函数,想改哪个改哪个
4.判断 安装的应用 getPackageManager().queryIntentActivities
反判断 ./services/core/java/com/android/server/pm/PackageManagerService.java applyPostResolutionFilter 函数
if (info.activityInfo.packageName.indexOf("chromium")>=0) { resolveInfos.remove(i);
Log.v(TAG, "=============applyPostResolutionFilter=remove chromium");
continue;
}
5. 判断 通过native getprop 获取ro.product.cpu.abi 等属性 AntiFakerAndroidChecker 绕过libcutil 直接调用的sys/system_properties.h
反判断 bionic/libc/bionic/system_properties.cpp __system_property_get 函数 可以拦截
const prop_info* pi = __system_property_find(name); async_safe_format_log(ANDROID_LOG_ERROR, "libc", "=====================__system_property_get \"%s\" ", name);
这个log是异步的 有时候需要再此抓取log才能看到, logcat 默认是-v time的 为了方便对比 可以用-v process 来抓取log
参考下面代码
const char * filter = "ro.product.cpu.abi";
int ret = strcmp(pi->name, filter);
if (ret ==0) {
memcpy(value, "target_abi", 10);
async_safe_format_log(ANDROID_LOG_ERROR, "libc", "=====================__system_property_read target_abi");
return 10;
} else {
uint32_t serial = __system_property_serial(pi); // acquire semantics
size_t len = SERIAL_VALUE_LEN(serial);
memcpy(value, pi->value, len + 1);
}
async_safe_format_log(ANDROID_LOG_ERROR, "libc", "=====================__system_property_read value =\"%s\" , name = %s ,ret = %d ", value,pi->name,ret);
6.判断电池
./services/core/java/com/android/server/BatteryService.java
processValuesLocked 函数
7.判断opengl信息
external/swiftshader/src/OpenGL/libGLESv2/libGLESv2.cpp +3487
修改renderer 和version信息
1
|
|