From 019d8763002b75d230f8646dd63999cd3d0bf71e Mon Sep 17 00:00:00 2001 From: Dmitry Soldatenkov Date: Fri, 27 Dec 2024 07:14:19 +0300 Subject: [PATCH] Kiosk mode - use saved flag about filtering events only once - clear it after read --- .../rhodes/kioskservices/MyAccessibilityService.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/MyAccessibilityService.java b/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/MyAccessibilityService.java index b2bac3ff6a..666fa9ff9e 100644 --- a/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/MyAccessibilityService.java +++ b/platform/android/Rhodes/src/com/rhomobile/rhodes/kioskservices/MyAccessibilityService.java @@ -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" )); } @@ -115,7 +121,7 @@ public static boolean getStatus(){ @Override public void onAccessibilityEvent(AccessibilityEvent event) { try { - + if (event == null) { Logger.T(this.TAG, "===================== onAccessibilityEvent ===================="); @@ -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 &&