代码解释: public class ModemDebugDumpCollect { private static String TAG = "XiaomiModemDumpCollect"; private static boolean mJNILoaded = false; private static final String DEVICE_TYPE_DEVICES = "munch,psyche,alioth,aliothin,thyme,cmi,umi,cas"; private static final String PROP_SWITCH_SSR_MONITOR = "persist.vendor.radio.ssr_monitor"; private static final String PROP_SWITCH_SSR_MONITOR_ON = "1"; private static final String PROP_SWITCH_SSR_MONITOR_OFF = "0"; private static OemHookAgent mMtbHookAgent = null; public ModemDebugDumpCollect() { if(mJNILoaded == false) { try { loadDiag(); mJNILoaded = true; } catch (final UnsatisfiedLinkError err) { Log.d(TAG, "JNI_load failed, UnsatisfiedLinkError: " + err.toString()); } catch (Exception e) { Log.d(TAG, "JNI_load failed, Exception:" + e.toString()); } } } private void loadDiag() { mMtbHookAgent = OemHookAgent.getHook(); Log.d(TAG, "mMtbHookAgent: " + mMtbHookAgent); if (null != mMtbHookAgent && PROP_SWITCH_SSR_MONITOR_ON.equals(mMtbHookAgent.onHookPropGetSync(PROP_SWITCH_SSR_MONITOR, PROP_SWITCH_SSR_MONITOR_OFF))) { System.loadLibrary("xiaomi_modemdump_rild_jni"); Log.d(TAG, "load xiaomi_modemdump_rild_jni success"); return; } String deviceName = SystemProperties.get("ro.product.vendor.device", ""); if(0 != deviceName.length() && DEVICE_TYPE_DEVICES.contains(deviceName)) { System.loadLibrary("xiaomi_modemdumpsdx55_jni"); Log.d(TAG, "load xiaomi_modemdumpsdx55_jni success"); } else { System.loadLibrary("xiaomi_modemdump_jni"); Log.d(TAG, "load xiaomi_modemdump_jni success"); } } public int modemDumpCollectStart() { try { if (false == mJNILoaded) { Log.d(TAG, "JNI_load failed, will not do JNI_start proc"); return 0; } return start(); } catch (final UnsatisfiedLinkError err) { Log.d(TAG, "JNI_start failed, UnsatisfiedLinkError: " + err.toString()); } catch (Exception e) { Log.d(TAG, "JNI_start failed, Exception: " + e.toString()); } return 0; } private static native int start(); }
时间: 2024-02-14 17:35:37 浏览: 125
Java中static静态变量的初始化完全解析
这是一个名为ModemDebugDumpCollect的Java类。它的作用是收集与调试调制解调器相关的信息。它包含一个构造函数和三个方法loadDiag()、modemDumpCollectStart()和start()。
loadDiag()方法是用来加载与调试调制解调器相关的本地库。它首先检查一个名为PROP_SWITCH_SSR_MONITOR的系统属性,如果它的值为1并且OemHookAgent对象不为空,则加载名为xiaomi_modemdump_rild_jni的本地库。否则,它会检查设备型号是否在预定义的设备列表中,如果是,则加载名为xiaomi_modemdumpsdx55_jni的本地库;否则,加载名为xiaomi_modemdump_jni的本地库。
modemDumpCollectStart()方法负责启动与调试调制解调器相关的信息收集过程。它首先检查mJNILoaded标志,如果它为false,则表示加载本地库失败,该方法将返回0;否则,它将调用本地方法start(),并返回其返回值。
start()方法是一个本地方法,它实际执行与调试调制解调器相关的信息收集过程。
阅读全文