Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

device-info.sh not detecting phone number on Samsung A21, model: SM-G991U1, OS:14 #85

Open
jpage4500 opened this issue Mar 23, 2024 · 11 comments

Comments

@jpage4500
Copy link

What happened?

I have several test devices that don't log the phone number and I can't figure out why.. the confusing part is I have other devices (same device/OS/SIM/etc) which show the phone number fine.

The devices in question are all Samsung A21, model: SM-G991U1, OS:14

screenshot showing about screen for device in question. I can get a screenshot of another device that is able to fetch the phone number but it looks the same. I'm just wondering what could be different that would cause 1 to work and another not to

NOTE: I can help test any ideas/suggestions -- just let me know!

image

Version

1.5

Android version

14

Custom ROM

default

Relevant log output

No response

@ale5000-git
Copy link
Member

@jpage4500
Could you please post the result of every of these commands?

adb shell "service call iphonesubinfo 15 s16 'com.android.shell'"
adb shell "service call iphonesubinfo 16 i32 0 s16 'com.android.shell'"
adb shell "service call iphonesubinfo 16 i32 1 s16 'com.android.shell'"
adb shell "service call iphonesubinfo 16 i32 2 s16 'com.android.shell'"

@jpage4500
Copy link
Author

@ale5000-git

$ adb -s RFCT7103MGE shell "service call iphonesubinfo 15 s16 'com.android.shell'"
Result: Parcel(    00000000 00000000 00000000  '............')

$ adb -s RFCT7103MGE shell "service call iphonesubinfo 16 i32 0 s16 'com.android.shell'"
Result: Parcel(    00000000 ffffffff   '........')

$ adb -s RFCT7103MGE shell "service call iphonesubinfo 16 i32 1 s16 'com.android.shell'"
Result: Parcel(    00000000 ffffffff   '........')

$ adb -s RFCT7103MGE shell "service call iphonesubinfo 16 i32 2 s16 'com.android.shell'"
Result: Parcel(    00000000 00000000 00000000  '............')

@jpage4500
Copy link
Author

FWIW results from a different device (same hardware & carrier)

Result: Parcel(
0x00000000: 00000000 0000000b 00340031 00370031 '........1.X.1.7.'
0x00000010: 00300033 00360038 00380039 00000030 '3.0.8.X.X.X.X...')

Result: Parcel(	00000000 ffffffff   '........')

Result: Parcel(
0x00000000: 00000000 0000000b 00340031 00370031 '........1.X.1.7.'
0x00000010: 00300033 00360038 00380039 00000030 '3.0.8.X.X.X.X...')

Result: Parcel(	00000000 ffffffff   '........')

(I replaced some of the digits with X)

@ale5000-git
Copy link
Member

@jpage4500

I have added support for multiple slot in the script and done various improvements.
Could you please retry with version 2.0?

Please post the full output (with some parts covered) but enough to get the idea of what is working and what it isn't.

@jpage4500
Copy link
Author

Hi @ale5000-git -- thanks again for the changes! multiple device support works great! I did have to comment out the root/advanced checks as they caused the script to hang at one point as well as the wait_connection() and start_adb_server() methods. Not sure why but the devices aren't rooted anyway so I figured it wasn't necessary.

Here's the results from 2 devices - 1 that works and another that doesn't. The only differences I noticed between all of them is Kernel version and Device path. Other than that not much difference.

device 1:

BASIC INFO

Manufacturer: samsung
Model: SM-G991U1
Device: o1q
Android version: 14
Kernel version: 5.4.233-qgki-27920445-abG991U1UESAFXAB
Device path: 0-4

