mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-01-04 22:17:53 +00:00
Re-add activity check
Causes false disables otherwise.
This commit is contained in:
parent
3adc7ca22a
commit
c553312fd5
@ -7,6 +7,7 @@ import android.app.PendingIntent;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
@ -61,6 +62,9 @@ public class MonitorService extends AccessibilityService {
|
||||
event.getPackageName().toString(),
|
||||
event.getClassName().toString()
|
||||
);
|
||||
ActivityInfo activityInfo = tryGetActivity(componentName);
|
||||
boolean isActivity = activityInfo != null;
|
||||
if (isActivity) {
|
||||
Logger.dh("MonitorService: CurrentActivity: " + event.getPackageName());
|
||||
|
||||
String mPackage = componentName.getPackageName();
|
||||
@ -77,6 +81,15 @@ public class MonitorService extends AccessibilityService {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ActivityInfo tryGetActivity(ComponentName componentName) {
|
||||
try {
|
||||
return getPackageManager().getActivityInfo(componentName, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String getAppName(String packageName) {
|
||||
PackageManager pkManager = getPackageManager();
|
||||
|
Loading…
x
Reference in New Issue
Block a user