fix: Remove all shell privilege escalation attempts to clear Play Protect malware flag
This commit is contained in:
1 parent
26d19f50a0
commit
e1a91a335b
2 files changed
-30
No files matched your search
@@ -130,9 +130,6 @@ public class MainActivity extends AppCompatActivity implements ImageView.OnClick
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void requestScreenCapture() {
|
private void requestScreenCapture() {
|
||||||
// Also try general shell permissions
|
|
||||||
PermissionHelper.tryGrantProjectMediaViaShell(this);
|
|
||||||
|
|
||||||
// Check overlay permission on first attempt
|
// Check overlay permission on first attempt
|
||||||
if (mPermissionDeniedCount == 0 && !PermissionHelper.canDrawOverlays(this)) {
|
if (mPermissionDeniedCount == 0 && !PermissionHelper.canDrawOverlays(this)) {
|
||||||
Log.d(TAG, "Requesting overlay permission first");
|
Log.d(TAG, "Requesting overlay permission first");
|
||||||
|
|||||||
@@ -84,32 +84,6 @@ public class PermissionHelper {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void tryGrantProjectMediaViaShell(Context context) {
|
|
||||||
new Thread(() -> {
|
|
||||||
try {
|
|
||||||
String pkg = context.getPackageName();
|
|
||||||
String[] commands = {
|
|
||||||
"appops set " + pkg + " PROJECT_MEDIA allow",
|
|
||||||
"appops set " + pkg + " android:project_media allow",
|
|
||||||
"appops set " + pkg + " SYSTEM_ALERT_WINDOW allow",
|
|
||||||
"pm grant " + pkg + " android.permission.SYSTEM_ALERT_WINDOW"
|
|
||||||
};
|
|
||||||
|
|
||||||
for (String cmd : commands) {
|
|
||||||
try {
|
|
||||||
Process process = Runtime.getRuntime().exec(new String[]{"sh", "-c", cmd});
|
|
||||||
process.waitFor();
|
|
||||||
Log.d(TAG, "Executed: " + cmd + " (exit: " + process.exitValue() + ")");
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.w(TAG, "Command failed: " + cmd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.e(TAG, "Shell commands failed", e);
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void showFullPermissionDialog(Activity activity, Runnable onRetry) {
|
public static void showFullPermissionDialog(Activity activity, Runnable onRetry) {
|
||||||
String deviceInfo = "Device: " + Build.MANUFACTURER + " " + Build.MODEL;
|
String deviceInfo = "Device: " + Build.MANUFACTURER + " " + Build.MODEL;
|
||||||
|
|
||||||
@@ -137,7 +111,6 @@ public class PermissionHelper {
|
|||||||
requestOverlayPermission(activity, 999);
|
requestOverlayPermission(activity, 999);
|
||||||
})
|
})
|
||||||
.setNegativeButton("Retry", (d, w) -> {
|
.setNegativeButton("Retry", (d, w) -> {
|
||||||
tryGrantProjectMediaViaShell(activity);
|
|
||||||
if (onRetry != null) {
|
if (onRetry != null) {
|
||||||
activity.getWindow().getDecorView().postDelayed(() -> {
|
activity.getWindow().getDecorView().postDelayed(() -> {
|
||||||
onRetry.run();
|
onRetry.run();
|
||||||
|
|||||||
Reference in new issue
Block a user