IncompatibleClassChangeError
Hi, I'm trying to use some hidden methods from api level 27 but I'm having some trouble; I know this is a bit different from the issues usually posted here but anyway, I hope someone might have seen this error. The app I'm developing, is vendor signed.
I have a Service, tha runs on the process com.android.phone. It's declared like this on the manifest:
<service
android:name=".PhoneService"
android:enabled="true"
android:exported="true"
android:process="com.android.phone">
<intent-filter>
<action android:name="com.mydomain.myapp.START_PHONE_SERVICE" />
</intent-filter>
</service>
I try to get an instance of the Phone object, like this:
SubscriptionManager sm = SubscriptionManager.from(context);
@SuppressLint("MissingPermission")
SubscriptionInfo sir = sm.getActiveSubscriptionInfoForSimSlotIndex(0);
mPhoneId = sir.getSubscriptionId();
mPhone = PhoneFactory.getPhone(SubscriptionManager.getPhoneId(mPhoneId));
The field mPhone is "loaded" with a valid instance of Phone; it's not null. But, when I do this:
IccCard iccCard = mPhone.getIccCard();
I get this error:
java.lang.IncompatibleClassChangeError: The method 'com.android.internal.telephony.IccCard com.android.internal.telephony.Phone.getIccCard()' was expected to be of type virtual but instead was found to be of type interface (declaration of ... etc
Any ideias on this problem?
The app the service runs on is vendor signed; the manifest has "android:sharedUserId="android.uid.system", the service has "android:process="com.android.phone", just like e.g. the system app com.android.settings has.