mirror of
https://github.com/MaintainTeam/Hypatia.git
synced 2025-02-28 21:38:21 +03:00
Better handle notifcation actions
Signed-off-by: Tad <tad@spotco.us>
This commit is contained in:
parent
5b423016dc
commit
f1d747b739
3 changed files with 32 additions and 5 deletions
|
@ -6,8 +6,8 @@ android {
|
|||
applicationId "us.spotco.malwarescanner"
|
||||
minSdkVersion 19
|
||||
targetSdkVersion 32
|
||||
versionCode 122
|
||||
versionName "3.0"
|
||||
versionCode 301
|
||||
versionName "3.01"
|
||||
resConfigs 'en', 'af', 'de', 'el', 'es', 'fi', 'fr', 'it', 'pl', 'pt', 'ru', 'tr', 'zh-rCN'
|
||||
}
|
||||
buildTypes {
|
||||
|
|
|
@ -6,12 +6,14 @@
|
|||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
|
||||
<uses-permission
|
||||
android:name="android.permission.MANAGE_EXTERNAL_STORAGE"
|
||||
tools:ignore="ScopedStorage" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
|
||||
<uses-permission
|
||||
android:name="android.permission.QUERY_ALL_PACKAGES"
|
||||
tools:ignore="QueryAllPackagesPermission" />
|
||||
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
|
||||
|
||||
|
@ -34,7 +36,9 @@
|
|||
android:launchMode="singleInstance"
|
||||
android:theme="@android:style/Theme.Translucent.NoTitleBar"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
android:layout_height="wrap_content"
|
||||
android:noHistory="true"
|
||||
android:excludeFromRecents="true" />
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
android:configChanges="orientation|keyboardHidden"
|
||||
|
|
|
@ -44,9 +44,13 @@ public class NotificationPromptActivity extends Activity {
|
|||
.setNegativeButton(android.R.string.no, (dialog, whichButton) -> {
|
||||
finish();
|
||||
})
|
||||
.setOnDismissListener((dialog) -> {
|
||||
finish();
|
||||
})
|
||||
.show();
|
||||
} else {
|
||||
Log.d("Hypatia", "Invalid hash");
|
||||
finish();
|
||||
}
|
||||
break;
|
||||
case "us.spotco.malwarescanner.DELETE_FILE":
|
||||
|
@ -69,17 +73,25 @@ public class NotificationPromptActivity extends Activity {
|
|||
.setNegativeButton(android.R.string.no, (dialog, whichButton) -> {
|
||||
finish();
|
||||
})
|
||||
.setOnDismissListener((dialog) -> {
|
||||
finish();
|
||||
})
|
||||
.show();
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
} else {
|
||||
Log.d("Hypatia", "Ignoring DELETE_FILE request from external package: " + intent.getPackage());
|
||||
finish();
|
||||
}
|
||||
break;
|
||||
case "us.spotco.malwarescanner.UNINSTALL_APP":
|
||||
if (intent.getPackage() == null || Objects.equals(intent.getPackage(), BuildConfig.APPLICATION_ID)) {
|
||||
if (intent.getStringExtra("FILE_PATH") != null) {
|
||||
boolean notFound = true;
|
||||
for (ApplicationInfo packageInfo : getPackageManager().getInstalledApplications(PackageManager.GET_META_DATA)) {
|
||||
if (packageInfo.sourceDir.equals(intent.getStringExtra("FILE_PATH"))) {
|
||||
notFound = false;
|
||||
Uri packageUri = Uri.parse("package:" + packageInfo.packageName);
|
||||
Intent uninstallIntent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE, packageUri);
|
||||
startActivity(uninstallIntent);
|
||||
|
@ -87,9 +99,15 @@ public class NotificationPromptActivity extends Activity {
|
|||
finish();
|
||||
}
|
||||
}
|
||||
if (notFound) {
|
||||
finish();
|
||||
}
|
||||
} else {
|
||||
finish();
|
||||
}
|
||||
} else {
|
||||
Log.d("Hypatia", "Ignoring DELETE_FILE request from external package: " + intent.getPackage());
|
||||
finish();
|
||||
}
|
||||
break;
|
||||
case "us.spotco.malwarescanner.IGNORE_DETECTION":
|
||||
|
@ -107,4 +125,9 @@ public class NotificationPromptActivity extends Activity {
|
|||
Log.d("Hypatia", "Canceled notification");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
finish();
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue