|
@@ -0,0 +1,119 @@
|
|
|
|
|
+Java.perform(() => {
|
|
|
|
|
+ const PhoneInterfaceManager = Java.use('com.android.phone.PhoneInterfaceManager')
|
|
|
|
|
+ PhoneInterfaceManager.getLine1NumberForDisplay.overload(
|
|
|
|
|
+ 'int',
|
|
|
|
|
+ 'java.lang.String',
|
|
|
|
|
+ 'java.lang.String'
|
|
|
|
|
+ ).implementation = function (subId, callingPackage, callingFeatureId) {
|
|
|
|
|
+ const phoneNumber = this.getLine1NumberForDisplay(subId, callingPackage, callingFeatureId)
|
|
|
|
|
+ console.log(
|
|
|
|
|
+ `PhoneInterfaceManager.getLine1NumberForDisplay(${subId}, ${callingPackage}, ${callingFeatureId}) => ${phoneNumber}`
|
|
|
|
|
+ )
|
|
|
|
|
+ return '1234567890'
|
|
|
|
|
+ }
|
|
|
|
|
+ PhoneInterfaceManager.getNetworkCountryIsoForPhone.overload('int').implementation = function (phoneId) {
|
|
|
|
|
+ const countryIso = this.getNetworkCountryIsoForPhone(phoneId)
|
|
|
|
|
+ console.log(`PhoneInterfaceManager.getNetworkCountryIsoForPhone(${phoneId}): ${countryIso}`)
|
|
|
|
|
+ return 'us'
|
|
|
|
|
+ }
|
|
|
|
|
+ if (PhoneInterfaceManager.getNetworkCountryIso) {
|
|
|
|
|
+ PhoneInterfaceManager.getNetworkCountryIso.overload('int').implementation = function (phoneId) {
|
|
|
|
|
+ const countryIso = this.getNetworkCountryIso(phoneId)
|
|
|
|
|
+ console.log(`PhoneInterfaceManager.getNetworkCountryIso(${phoneId}): ${countryIso}`)
|
|
|
|
|
+ return 'us'
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ PhoneInterfaceManager.getImeiForSlot.overload('int', 'java.lang.String', 'java.lang.String').implementation =
|
|
|
|
|
+ function (slotId, callingPackage, callingFeatureId) {
|
|
|
|
|
+ const imei = this.getImeiForSlot(slotId, callingPackage, callingFeatureId)
|
|
|
|
|
+ console.log(
|
|
|
|
|
+ `PhoneInterfaceManager.getImeiForSlot(${slotId}, ${callingPackage}, ${callingFeatureId}): ${imei}`
|
|
|
|
|
+ )
|
|
|
|
|
+ return '123456789012345'
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const SubscriptionController = Java.use('com.android.internal.telephony.SubscriptionController')
|
|
|
|
|
+ const SubsciptionInfo = Java.use('android.telephony.SubscriptionInfo')
|
|
|
|
|
+ SubscriptionController.getPhoneNumberFromFirstAvailableSource.overload(
|
|
|
|
|
+ 'int',
|
|
|
|
|
+ 'java.lang.String',
|
|
|
|
|
+ 'java.lang.String'
|
|
|
|
|
+ ).implementation = function (subId, callingPackage, callingFeatureId) {
|
|
|
|
|
+ const phoneNumber = this.getPhoneNumberFromFirstAvailableSource(subId, callingPackage, callingFeatureId)
|
|
|
|
|
+ console.log(
|
|
|
|
|
+ `SubscriptionController.getPhoneNumberFromFirstAvailableSource(${subId}, ${callingPackage}, ${callingFeatureId}) => ${phoneNumber}`
|
|
|
|
|
+ )
|
|
|
|
|
+ return '1234567890'
|
|
|
|
|
+ }
|
|
|
|
|
+ SubscriptionController.getActiveSubscriptionInfoList.overload('java.lang.String').implementation = function (
|
|
|
|
|
+ callingPackage
|
|
|
|
|
+ ) {
|
|
|
|
|
+ const list = this.getActiveSubscriptionInfoList(callingPackage)
|
|
|
|
|
+ const newList = Java.use('java.util.ArrayList').$new()
|
|
|
|
|
+ for (let i = 0; i < list.size(); i++) {
|
|
|
|
|
+ const info = Java.cast(list.get(i), SubsciptionInfo)
|
|
|
|
|
+ info.mMcc.value = '123'
|
|
|
|
|
+ info.mMnc.value = '456'
|
|
|
|
|
+ info.mCountryIso.value = 'us'
|
|
|
|
|
+ info.mIccId.value = '1234567890'
|
|
|
|
|
+ newList.add(info)
|
|
|
|
|
+ }
|
|
|
|
|
+ return newList
|
|
|
|
|
+ }
|
|
|
|
|
+ SubscriptionController.getActiveSubscriptionInfoList.overload(
|
|
|
|
|
+ 'java.lang.String',
|
|
|
|
|
+ 'java.lang.String'
|
|
|
|
|
+ ).implementation = function (callingPackage, callingFeatureId) {
|
|
|
|
|
+ const list = this.getActiveSubscriptionInfoList(callingPackage, callingFeatureId)
|
|
|
|
|
+ const newList = Java.use('java.util.ArrayList').$new()
|
|
|
|
|
+ for (let i = 0; i < list.size(); i++) {
|
|
|
|
|
+ const info = Java.cast(list.get(i), SubsciptionInfo)
|
|
|
|
|
+ info.mMcc.value = '123'
|
|
|
|
|
+ info.mMnc.value = '456'
|
|
|
|
|
+ info.mCountryIso.value = 'us'
|
|
|
|
|
+ info.mIccId.value = '1234567890'
|
|
|
|
|
+ newList.add(info)
|
|
|
|
|
+ }
|
|
|
|
|
+ return newList
|
|
|
|
|
+ }
|
|
|
|
|
+ SubscriptionController.getSimStateForSlotIndex.overload('int').implementation = function (slotIndex) {
|
|
|
|
|
+ const simState = this.getSimStateForSlotIndex(slotIndex)
|
|
|
|
|
+ console.log(`SubscriptionController.getSimStateForSlotIndex(${slotIndex}) => ${simState}`)
|
|
|
|
|
+ return 5
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const PhoneSubInfoController = Java.use('com.android.internal.telephony.PhoneSubInfoController')
|
|
|
|
|
+ PhoneSubInfoController.getIccSerialNumberForSubscriber.overload(
|
|
|
|
|
+ 'int',
|
|
|
|
|
+ 'java.lang.String',
|
|
|
|
|
+ 'java.lang.String'
|
|
|
|
|
+ ).implementation = function (subId, callingPackage, callingFeatureId) {
|
|
|
|
|
+ const iccSerialNumber = this.getIccSerialNumberForSubscriber(subId, callingPackage, callingFeatureId)
|
|
|
|
|
+ console.log(
|
|
|
|
|
+ `PhoneSubInfoController.getIccSerialNumberForSubscriber(${subId}, ${callingPackage}, ${callingFeatureId}) => ${iccSerialNumber}`
|
|
|
|
|
+ )
|
|
|
|
|
+ return '1234567890'
|
|
|
|
|
+ }
|
|
|
|
|
+ PhoneSubInfoController.getSubscriberIdForSubscriber.overload(
|
|
|
|
|
+ 'int',
|
|
|
|
|
+ 'java.lang.String',
|
|
|
|
|
+ 'java.lang.String'
|
|
|
|
|
+ ).implementation = function (subId, callingPackage, callingFeatureId) {
|
|
|
|
|
+ const subscriberId = this.getSubscriberIdForSubscriber(subId, callingPackage, callingFeatureId)
|
|
|
|
|
+ console.log(
|
|
|
|
|
+ `PhoneSubInfoController.getSubscriberIdForSubscriber(${subId}, ${callingPackage}, ${callingFeatureId}) => ${subscriberId}`
|
|
|
|
|
+ )
|
|
|
|
|
+ return '1234567890'
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const SystemProperties = Java.use('android.os.SystemProperties')
|
|
|
|
|
+ console.log('SystemProperties', SystemProperties)
|
|
|
|
|
+ SystemProperties.set('gsm.sim.operator.iso-country', 'us')
|
|
|
|
|
+ SystemProperties.set('gsm.sim.operator.numeric', '123456')
|
|
|
|
|
+ SystemProperties.set('gsm.operator.numeric', '123456')
|
|
|
|
|
+ console.log(
|
|
|
|
|
+ SystemProperties.get('gsm.sim.operator.iso-country'),
|
|
|
|
|
+ SystemProperties.get('gsm.sim.operator.numeric'),
|
|
|
|
|
+ SystemProperties.get('gsm.operator.numeric')
|
|
|
|
|
+ )
|
|
|
|
|
+})
|