Code example for PathClassLoader

Methods: loadClass, sleep

0
	private AsyncResult sendRilOemHookMsg(int requestId, byte[] request) {		
		final String QCRILHOOK_CLASS = "com.qualcomm.qcrilhook.QcRilHook";
		AsyncResult ar = null;
		try { 
			PathClassLoader qcRilHookClassLoader = 
				new PathClassLoader("/system/framework/qcrilhook.jar", ClassLoader.getSystemClassLoader());
			Class<?> cl = qcRilHookClassLoader.loadClass(QCRILHOOK_CLASS);
			Constructor c = cl.getConstructor(new Class[] {Context.class});
 
			//20130729, yeongsu.wu, TD69739, setFlag null pointer due to getIQcrilMsgTunnelService is null 
			Object qcrilObj = c.newInstance(mContext);
 
			Method mGetService = cl.getMethod("getIQcrilMsgTunnelService");
			Object isServiceAvailable = (Object) mGetService.invoke(qcrilObj);
			 
			if (isServiceAvailable == null) {
				Log.d(TAG, "getIQcrilMsgTunnelService() return null");
				try { 
					Thread.sleep(500);
				} catch (InterruptedException e) {
					Log.e(TAG, "Failed: " + e);
				} 
			} else { 
				Log.d(TAG, "getIQcrilMsgTunnelService() return not null");