GrapheneOS / os-issue-tracker

Issue tracker for GrapheneOS Android Open Source Project hardening work. Standalone projects like Auditor, AttestationServer and hardened_malloc have their own dedicated trackers.
https://grapheneos.org/
357 stars 21 forks source link

eSIM activation support and configuration #159

Closed ProactivePhilomath closed 2 years ago

ProactivePhilomath commented 4 years ago

I'm creating this issue to discuss and track the implementation of eSIM support in GrapheneOS.

This would be an enhancement for Pixel models 3, 3 XL, 3a and 3a XL.

DC7IA commented 4 years ago

Out of curiosity: What would need to be done for that?

Isn't that something available as source code?

thestinger commented 4 years ago

That's unknown at this point. Part of working on this is initial research into what would need to be implemented, what's already present, etc. and so far no one has shown interest in taking it on.

WaffleThief123 commented 4 years ago

I'm going to do some reading today into eSIM support, as this is pretty much a requirement for me to switch, and I finally have some time away from other projects of mine

WaffleThief123 commented 4 years ago

https://source.android.com/devices/tech/connect/esim-overview here is the documentation on the eSIM technology from AOSP.

WaffleThief123 commented 4 years ago

So it appears that you will need carrier applications to activate the eSIM technology, so yes one could work on adding support, but then it becomes your carrier's job to make it "Just Work"

I'm going to work on adding it to the requisite areas, and submit. We will see if it gets approved.

WaffleThief123 commented 4 years ago

Alright, I can't make hell nor high water of how to insert the eSIM listener, so I'm going to have to set this down.

freddytuxworth commented 4 years ago

This issue apparently confirms that the eSIM binaries depend on Play Services. A starting point/useful reference for an OSS implementation might be these Truphone repositories that implement at least some parts of the LPA and a UI for setup:

I'm not sure how complete they are though. I would be interested in supporting any development work on this, if anyone with more familiarity with android internals is interested in sharing the work.

jarrettlenox commented 3 years ago

Forgive me if it's not my place to chime in because I'm not an android developer, but I landed on this page because I was looking for a way to remove an installed eSIM (Google Fi) from a Pixel 4a. I forgot to remove it before I flashed GrapheneOS and then couldn't figure out how to remove it from GrapheneOS. Maybe there's a way that I missed, or another app that can, maybe it's because the API hasn't been implemented, I dunno. I did read through this page, https://source.android.com/devices/tech/connect/esim-overview, and while it's over my head, it got me thinking that it would be nice if it was possible to at least manage(remove) carrier-installed eSIMS from within GrapheneOS. I ended up re-flashing the factory image, using the reset options in system settings (this didn't work in GrapheneOS), and then re-flashing. Cheers and many thanks to all of the devs that make Graphene possible. It's great!

codebam commented 3 years ago

