I need to get package name of android lock screen activity. I have googled found nothing except https://stackoverflow.com/a/16881064/2803557 which doesn't seem to work.
Is there any way to get lock screen package name
You can determine the package name for any Activity
that comes to the foreground by analyzing the Android logs. For example, if you have Google Maps open, clicking on the device's Home button will show this in the log (I usually filter by the ActivityManager
string).
START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME]
flg=0x10200000 cmp=com.android.launcher/com.android.launcher2.Launcher}
Which shows you that the package name of the home screen Activity
is com.android.launcher
However, when I click my Nexus 4 home button to show the lockscreen from any app, it never shows another Activity being launched. This makes me think that it's not what we understand as a typical Activity
.
If you look at the source for KeyguardViewMediator.java the Android source code, you will find a method named private void doKeyguardLocked(Bundle options)
. I know from experience that changing the source to return immediately from this method will disable the lockscreen. The source for KeyguardViewMediator.java
shows that it is in the package com.android.keyguard
, and I believe that this is the package that you are looking for.
As for getting the package name dynamically, it doesn't seem possible to me. But, if you already know the package name ahead of time, then there's no need to get it dynamically.
I hope this helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With