LibreShift / red-moon

Android screen filter app for night time phone use.
GNU General Public License v3.0
650 stars 81 forks source link

add proton mail (pin login) to the secure apps #165

Closed emanresusername closed 7 years ago

emanresusername commented 7 years ago

assuming it'd be something around here but not sure how the "pin entry screen only" aspect plays into that :confused:

smichel17 commented 7 years ago

That is indeed the right place. Right now we just do it based on the open app; I'm not sure if there's a way to differentiate based on which screen is open -- if there is, it would be in the usage stats or activity manager apis. I might be able to do this in the next hour; if not it'll be tomorrow night.

emanresusername commented 7 years ago

cool i believe the id for the app is ch.protonmail.android and just to clarify if this is intended behavior or a fluke after the pause for secure apps thing triggers, pulling down the notifications pulldown from the top of the screen unpauses it again? (seemed to be the behavior on my device in supersu) asking cause if there's no quick easy way to reenable after the initial pause to login, might actually do more harm than good, as i imagine most users would want the filter back on again once they're in the inbox

smichel17 commented 7 years ago

Current behavior: Every second, check the active app. If it is a secured app, pause the filter if it is currently running. If it's a different app, resume. Exception: if the app is Red Moon, do nothing -- that's because when the notification drawer is pulled down, Red Moon is reported as the active app, even though it doesn't feel that way to the user, so we take no action in that case.

I agree this is not a great behavior (pause once would make more sense).

Any app can actually send an intent to pause Red Moon. So, another option is that Proton Mail could tell Red Moon to pause during that screen -- you could file A bug on the end, for that. I don't believe any app has used this except some individuals have done it via Tasker.

Likely this is because the intent is Red Moon specific. I'd be interested in a more general solution (eg, working with other overlay apps and/or Android folks to standardize the intent), but I'm not quite sure where to start and a bit tight on bandwidth right now, so I'm not going to take initiative to try to figure that out.

emanresusername commented 7 years ago

yeah fair 'nuff it's no too painful to pause and unpause from the pull down and probably less net frustration than having it turn off again every second after logged in 😅 will leave open for somebody else on the interwebz find and chime in, but also no hard feelings if y'all wanna close this out 👍

smichel17 commented 7 years ago

I think we should show a toast when the user opens proton mail, letting them know they'll need to pause Red Moon to enter their pin, or something like that*. I'll leave this open pending #166.

*I'm also curious on your opinion -- if we could take any action when proton mail is open, what would you prefer? "Take an action once, when the app is first opened", "do it every so often", and even a custom pattern -- nothing is off the table (yet).

smichel17 commented 7 years ago

@emanresusername I'm going to show a toast when the app is first opened. How often would you like or expect to see it?

emanresusername commented 7 years ago

After some brief playing around with it just now, shooting from the hip, i'd say everytime you open the app It seems like last pass can detect if it's on the pin entry field or already unlocked and show/not show appropriately, so that'd be ideal if that's possible? But also i know Jon Snow level nothing about what that would take to implement so i might be pulling one of these asking for that 😅 xkcd tasks

smichel17 commented 7 years ago

It seems like last pass can detect if it's on the pin entry field or already unlocked and show/not show appropriately, so that'd be ideal if that's possible?

That's interesting. I'm not sure how they're doing it. But, I also haven't read through the relevant docs yet, so I'll have to put that on my reading list. This is likely the park, not the bird, unless lastpass is relying on undocumented behavior, in which case all bets are off.

smichel17 commented 7 years ago

Okay. Implementing will be a little time consuming but pretty easy on pre-Lollipop and not too much harder afterwards. However, since we maintain secure app logic manually, adding more detailed logic (particularly, relying on the internals of other apps) is a bit more of a maintenance burden than I want to shoulder right now.

I made #174 to track it for later. There's only so much a screen filter can do, and I hope to be feature complete by early next year (or, more realistically, the end of next year). At that point I'll reconsider #174. I'll close this issue when I add the toast.

smichel17 commented 7 years ago

Adding a toast currently causes monitoring to stop silently (and the toast is not displayed). I suspect the handler is not running on the ui thread same Looper as the scheduler and blocking it or something.

Anyway, aside from figuring out that weirdness, this is complete (also, trivial).

smichel17 commented 7 years ago

@emanresusername I added the toast each time you open proton mail while red moon is running, mostly because that option was the easiest :P

I suspect this will get annoying rather quickly. If it does, let me know (here or in a new issue) and we can change to one of the other options.