On my Pixel 3a I was able to setup eSIM on the stock factory image, then flash to GrapheneOS and enable D2DS (*#*#INFO#*#* in dialer). After rebooting with D2DS enabled I was able to get a signal using the already installed eSIM.

thestinger commented 3 years ago

The issue is not having an app for registration / configuration, not lack of OS support.

thestinger commented 3 years ago

Including the Google apps for this isn't an option. They're proprietary Google apps using Google services and with a hard dependency on Play services.

codedump commented 3 years ago

On my Pixel 3a I was able to setup eSIM on the stock factory image, then flash to GrapheneOS and enable D2DS (*#*#INFO#*#* in dialer). After rebooting with D2DS enabled I was able to get a signal using the already installed eSIM.

Also works on Pixel 4a and GrapheneOS of 2021-01-05. Thanks for the hint :-)

(For clarity, for other lurkers, here the steps explicitly: Install (google) stock ROM, set up eSIM, flash GrapheneOS as per installation guide, then enable D2DS using *#*#INFO#*#*).

codethief commented 3 years ago

@codebam @codedump Thanks for the instructions! Does your eSIM also work in combination with a physical SIM, i.e. in dual-SIM (DSDS) mode?

codedump commented 3 years ago

@codethief Yes, dual-sim works. I'm using it actively.

codedieum commented 3 years ago

On my Pixel 3a I was able to setup eSIM on the stock factory image, then flash to GrapheneOS and enable D2DS (*#*#INFO#*#* in dialer). After rebooting with D2DS enabled I was able to get a signal using the already installed eSIM.

Also works on Pixel 4a and GrapheneOS of 2021-01-05. Thanks for the hint :-)

(For clarity, for other lurkers, here the steps explicitly: Install (google) stock ROM, set up eSIM, flash GrapheneOS as per installation guide, then enable D2DS using *#*#INFO#*#*).

@codedump Sorry, but how to enable (D2DS) mode? I mean post dialing*#*#INFO#*#*, what option to enable? I get the following sshot

MrN1c3Guy commented 3 years ago

@codedump @codedieum I have the same issue. How to proceed?

codedump commented 3 years ago

@codedieum You're on the right path, that's a menu. Click on "Phone information" and then scroll down to "Enable DSDS" (about mid-page).

Cheers

MrN1c3Guy commented 3 years ago

@codedump Thanks!

codethief commented 3 years ago

On my Pixel 3a I was able to setup eSIM on the stock factory image, then flash to GrapheneOS and enable D2DS (*#*#INFO#*#* in dialer). After rebooting with D2DS enabled I was able to get a signal using the already installed eSIM.

Also works on Pixel 4a and GrapheneOS of 2021-01-05. Thanks for the hint :-)

(For clarity, for other lurkers, here the steps explicitly: Install (google) stock ROM, set up eSIM, flash GrapheneOS as per installation guide, then enable D2DS using *#*#INFO#*#*).

I can confirm that this also works on the Pixel 5 and GrapheneOS 2021.03.19, including the dual SIM mode.

PSA: Once I had it working, I made the mistake of hitting the "disable SIM" toggle for the eSIM in the network settings. (My plan was to disable the eSIM for a second to see whether the physical SIM is fully functional, too.) Unfortunately, the eSIM then disappeared completely and it seems there is no way of undoing this, short of re-flashing GrapheneOS. (I tried disabling and re-enabling DSDS, among other things.) So be careful. :)

SatelliteSnyper commented 3 years ago

I would like to put up 0.2 BTC as bounty [== $11000] 1 BTC as bounty for development of eSIM support / LPA without needing to use stock Google Android.

Is it OK to send to the GrapheneOS donation address for escrow?

thestinger commented 3 years ago

No, sending money there is simply a donation to the project.

SatelliteSnyper commented 3 years ago

If escrow is not possible I can hold onto it, OK for me 😎. Was just trying to prove that I'm not going to stiff the developers on the payment.

SatelliteSnyper commented 3 years ago

Proof of solvency (for bitcoin-qt - File - Verify message)

Lackshan commented 3 years ago

@SatelliteSnyper @thestinger I've done a little research into eSIM support. It appears that an LPA needs to be created. This is a system app that handles communication between the eUICC (eSIM) chip and the carrier's servers (SM-DP+).

Additionally, an LPA UI or Carrier App must be created in order to install/manage subscription profiles.

I'm happy to take a crack at this but I've been unable to find a contributors guide (sorry!). Anyone mind linking me to it?

Edit: Found the guide.

Lackshan commented 3 years ago

An update: I've setup my AOSP/GOS build environment and ordered a Pixel 4a to use for testing. I've started work on the LPA but I'll only know if it works once I get my test device. It should arrive within the next week.

SatelliteSnyper commented 3 years ago

@Lackshan

Can we do something to help you?

If you have done partial work but you can not continue, I'll surely make a partial payment to you when you upload it for other developers to follow in your footsteps.

Juretsky commented 3 years ago

On my Pixel 3a I was able to setup eSIM on the stock factory image, then flash to GrapheneOS and enable D2DS (*#*#INFO#*#* in dialer). After rebooting with D2DS enabled I was able to get a signal using the already installed eSIM.

Thanx! On the Pixel 3A XL it works! The second, plastic, sim card works too

Lackshan commented 3 years ago

@SatelliteSnyper Sorry for not updating you sooner. Yes, I have hit an obstacle: PackageManager reports that my Pixel 4a does not have the FEATURE_TELEPHONY_EUICC feature and I am unsure how to get it to work. If someone can help me figure this out, I'll be able to resume development.

I'll upload everything I have this weekend once I'm free.

thestinger commented 3 years ago

You have to enable the feature via the usual feature configuration if you're providing it. You can look at how that's done in ProtonAOSP in the device repositories.

moodguru-arch commented 3 years ago

I'm unable to contribute to this on a technical level but I'm happy to offer any testing on my GOS pixel 5 if this helps.

beaking96 commented 3 years ago

Is anyone brave enough to try airplane mode with the esim?

codedump commented 3 years ago

Is anyone brave enough to try airplane mode with the esim?

Err, with release GrapheneOS? Yes. I'm doing it all the time. Seems to work (i.e. the signal strength bars disappear, for both the esim.and the regular sim). I haven't gotten into any more detailed investigation, but if there's anything you want me to try, I'll be happy to oblige :-)

orgua commented 3 years ago

now that GrapheneOS got the sandboxed playservices, would it be possible to integrate the apps that can transfer the SIM to eSIM?

thestinger commented 3 years ago

We aren't integrating privileged Google apps/services into the OS.

Lackshan commented 3 years ago

@thestinger Do you mean this file: https://github.com/ProtonAOSP/android_device_google_sunfish/blob/57b74a5c4d99fd73cb1b3fdf144ef405afd9600c/overlay/frameworks/base/core/res/res/values/config.xml ?

Because GOS appears to use a similar config and I can't see how ProtonAOSP has enabled EUICC.

thestinger commented 3 years ago

No, I don't mean that.

This issue should only be used to discuss implementing an eSIM activation app for GrapheneOS.

kalGITHUB commented 3 years ago

https://github.com/ProtonAOSP/android_device_google_sunfish/blob/57b74a5c4d99fd73cb1b3fdf144ef405afd9600c/overlay/frameworks/base/core/res/res/values/config.xml

<string-array translatable="false" name="config_telephonyEuiccDeviceCapabilities">
    <item>"gsm,11"</item>
    <item>"utran,11"</item>
    <item>"cdma1x,1"</item>
    <item>"hrpd,3"</item>
    <item>"ehrpd,12"</item>
    <item>"eutran,11"</item>
</string-array>

Lines 324 is what you're lookin for?

I'm about to try to manually install various system apps from the Pixel 5 Redfin Image related to SIM management, EUICC, connectivity, etc. on GOS until I get it to work. MTF

thestinger commented 3 years ago

It likely has to be a privileged app built into the OS. That's the problem.

kalGITHUB commented 3 years ago

Just to add context to the low hanging fruit options.

I fully configured my Google Fi services in the Pixel 5 w/ eSIM on Google's Android. Then flashed Graphene OS using the web installer.

First thing I did was install the Google Services Compatibility Layer provided by Daniel.

Then, I installed the following apps pulled from my Google Pixel 5 on Google's Android using AEE (APK Explorer and Editor) from F-Droid:

Adaptive Connectivity Services.apk Carrier Provisioning Service.apk Carrier Services.apk Carrier Settings.apk Carrier Setup.apk com.android.connectivity.metrics.App.apk Google Connectivity Services.apk Google Fi.apk Google Fi Support.apk SIM Manager.apk SIM Toolkit.apk

I gave all apps full permission and ability to change system setting if able. Still nothing happened with Google Fi activation. It kept telling me to check my settings. All this is to reinforce the importance of it being a privileged app.

*#*#INFO#*#* turn on D2DS.

Reboot.

What works on the surface:

  1. Cellular data
  2. Sending/Receiving SMS
  3. Receiving notifications about MMS
  4. Cannot send nor received MMS

I am going to try to manually input APN setting in the GOS Messaging app because the Messaging app has the ability to see the APN settings associated with the eSIM. Maybe it can push the applicable settings needed.

Again, the is just to add context to the overall conversation.

Screenshot_20210828-094648

Screenshot_20210828-094552

kalGITHUB commented 3 years ago

Reporting unexpected behavior after I factory reset GOS.

So I'm essentially at the same state as if I have fully activated my eSIM on stock Redfin. Then flashed graphene. Turned on D2DS rebooted.

Without installing any Google anything, I can now view the Google Fi carrier settings in the Settings app. I hadn't done this before I installed Google services before. The only thing is that the status bar says I am roaming instead of saying LTE. SMS works, data works, no MMS. APN Settings are present.

There is some conflict between Google Services and the Carrier information when I have eSIM for Google Fi on GOS.

cloudcosmonaut commented 3 years ago

@kalGITHUB thanks, mate! This list helped me get my eSim working by just downloading the requirements from apk mirror! I don't use Google Fi though.

1 small note, I had to enable DSDS not D2DS.

Lackshan commented 3 years ago

@kalGITHUB Thanks! That config appears to already be in GOS though.

@thestinger I asked because I am trying to create an eSIM activation app. Also you're right, it has to be a privileged app built into the OS.

theTaikun commented 3 years ago

Question for those who have eSIM working: After activating eSIM and flashing GOS, is it possible to switch eSIMs (or add additional eSims)? Or is that part of the activation problem that's being worked through?

codebam commented 3 years ago

@theTaikun as far as I know you can't add more eSIMs after flasing GOS because there's no setup. You should be able to switch between existing eSIM, but I haven't tried it.

thecankaya commented 3 years ago

Is there any update mates? I need that feature but I don't want to use stock image then flash. It's not a good way to make something work. We should be able to do it in GOS directly.

Any good news would be amazing!

thestinger commented 3 years ago

If there's news it will be posted here. Don't need to ask about it.

thecankaya commented 3 years ago

What is priority of that feature? I would like to be do good donation as Snyper did. I cant use my GOS because of no esim support. As a digital nomad, its an important feature for me.

thestinger commented 3 years ago

The activation app appears to be quite complex so it's unrealistic to get it implemented any time soon since we aren't going to bundle the privileged Google activation app based on their services.

logicalup commented 3 years ago

while i'd like to have full support of esim asap, maybe for now someone can point me how to disable or delete an esim without having to reflash os? (i was able to add an esim before flashing gos, but now i can't deactivate it nor delete it) And it took me days to get everything moved and setup on gos, so reflashiing is really not a choice.

thestinger commented 3 years ago

Deleting it will be supported in Android 12.