[Android Software Development] vladimiroltean:
Hi guys,

I am helping bring up Lineage-15.1 on an LTE tablet and I have been getting this error in the SetupWizard with Nezorflame's unofficial opengapps-8.1 package:

E AndroidRuntime: FATAL EXCEPTION: main
E AndroidRuntime: Process: com.google.android.setupwizard, PID: 17569
E AndroidRuntime: java.lang.NoSuchMethodError: No direct method <init>(I)V in class Landroid/telephony/PhoneStateListener; or its super classes (declaration of 'android.telephony.PhoneStateListener' appears in /system/framework/framework.jar!classes2.dex)
E AndroidRuntime: at com.google.android.setupwizard.carrier.PhoneMonitor$SubscriptionStateTracker.<init>(PhoneMonitor.java:128)
E AndroidRuntime: at com.google.android.setupwizard.carrier.PhoneMonitor.updatePhoneStateTrackers(PhoneMonitor.java:601)
E AndroidRuntime: at com.google.android.setupwizard.carrier.PhoneMonitor.startMonitor(PhoneMonitor.java:207)
E AndroidRuntime: at com.google.android.setupwizard.lifecycle.MonitorLifecycleCallback.onSessionResume(MonitorLifecycleCallback.java:29)
E AndroidRuntime: at com.google.android.setupwizard.common.lifecycle.LifecycleManager.notifyApplicationStart(LifecycleManager.java:67)
E AndroidRuntime: at com.google.android.setupwizard.SetupWizardApplication.onCreate(SetupWizardApplication.java:33)
E AndroidRuntime: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1119)
E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5740)
E AndroidRuntime: at android.app.ActivityThread.-wrap1(Unknown Source:0)
E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1656)
E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
E AndroidRuntime: at android.os.Looper.loop(Looper.java:164)
E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:6494)
E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
W ActivityManager: Force finishing activity com.google.android.setupwizard/.SetupWizardActivity
I Process : Sending signal. PID: 17569 SIG: 9
I ActivityManager: Process com.google.android.setupwizard (pid 17569) has died: fore TPSL

It appears that the PhoneStateListener constructor has changed in this commit, from:

public PhoneStateListener(int subId) {

to

public PhoneStateListener(Integer subId) {

If I add the missing constructor prototype to the PhoneStateListener class, everything works:

diff --git a/telephony/java/android/telephony/PhoneStateListener.java b/telephony/java/android/telephony/PhoneStateListener.java
index afff6d548e8..f5226eff3b2 100644
--- a/telephony/java/android/telephony/PhoneStateListener.java
+++ b/telephony/java/android/telephony/PhoneStateListener.java
@@ -290,6 +290,16 @@ public class PhoneStateListener {
this(subId, Looper.myLooper());
}

+ /**
+ * Create a PhoneStateListener for the Phone using the specified subscription.
+ * This class requires Looper.myLooper() not return null. To supply your
+ * own non-null Looper use PhoneStateListener(int subId, Looper looper) below.
+ * @hide
+ */
+ public PhoneStateListener(int subId) {
+ this(subId, Looper.myLooper());
+ }
+
/**
* Create a PhoneStateListener for the Phone using the specified subscription
* and non-null Looper.
(

I have traced the obsolete call to the com.google.android.ims APK which is built for API 23.

Do you think you could update the file with one built for a more recent SDK version?