Hello, you need the help of a professional, as this task is extremely difficult.

I'm trying to create an instance of the com.android.internal.telephony.RIL class. I added the closed API and did everything correctly - I skipped the modem framework through dex2jar and added it to the used classes. Also opened the jar in jd-gui . By the way, most likely the framework has been modified by the manufacturer - Micromax . I called the static method TelephonyDevController.getModemCount() and got the return value - everything works . In general, the task is as follows:

There is a com.android.internal.telephony.IccCard interface with the boolean getIccLockEnabled() method. There is a class that implements it - com.android.internal.telephony.uicc.IccCardProxy . I want to call its getIccLockEnabled method. To create an instance of this class, you need to pass the android.content.Context , com.android.internal.telephony.CommandsInterface and int parameters to its constructor. The second parameter is the interface, which means you can transfer its subclass, namely, com.android.internal.telephony.RIL . To create an instance of RIL , you must pass a context and two int to its constructor. But when creating RIL application crashes with the TelephonyDevController not yet created!?! log TelephonyDevController not yet created!?! .

Here is the class constructor RIL

  public RIL(Context paramContext, int paramInt1, int paramInt2, Integer paramInteger) { super(paramContext); riljLog("RIL(context, preferredNetworkType=" + paramInt1 + " cdmaSubscription=" + paramInt2 + ")"); this.mContext = paramContext; this.mCdmaSubscription = paramInt2; this.mPreferredNetworkType = paramInt1; this.mPhoneType = 0; this.mInstanceId = paramInteger; this.mWakeLock = ((PowerManager)paramContext.getSystemService("power")).newWakeLock(1, "RILJ"); this.mWakeLock.setReferenceCounted(false); this.mWakeLockTimeout = SystemProperties.getInt("ro.ril.wake_lock_timeout", 60000); this.mWakeLockCount = 0; this.mSenderThread = new HandlerThread("RILSender" + this.mInstanceId); this.mSenderThread.start(); this.mSender = new RILSender(this.mSenderThread.getLooper()); if (!((ConnectivityManager)paramContext.getSystemService("connectivity")).isNetworkSupported(0)) { riljLog("Not starting RILReceiver: wifi-only"); } for (;;) { TelephonyDevController.getInstance(); TelephonyDevController.registerRIL(this); return; riljLog("Starting RILReceiver" + this.mInstanceId); this.mReceiver = createRILReceiver(); this.mReceiverThread = new Thread(this.mReceiver, "RILReceiver" + this.mInstanceId); this.mReceiverThread.start(); paramContext = (DisplayManager)paramContext.getSystemService("display"); this.mDefaultDisplay = paramContext.getDisplay(0); paramContext.registerDisplayListener(this.mDisplayListener, null); } } 

And the methods of the class TelephonyDevController are create() and getInstance()

  public static TelephonyDevController create() { synchronized (mLock) { if (sTelephonyDevController != null) { throw new RuntimeException("TelephonyDevController already created!?!"); } } sTelephonyDevController = new TelephonyDevController(); TelephonyDevController localTelephonyDevController = sTelephonyDevController; return localTelephonyDevController; } public static TelephonyDevController getInstance() { synchronized (mLock) { if (sTelephonyDevController == null) { throw new RuntimeException("TelephonyDevController not yet created!?!"); } } TelephonyDevController localTelephonyDevController = sTelephonyDevController; return localTelephonyDevController; } 
  • But it was impossible to simply take the source code of TelephonyDevController and RIL and just stupidly duplicate them in oneself (in a different package) with all dependent imports? - Barmaley
  • but now I do not understand, why? - Flippy
  • Because it is an accepted practice when you want to use private / internal classes / API - Barmaley
  • Well, it's too late :) And what will it give me? - Flippy
  • As a version, you have a problem in that the inner classes somewhere in the depths call each other or you do not initialize something somewhere. To understand this, you need to pull out the RIL and TelephonyDevController classes into your packages and try to assemble them - you will immediately see unresolved references to other classes / packages. I had a similar story with MMS - in the end I was forced to pull out a cloud of source code (something about 50 classes) - Barmaley

0