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

Auto finish secure activities when the screen goes off #508

Merged
merged 1 commit into from
Feb 9, 2025

Conversation

MHShetty
Copy link
Member

@MHShetty MHShetty commented Feb 7, 2025

This PR would ensure that activities are auto-finished when the screen is off and the user is inactive (or the screen doesn't turn on) for a certain short duration

(and the user is inactive for a certain short duration)
@muhomorr
Copy link
Member

muhomorr commented Feb 7, 2025

SecureCaptureActivity isn't handled.

I think it's better to implement this behavior via application-level activity callbacks (Application.registerActivityLifecycleCallbacks()), which would avoid code duplication and would allow requiring that auto-finish is handled for all activities.

@MHShetty
Copy link
Member Author

MHShetty commented Feb 7, 2025

Hi @muhomorr,

We do not want to have this behavior for all activities of our application but rather only the secure ones where media could have been previously captured while the phone is in secure state and the main user wouldn't want anyone else to be able to view the captured media without having to unlock the phone.

SecureCaptureActivity captures a photo on behalf of another app but in secure mode. Finishing it would push the user back to the previous activity which can be undesirable behavior for the use case we're trying to support.

@muhomorr
Copy link
Member

muhomorr commented Feb 8, 2025

We do not want to have this behavior for all activities of our application but rather only the secure ones

I didn't mean to say that all activities should have auto-finishing behavior. I meant that adding an activity should require deciding up-front whether it has to be auto-finished. Otherwise it's quite likely that auto-finishing behavior will be missed for some future secure mode activity.

SecureCaptureActivity captures a photo on behalf of another app but in secure mode. Finishing it would push the user back to the previous activity which can be undesirable behavior for the use case we're trying to support.

Whole activity stack can be closed, not just the top activity. Also, commit title says "Auto finish secure activities", which I'm reading as "auto finish all secure activities".

@MHShetty
Copy link
Member Author

MHShetty commented Feb 8, 2025

I didn't mean to say that all activities should have auto-finishing behavior. [...] Also, commit title says "Auto finish secure activities", which I'm reading as "auto finish all secure activities".

Yes, I'm referring to all activities in the same context, we mainly want to apply this behavior for the activities where media could have been previously captured in secure mode and the main user wouldn't want anyone else to be able to view the captured media without having to unlock the phone (assuming someone else accesses the phone gets unlocked)

Whole activity stack can be closed, not just the top activity.

Yes, we are currently finishing all the activities in the stack when the screen turns off for a while.

I meant that adding an activity should require deciding up-front whether it has to be auto-finished. Otherwise it's quite likely that auto-finishing behavior will be missed for some future secure mode activity.

Yes, that's right, I'll push the changes for the same soon. Thanks for the feedback!

@thestinger thestinger merged commit a27b22f into GrapheneOS:main Feb 9, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants