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/
352 stars 19 forks source link

Charging mode boots into regular OS #3590

Open unrooted opened 4 months ago

unrooted commented 4 months ago

I'm having a small, but notable issue with my Pixel 8 Pro, if I turn off USB-C via Security tab in Settings, turn off the phone and plug it into charger, the phone powers on automatically (even tho changes in the settings should allow charging only when turned off, which makes me a little bit confused)

Is it normal? Maybe it's related to some battery settings?

I'm running latest stable.

thestinger commented 4 months ago

When you plug the powered off phone into a charger, it boots into charging mode. The USB-C port control in the OS sets the mode that's used for the OS being booted into the regular mode. It doesn't apply to charging mode, recovery mode or fastbootd mode.

unrooted commented 4 months ago

@thestinger hi, thanks for the reply

the issue is - it doesn't go into charging mode when turned off and pluging to a charger, it boots into full OS

unrooted commented 4 months ago

@thestinger plz find the video of the behavior observed attached: https://streamable.com/fpxdwh

matchboxbananasynergy commented 4 months ago

I am unable to reproduce this on a Pixel 6 with the latest version of the OS with both the "charging-only when locked, except before first unlock" setting, as well as the "off" setting. It would be good for someone with an 8th gen Pixel to confirm.

FID02 commented 4 months ago

Non-Pro Pixel 8. I followed the steps in the video that the OP posted, but I can't reproduce. When the USB-C port is set to off and the phone is powered off, plugging in the charger will show the yellow boot state screen and then boot into charging mode. Perhaps other settings are interfering here, or perhaps only reproducable with a Pro?

unrooted commented 4 months ago

@matchboxbananasynergy @FID02 thanks for your insight into this issue

I've factory resetted my phone, I haven't changed a single setting, except for turning off usb-c port obviously, however, the issue still persists when I turn off the phone, it boots into full GOS again, so I suppose we can exclude the possible reason being behind some weird setting I might have changed previously.

surfaceflinger commented 4 months ago

Can reproduce on panther running 2024052100

matchboxbananasynergy commented 4 months ago

It would be great to see if devices that this happens on also have this happen when stock OS is installed. It would be good to confirm whether it's OS specific or not.

oppressor1761 commented 4 months ago

P8P can NOT reproduce

matchboxbananasynergy commented 4 months ago

This is just a theory but I wonder if it's just a device defect for some small minority of devices?

oppressor1761 commented 4 months ago

My model is g1mnw. It just enter charging mode.

x5444 commented 4 months ago

This behavior is caused by a bootloader variable named off-mode-charge. You can check the current state via fastboot getvar off-mode-charge.

If the variable is set to 1, the phone will enter charging mode when plugged in from off. If it is set to 0, the phone will simply boot into OS instead.

I'm not sure what causes the state of this variable to flip. You can, however, set the preferred mode manually by fastboot oem off-mode-charge 0 to boot into OS automatically or fastboot oem off-mode-charge 1 to boot into charging mode when plugged in instead.

If possible, GrapheneOS Settings should set this to 1 when USB-C Mode is toggled to None.

unrooted commented 4 months ago

as @x5444 guided me on Discord, alongside HybridStaticAnimate user, and also given the suggestion from @matchboxbananasynergy I've done the following:

EDIT: please note that turning off usb-c via settings in GOS 'works', as it doesn't accept charge when the device is turned on, so I suppose the issue lies somewhere behind not going into the charging mode itself, rather than my initial thought that the issue was related to this feature

what is more, so far only @surfaceflinger replicated my ussue, but it was on a different model, which, at least to me, makes this even more interesting/weird

thestinger commented 3 months ago

Not really clear what is going on here and if it's normal behavior.

39750032 commented 2 months ago

Issue confirmed also for me, Pixel 7a. In my case, latest charge with phone turned off executed with success with the 2024062700 release.

With the release 2024070201 when I plug the powered off phone into a charger, it boots into full OS.

Not aware of this discussion, I've tried to use, instead of my original 30w google charger, also a standard usb charger but the issue persist.

So, after googling a bit, I've read this Issue and I've tried these steps:

fastboot oem off-mode-charge 1 OKAY [ 0.001s] Finished. Total time: 0.001s

fastboot getvar off-mode-charge off-mode-charge: 1 Finished. Total time: 0.000s

As last step I've tried to change all the options related to USB-C via Security tab in Settings but without success, also with the setting USB-C port Off (where the description says that: "Doesn't impact the separate charging mode, which is activated by turning off the device and plugging it into a charger") the phone boots into full OS.

Usually, when I can do it, I chose to charge the phone powered off during the night so I can confirm that, in my case, the issue has started with the latest release.

Unfortunately I can't confirm from which of the latest two release the issue has started (I've tried to charge the phone from power off only with the release 2024070201).

In the changes since the 2024070200 release, is reported this: "avoid skipping toggling USB port after unlock in certain edge cases to make sure devices connected while locked are always detected when unlocking"; could be that there is something related to settings or functioning of the USB-C port that cause this issue?

39750032 commented 2 months ago

Hi all, just to communicate that a factory reset has resolved the issue. I've waited the exit of a new release and then, with the issue always present, i've decided to try with the reset. Now the pixel 7a charges without problems from the powered off state and the draining of battery seems at the moment much better! Thankyou all for the support! I'll try to be present in future with direct tryouts to help with issues like this.

39750032 commented 2 months ago

Hi guys, the problem seems to be reproducible. Last week the phone died completely over the night, I didn't remember to put the charger in and so on, in the morning, after connecting the charger to the phone, the phone has booted directly into the regular operating system. After a full charge from regular OS, I tried to power off and execute a new try.. so, after connecting the charger, the phone has booted another time into the regular OS! So, I tried to execute a factory reset and as for the last time, the phone has returned to charge also from power off. After the factory reset I've tried to power on and subsequently charge the phone from power off with different levels of battery and in all battery levels (20%, 40%, 60%, etc), the phone has always charged from power off. So, to be sure and try to reproduce the issue, I've let completely discharge another time the battery and the issue is returned; the sadly reality is that the phone won't no more charge from the power off state. So, the issue seems to arise when the battery is completely depleted and after this, the phone no more charge from the power off state; only a factory reset can revert the situation, - but not definitively -. The more strange thing in all of this is that seems like that the OS takes memory of the complete battery discharge event and after that it can no longer go back to charging from the power off state. Pixel 7a - Version: 2024071600

Lopicl commented 3 weeks ago

Happened to me a couple times yesterday. Phone booted directly into full os when plugged in while turned off. This morning I tried again, and it instead booted correctly into charging mode. I don't know what caused that behavior.

Pixel Fold with 2024090400 build

THETCR commented 3 weeks ago

This issue applies to all Pixel phones with the stock OS. Have been able to reproduce this with a Pixel 7 Pro.

thestinger commented 3 weeks ago

Still not really clear what's happening here and why it only happens to certain users.