Skip to content

Open a card from the lockscreen widget without unlock#3091

Open
hipgnose wants to merge 4 commits intoCatimaLoyalty:mainfrom
hipgnose:feature/lockscreen-card-viewing
Open

Open a card from the lockscreen widget without unlock#3091
hipgnose wants to merge 4 commits intoCatimaLoyalty:mainfrom
hipgnose:feature/lockscreen-card-viewing

Conversation

@hipgnose
Copy link
Copy Markdown

To open the activity over the lockscreen we can't use the setShowWhenLocked(true), we need to define the activity manifest as showWhenLocked=true, as stated in the Android Developers FAQ.

This PR adds the manifest configuration needed to open the activity and disable/hide the activity if the user chose DisableLockscreenWhileViewingCard setting

In the first commit I was finishing the activity if DisableLockscreenWhileViewingCard was off and the lockscreen was up, but I figured out that we can just call showWhenLocked(false) and the activity is sent to behind the lockscreen again.

Notes:

  • I tested this in my device and it works without glitches or activities jumping around.
  • I didn't use any llm, bot, code agent or something like that, for this or anything in my life.
  • Only the test startWithLoyaltyCardNoExpirySetExpiry is failing for me, it says it expected April 22 but receives April 21, I don't know why but maybe it 's something with my timezone?

Fixes #2916

@TheLastProject
Copy link
Copy Markdown
Member

Only the test startWithLoyaltyCardNoExpirySetExpiry is failing for me, it says it expected April 22 but receives April 21, I don't know why but maybe it 's something with my timezone?

Yeah, known issue. See #2124 and #2460

Do you have any idea how I can test this change btw? Fairphone 6 doesn't seem to have lock screen widgets and neither does the Android 17 emulator in Android Studio.

@hipgnose
Copy link
Copy Markdown
Author

This is tricky and I still don't have a good answer for you, I'll add here what I found primarily for documentation.

  • The Android Developers FAQ says that we can test with Android versions after 16 QPR1 and that it's available in Pixel Tablets link to the FAQ.

  • There is also a Pixel Tablet support page showing how to enable lock screen widgets with the "Hub Mode" link to Support

  • I tried some emulators with aosp 36.0, with CinnamonBun Preview, even the Pixel Tablet emulator with 36.1 and 37.0 (with gplay) and couldn't find a way to enable the lock screen widgets or the mentioned Hub Mode. The developer options feature flags also don't have a flag to enable it.

So for now I can only test this with my device (GrapheneOS) and don't know how you can reproduce and test.

I can try to run the GrapheneOS in the emulator, do you think it would work for you? I don't know another Android build with the lock screen widgets feature enable /:

@hipgnose
Copy link
Copy Markdown
Author

I was looking for a way to test but I don't think there is an emulator build available for GrapheneOS, so one step would be to actually build the image and I think it's too much to ask haha

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.

Allow opening card from lock screen widget without device unlock

2 participants