Understanding custom lock implementation on Androi

2020-03-03 08:16发布

问题:

I've been researching about this question a lot. I asked a related question this week.The most helpful and relevant links in the area are this and this. I want to understand how it works and all, if implemented as home screen replacement app.

Quick questions:

  • If implemented which screen should be set as default? Our home screen replacement or original home screen?
  • Please read the comments after the answer of this question where asker figured out a way to do it. In the end he says:

    "Figured it out! Gotta disable the manifest intent filter by using setComponentEnabledSetting(), and then turn it back on when the activity pops up. Thanks for your help!"

What exactly does this mean? I don't quite understand the logic here. Please help?

  • Basically, I have same doubts as this asker (please see the comments below the answer by @CoffeeCrisp). But, I am unable to understand the solution and what exactly happened in here. Please help?

Thanks.

Edit: Please don't downvote it. If there's an improvement required from my end, please suggest in the comment so that I get time to make changes. Thanks so much.

回答1:

  1. If you implemented a home screen replacement app, your app should be set as the default launcher/home screen.

  2. setComponentEnabledSetting() allows you to override the intent filters in the manifest and essentially disable them. It sounds like he overrode the filter for the launcher intent after the user unlocked so he could get the default home screen to show up.

That being said, I don't recommend writing a lock screen replacement, there are too many issues, it's hacky and insecure. Focus on lock screen widgets.