File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -97,6 +97,25 @@ __attribute__((visibility("default"))) void nativeForkAndSpecializePre(JNIEnv *e
9797
9898__attribute__ ((visibility(" default" ))) int nativeForkAndSpecializePost(JNIEnv *env, jclass clazz,
9999 jint res) {
100+
101+ if (res == 0 && enable_hook) {
102+ if (env) {
103+ LOGI (" inject android.os.Build for %s " , package_name);
104+
105+ jclass build_class = env->FindClass (" android.os.Build" );
106+ jfieldID brand_id = env->GetStaticFieldID (build_class, " BRAND" , " Ljava/lang/String;" );
107+ jfieldID manufacturer_id = env->GetStaticFieldID (build_class, " MANUFACTURER" , " Ljava/lang/String;" );
108+ jfieldID product_id = env->GetStaticFieldID (build_class, " PRODUCT" , " Ljava/lang/String;" );
109+
110+ jstring new_str = env->NewStringUTF (" Xiaomi" );
111+ env->SetStaticObjectField (build_class, brand_id, new_str);
112+ env->SetStaticObjectField (build_class, product_id, new_str);
113+ env->SetStaticObjectField (build_class, manufacturer_id, new_str);
114+
115+ env->DeleteLocalRef (new_str);
116+ }
117+ }
118+
100119 nativeForkAndSpecialize (res, enable_hook, package_name, uid);
101120 return !enable_hook;
102121}
You can’t perform that action at this time.
0 commit comments