I am starting with learning and customizing SystemUI of AOSP.
I was wondering how to implement lockNow()
feature on click of an icon.
I have added that icon in qs_panel.xml
layout and trying to get that working on QSFragment.java
.
I know how to do in normal apps but not able to achieve it in SystemUI app.
If I directly call DevicePolicyManager.lockNow(0);
then it raises exception
java.lang.SecurityException: No active admin owned by uid 10036 for policy #3
now this exception means that the module shall act like admin in order to do so.
Ques: How to define policies for SystemUI module
so that I can use DevicePolicyManager.lockNow()
to get what I need.
Any help!!