Skip to content

Commit

Permalink
add check launcher for accessibility event
Browse files Browse the repository at this point in the history
  • Loading branch information
dimahts990 committed Dec 26, 2024
1 parent 961be4a commit 2cc9746
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import com.rhomobile.rhodes.extmanager.RhoExtManager;
import com.rhomobile.rhodes.kioskservices.IKioskMode;
import com.rhomobile.rhodes.kioskservices.KioskManager;
import com.rhomobile.rhodes.kioskservices.MyAccessibilityService;
import com.rhomobile.rhodes.kioskservices.PermissionManager;
import com.rhomobile.rhodes.mainview.MainView;
import com.rhomobile.rhodes.mainview.SimpleMainView;
Expand Down Expand Up @@ -453,9 +454,9 @@ protected void onCreate(Bundle savedInstanceState) {
} else {
IS_RESIZE_SIP = false;
}
}
}

requestPermissions();
requestPermissions();
}


Expand Down Expand Up @@ -1044,6 +1045,8 @@ public void startKioskMode(boolean use_overlay) {
KioskManager.ClearAdvencedKioskSettings(mContext);
}

MyAccessibilityService.disabledCheckLauncher();

if (mIsUseOverlay) {
PerformOnUiThread.exec(new Runnable() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import com.rhomobile.rhodes.webview.RhoInputListener;
import com.rhomobile.rhodes.Logger;

import com.rhomobile.rhodes.kioskservices.PermissionManager;


public class MyAccessibilityService extends AccessibilityService {

Expand All @@ -37,10 +39,16 @@ public class MyAccessibilityService extends AccessibilityService {
private static List<String> ignorePackets = null;
private static boolean isEnabled = false;

private static boolean isCheckLauncherAfterAccessibilityEvent = true;

public static void setPowerProcessing(boolean value) {
isPowerProcessing = value;
}

public static void disabledCheckLauncher(){
isCheckLauncherAfterAccessibilityEvent = false;
}

public static void setIgnoreEventsFromPackets(String packets){
try {
ignorePackets = Arrays.asList(packets.split(";"));
Expand Down Expand Up @@ -107,7 +115,7 @@ public static boolean getStatus(){
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
try {


if (event == null) {
Logger.T(this.TAG, "===================== onAccessibilityEvent ====================");
Expand All @@ -116,6 +124,13 @@ public void onAccessibilityEvent(AccessibilityEvent event) {
Logger.T(this.TAG, "================================================================");
return;
}

if (isCheckLauncherAfterAccessibilityEvent) {
if (!PermissionManager.isMyLauncherDefault(getApplicationContext())){
return;
}
}

//Log.d("myLog", "Kiosk status: "+(KioskManager.getKioskModeStatus()?"true":"false")+"; event: "+ event.toString());
Logger.T(this.TAG, "===================== onAccessibilityEvent ====================");
Logger.T(this.TAG, event.toString());
Expand Down

0 comments on commit 2cc9746

Please sign in to comment.