Serial number: RFCT7103MGE
�[0;33mWARNING: CPU serial number not found�[0m

Android ID: d14a411e4b4XXXXX

Physical size: 1080x2400
Physical density: 480

SLOT INFO

Slot count: 2

SLOT 1
Slot state: LOADED
IMEI: 3523352899XXXXX
Operator: AT&T
�[0;33mWARNING: Line number not found�[0m

SLOT 2
Slot state: NOT_READY
IMEI: 3552178299XXXXX
Operator: 
�[0;33mWARNING: Line number not found�[0m

DEFAULT SLOT
IMEI: 3523352899XXXXX
IMEI SV: 38
ICCID: 890128043310464XXXXX
�[0;33mWARNING: Line number not found�[0m

device 2:

BASIC INFO

Manufacturer: samsung
Model: SM-G991U1
Device: o1q
Android version: 14
Kernel version: 5.4.233-qgki-27920445-abG991U1UESAFXAB
Device path: 0-1.2.3.1

Serial number: RFCT7103N6M
�[0;33mWARNING: CPU serial number not found�[0m

Android ID: da861077259XXXXX

Physical size: 1080x2400
Physical density: 480

SLOT INFO

Slot count: 2

SLOT 1
Slot state: LOADED
IMEI: 3523352899XXXXX
Operator: AT&T
�[0;33mWARNING: Line number not found�[0m

SLOT 2
Slot state: NOT_READY
IMEI: 3552178299XXXXX
Operator: 
�[0;33mWARNING: Line number not found�[0m

DEFAULT SLOT
IMEI: 3523352899XXXXX
IMEI SV: 38
ICCID: 890128043310464XXXXX
Line number: 177545XXXXX

Let me know if you can think of anything else I can try

@ale5000-git
Copy link
Member

@jpage4500
I see that it say Line number not found on SLOT 1 even in the phone where it works so there must be an issue.
Although in most cases iphonesubinfo follow the AOSP code there may be some OEMs that variate it.

The better thing to discover the problem is to see the output of all queries, with this code:

for i in $(seq 22); do
  echo "${i:?}:"
  adb shell "service call iphonesubinfo ${i:?} s16 'com.android.shell'"
done

Could you please send the result of that?
If you don't want to post it here publically, you can send me a private message here: https://xdaforums.com/m/ale5000.5627087/

@jpage4500
Copy link
Author

@ale5000-git - I just sent a PM with details; thanks again!

@ale5000-git
Copy link
Member

ale5000-git commented Apr 10, 2024

@jpage4500
Hi,
the phone commands appear to be the same as AOSP but the line number is not returned anywhere.
I have found this: https://stackoverflow.com/questions/52041818/get-phone-number-from-sim-card-with-telephonymanager
which says: getLine1Number(); returns whatever is stored on the SIM card's MSISDN, which isn't filled by some operators.
So I don't think there is any reliable way to get it.


@jpage4500

  1. Could you please try the version 2.7 to see if it still hangs?
  2. What is the problem with start_adb_server()? This is very important otherwise the messages of the starting adb will become part of adb devices and it may break the parsing.
  3. I would also like to know if now (in the phone where it worked) the line number appears correctly on both DEFAULT SLOT and SLOT 1.

I made these changes to the script:

  • The code now, if it sees an offline device, waits a maximum of 5 seconds to see if it comes back online otherwise it will skip it;
  • I rewrote the root and wait code so now it should NO longer hang;
  • Added privacy mode with -p parameter to anonymize sensitive data;
  • Added DEBUG=1 env to include a copy of errors and warning (without color codes) inside STDOUT when redirected to a file.

So now you could get perfect debug output with:
DEBUG=1 device-info.sh -p > output.txt

@jpage4500
Copy link
Author

very cool - thanks. I'll give it a shot

@jpage4500
Copy link
Author

the updated script works great! I ran it with lots of devices connected and no issues

I agree it's probably not possible to get the phone number for some of these devices although I am very curious to figure out why.

Here's a device that doesn't return a number:

BASIC INFO

Manufacturer: samsung
Model: SM-G991U1
Device: o1q
Android version: 14
Kernel version: 5.4.233-qgki-27920445-abG991U1UESAFXAB
Device path: 0-1.3.1.4

Serial number: RFCT7000XXX

Android ID: 73a18a000ff0f0ff

Display size: 1080x2400
Display density: 480

SLOT INFO

Slot count: 2

DEFAULT SLOT
IMEI: 352335000000000
IMEI SV: 38
ICCID (SIM serial number): 89012800000000000000

SLOT 1
Slot state: LOADED
IMEI: 352335000000000
Operator: AT&T

SLOT 2
Slot state: NOT_READY
IMEI: 355217000000000

ADVANCED INFO (root may be required)



EFS INFO (root may be required)

Here's another one which does:

BASIC INFO

Manufacturer: samsung
Model: SM-G991U1
Device: o1q
Android version: 14
Kernel version: 5.4.233-qgki-27920445-abG991U1UESAFXAB
Device path: 0-1.2.4.2

Serial number: RFCT7000XFX

Android ID: d2cfd700000000f0

Display size: 1080x2400
Display density: 480

SLOT INFO

Slot count: 2

DEFAULT SLOT
IMEI: 352335000000000
IMEI SV: 38
ICCID (SIM serial number): 89012800000000000000
Line number: 14173000000

SLOT 1
Slot state: LOADED
IMEI: 352335000000000
Operator: AT&T

SLOT 2
Slot state: NOT_READY
IMEI: 355217000000000
Line number: 14173000000

ADVANCED INFO (root may be required)



EFS INFO (root may be required)

@ale5000-git
Copy link
Member

ale5000-git commented Apr 11, 2024

From what I have read they say that it is the operator who can choose whether or not to write the number on the SIM.
If you want to be sure you can swap the SIM from the device where it doesn't work to the device where does it work to see if the problem follow the SIM.
I also read that on some older Android phones you can manually write the number where it says "Your number" and it will be written on the sim (but I can't confirm this).

Current problems:

  1. I don't see any warning, did you include DEBUG=1 in the command?
    If you included it, this may be another compatibility issue to check for.

  2. I also see that on the phone where it gets the phone number, he puts it in the wrong slot.
    This is an annoying problem, I will try to do some tests in the emulator to try if I can reproduce the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants