|
@@ -0,0 +1,138 @@
|
|
|
|
|
+class Log {
|
|
|
|
|
+ static TAG = '[Phone]'
|
|
|
|
|
+ static Debug = true
|
|
|
|
|
+ static format(...msg) {
|
|
|
|
|
+ let m = []
|
|
|
|
|
+ for (let i = 0; i < msg.length; i++) {
|
|
|
|
|
+ if (typeof msg[i] === 'object') {
|
|
|
|
|
+ m.push(JSON.stringify(msg[i]))
|
|
|
|
|
+ } else {
|
|
|
|
|
+ m.push(msg[i])
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ m = m.join(' ')
|
|
|
|
|
+ return m
|
|
|
|
|
+ }
|
|
|
|
|
+ static i(...msg) {
|
|
|
|
|
+ if (!this.Debug) return
|
|
|
|
|
+ console.log(`\x1b[30m${this.TAG} ${this.format(...msg)}\x1b[0m`)
|
|
|
|
|
+ }
|
|
|
|
|
+ static w(...msg) {
|
|
|
|
|
+ console.log(`\x1b[33m${this.TAG} ${this.format(...msg)}\x1b[0m`)
|
|
|
|
|
+ }
|
|
|
|
|
+ static e(...msg) {
|
|
|
|
|
+ console.log(`\x1b[31m${this.TAG} ${this.format(...msg)}\x1b[0m`)
|
|
|
|
|
+ }
|
|
|
|
|
+ static s(...msg) {
|
|
|
|
|
+ console.log(`\x1b[32m${this.TAG} ${this.format(...msg)}\x1b[0m`)
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+function trace(tag) {
|
|
|
|
|
+ Log.e((tag || '') + Java.use('android.util.Log').getStackTraceString(Java.use('java.lang.Throwable').$new()))
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+setImmediate(() => {
|
|
|
|
|
+ Java.perform(function () {
|
|
|
|
|
+ const SystemProperties = Java.use('android.os.SystemProperties')
|
|
|
|
|
+
|
|
|
|
|
+ const PhoneInterfaceManager = Java.use('com.android.phone.PhoneInterfaceManager')
|
|
|
|
|
+ PhoneInterfaceManager.getLine1NumberForDisplay.overload(
|
|
|
|
|
+ 'int',
|
|
|
|
|
+ 'java.lang.String',
|
|
|
|
|
+ 'java.lang.String'
|
|
|
|
|
+ ).implementation = function (subId, callingPackage, callingFeatureId) {
|
|
|
|
|
+ const res = this.getLine1NumberForDisplay(subId, callingPackage, callingFeatureId)
|
|
|
|
|
+ Log.i(
|
|
|
|
|
+ `PhoneInterfaceManager.getLine1NumberForDisplay(${subId}, ${callingPackage}, ${callingFeatureId}): ${res}`
|
|
|
|
|
+ )
|
|
|
|
|
+ return res
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ PhoneInterfaceManager.getNetworkCountryIsoForPhone.overload('int').implementation = function (phoneId) {
|
|
|
|
|
+ const res = this.getNetworkCountryIsoForPhone(phoneId)
|
|
|
|
|
+ Log.i(`PhoneInterfaceManager.getNetworkCountryIsoForPhone(${phoneId}): ${res}`)
|
|
|
|
|
+ return res
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ PhoneInterfaceManager.getImeiForSlot.overload('int', 'java.lang.String', 'java.lang.String').implementation =
|
|
|
|
|
+ function (slotId, callingPackage, callingFeatureId) {
|
|
|
|
|
+ const res = this.getImeiForSlot(slotId, callingPackage, callingFeatureId)
|
|
|
|
|
+ Log.i(`PhoneInterfaceManager.getImeiForSlot(${slotId}, ${callingPackage}, ${callingFeatureId}): ${res}`)
|
|
|
|
|
+ return res
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ SystemProperties.get.overload('java.lang.String').implementation = function (key) {
|
|
|
|
|
+ const res = this.get(key)
|
|
|
|
|
+ Log.i(`SystemProperties.get(${key}): ${res}`)
|
|
|
|
|
+ return res
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const SubscriptionController = Java.use('com.android.internal.telephony.SubscriptionController')
|
|
|
|
|
+ SubscriptionController.getSimStateForSlotIndex.overload('int').implementation = function (slotIndex) {
|
|
|
|
|
+ const res = this.getSimStateForSlotIndex(slotIndex)
|
|
|
|
|
+ Log.i(`SubscriptionController.getSimStateForSlotIndex(${slotIndex}): ${res}`)
|
|
|
|
|
+ return res
|
|
|
|
|
+ }
|
|
|
|
|
+ SubscriptionController.getPhoneNumberFromFirstAvailableSource.overload(
|
|
|
|
|
+ 'int',
|
|
|
|
|
+ 'java.lang.String',
|
|
|
|
|
+ 'java.lang.String'
|
|
|
|
|
+ ).implementation = function (subId, callingPackage, callingFeatureId) {
|
|
|
|
|
+ const res = this.getPhoneNumberFromFirstAvailableSource(subId, callingPackage, callingFeatureId)
|
|
|
|
|
+ Log.i(
|
|
|
|
|
+ `SubscriptionController.getPhoneNumberFromFirstAvailableSource(${subId}, ${callingPackage}, ${callingFeatureId}): ${res}`
|
|
|
|
|
+ )
|
|
|
|
|
+ return res
|
|
|
|
|
+ }
|
|
|
|
|
+ const SubscriptionInfo = Java.use('android.telephony.SubscriptionInfo')
|
|
|
|
|
+ SubscriptionController.getActiveSubscriptionInfoList.overload('java.lang.String').implementation = function (
|
|
|
|
|
+ callingPackage
|
|
|
|
|
+ ) {
|
|
|
|
|
+ const res = this.getActiveSubscriptionInfoList(callingPackage)
|
|
|
|
|
+ Log.i(`SubscriptionController.getActiveSubscriptionInfoList(${callingPackage})`)
|
|
|
|
|
+ return res
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ SubscriptionController.getActiveSubscriptionInfoList.overload(
|
|
|
|
|
+ 'java.lang.String',
|
|
|
|
|
+ 'java.lang.String'
|
|
|
|
|
+ ).implementation = function (callingPackage, callingFeatureId) {
|
|
|
|
|
+ const res = this.getActiveSubscriptionInfoList(callingPackage, callingFeatureId)
|
|
|
|
|
+ Log.i(`SubscriptionController.getActiveSubscriptionInfoList(${callingPackage}, ${callingFeatureId})`)
|
|
|
|
|
+ return res
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ SubscriptionController.getActiveSubscriptionInfoList.overload('java.lang.String').implementation = function (
|
|
|
|
|
+ callingPackage
|
|
|
|
|
+ ) {
|
|
|
|
|
+ const res = this.getActiveSubscriptionInfoList(callingPackage)
|
|
|
|
|
+ Log.i(`SubscriptionController.getActiveSubscriptionInfoList(${callingPackage})`)
|
|
|
|
|
+ return res
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ 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 res = this.getIccSerialNumberForSubscriber(subId, callingPackage, callingFeatureId)
|
|
|
|
|
+ Log.i(
|
|
|
|
|
+ `PhoneInterfaceManager.getIccSerialNumberForSubscriber(${subId}, ${callingPackage}, ${callingFeatureId}): ${res}`
|
|
|
|
|
+ )
|
|
|
|
|
+ return res
|
|
|
|
|
+ }
|
|
|
|
|
+ PhoneSubInfoController.getSubscriberIdForSubscriber.overload(
|
|
|
|
|
+ 'int',
|
|
|
|
|
+ 'java.lang.String',
|
|
|
|
|
+ 'java.lang.String'
|
|
|
|
|
+ ).implementation = function (subId, callingPackage, callingFeatureId) {
|
|
|
|
|
+ const res = this.getSubscriberIdForSubscriber(subId, callingPackage, callingFeatureId)
|
|
|
|
|
+ Log.i(
|
|
|
|
|
+ `PhoneInterfaceManager.getSubscriberIdForSubscriber(${subId}, ${callingPackage}, ${callingFeatureId}): ${res}`
|
|
|
|
|
+ )
|
|
|
|
|
+ return res
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+})
|