You can determine the package name for any Activity that comes to the forefront by analyzing 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 the ActivityManager line).
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 Activity initial screen is com.android.launcher
However, when I click the "Nexus 4 Home Page" button to show the lock screen from any application, it never shows another action that starts. This makes me think that this is not what we understand as a typical Activity .
If you look at the source of the Android source code for KeyguardViewMediator.java , you will find a method called private void doKeyguardLocked(Bundle options) . From experience, I know that changing the source to immediately return from this method will disable the screen lock. The source for KeyguardViewMediator.java shows that it is in the com.android.keyguard package, and I believe that this is the package you are looking for.
As for getting the package name dynamically, this is not possible for me. But, if you already know the name of the package ahead of time, then there is no need to receive it dynamically.
Hope this helps.
source share