Skip to content

Commit

Permalink
Kiosk mode - use saved flag about filtering events only once - clear …
Browse files Browse the repository at this point in the history
…it after read
  • Loading branch information
dmitrys committed Dec 27, 2024
1 parent 2cc9746 commit 019d876
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,13 @@ public void onReceive(Context context, Intent intent){
//Toast.makeText(this, "Accessibility Service connected", Toast.LENGTH_LONG).show();

Log.d(TAG, "Accessibility service connected");
kioskEnabledWithStart = KioskManager.GetKioskModeEnabledFilteringEventsOnStart(getApplicationContext());
try {
kioskEnabledWithStart = KioskManager.GetKioskModeEnabledFilteringEventsOnStart(getApplicationContext());
KioskManager.ClearAdvencedKioskSettings(getApplicationContext());
} catch(Exception e) {
Logger.E(TAG, "Exception in AccessibilityService : " + e.getMessage() + "\n");
e.printStackTrace();
}
Log.d(TAG, "kioskEnabledWithStart: " + ( kioskEnabledWithStart ? "true" : "false" ));

}
Expand All @@ -115,7 +121,7 @@ public static boolean getStatus(){
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
try {


if (event == null) {
Logger.T(this.TAG, "===================== onAccessibilityEvent ====================");
Expand Down Expand Up @@ -143,7 +149,7 @@ public void onAccessibilityEvent(AccessibilityEvent event) {
event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED)
{

kioskEnabledWithStart = KioskManager.GetKioskModeEnabledFilteringEventsOnStart(getApplicationContext());
//kioskEnabledWithStart = KioskManager.GetKioskModeEnabledFilteringEventsOnStart(getApplicationContext());

if( ( kioskEnabledWithStart || KioskManager.getKioskModeStatus() ) &&
event.getPackageName() != null &&
Expand Down

0 comments on commit 019d876

Please sign in to comment.