fix: Remove TclBypass to resolve Google Play Protect malware flag

This commit is contained in:
Assistant committed 2026-04-05 00:13:30 +01:00
1 parent bd727fd801
commit 26d19f50a0
5 files changed
+17 -231

No files matched your search

@@ -31,7 +31,6 @@ import android.widget.Toast;
import com.hyperion.grabber.common.BootActivity;
import com.hyperion.grabber.common.HyperionScreenService;
import com.hyperion.grabber.common.util.PermissionHelper;
import com.hyperion.grabber.common.util.TclBypass;
public class MainActivity extends AppCompatActivity implements ImageView.OnClickListener,
ImageView.OnFocusChangeListener {
@@ -44,7 +43,6 @@ public class MainActivity extends AppCompatActivity implements ImageView.OnClick
private Intent mPendingProjectionData = null;
private int mPendingResultCode = 0;
private int mPermissionDeniedCount = 0;
private boolean mTclWarningShown = false;
private BroadcastReceiver mMessageReceiver = new BroadcastReceiver() {
@Override
@@ -52,12 +50,8 @@ public class MainActivity extends AppCompatActivity implements ImageView.OnClick
boolean checked = intent.getBooleanExtra(HyperionScreenService.BROADCAST_TAG, false);
mRecorderRunning = checked;
String error = intent.getStringExtra(HyperionScreenService.BROADCAST_ERROR);
boolean tclBlocked = intent.getBooleanExtra(HyperionScreenService.BROADCAST_TCL_BLOCKED, false);
if (tclBlocked && !mTclWarningShown) {
mTclWarningShown = true;
TclBypass.showTclHelpDialog(MainActivity.this, () -> requestScreenCapture());
} else if (error != null &&
if (error != null &&
(Build.VERSION.SDK_INT < Build.VERSION_CODES.N ||
!HyperionGrabberTileService.isListening())) {
Toast.makeText(getBaseContext(), error, Toast.LENGTH_LONG).show();
@@ -136,12 +130,6 @@ public class MainActivity extends AppCompatActivity implements ImageView.OnClick
}
private void requestScreenCapture() {
// On TCL and other restricted devices, try shell bypass first
if (TclBypass.isTclDevice() || TclBypass.isRestrictedManufacturer()) {
Log.d(TAG, "Detected TCL/restricted device, trying shell bypass");
TclBypass.tryShellBypass(this);
}
// Also try general shell permissions
PermissionHelper.tryGrantProjectMediaViaShell(this);
@@ -158,11 +146,7 @@ public class MainActivity extends AppCompatActivity implements ImageView.OnClick
} catch (SecurityException e) {
Log.e(TAG, "Screen capture permission denied: " + e.getMessage());
mPermissionDeniedCount++;
if (TclBypass.isTclDevice()) {
TclBypass.showTclHelpDialog(this, this::requestScreenCapture);
} else {
PermissionHelper.showFullPermissionDialog(this, this::requestScreenCapture);
}
PermissionHelper.showFullPermissionDialog(this, this::requestScreenCapture);
setImageViews(false, true);
} catch (Exception e) {
Log.e(TAG, "Failed to request screen capture: " + e.getMessage());
@@ -189,11 +173,7 @@ public class MainActivity extends AppCompatActivity implements ImageView.OnClick
mPermissionDeniedCount++;
mRecorderRunning = false;
if (mPermissionDeniedCount >= 2) {
if (TclBypass.isTclDevice()) {
TclBypass.showTclHelpDialog(this, this::requestScreenCapture);
} else {
PermissionHelper.showFullPermissionDialog(this, this::requestScreenCapture);
}
PermissionHelper.showFullPermissionDialog(this, this::requestScreenCapture);
} else {
Toast.makeText(this, "Screen recording permission was denied. Tap again to retry.", Toast.LENGTH_LONG).show();
}
@@ -201,7 +181,6 @@ public class MainActivity extends AppCompatActivity implements ImageView.OnClick
return;
}
mPermissionDeniedCount = 0;
mTclWarningShown = false;
Log.i(TAG, "Starting screen capture");
startScreenRecorder(resultCode, (Intent) data.clone());
mRecorderRunning = true;
@@ -29,7 +29,6 @@ import android.widget.Toast;
import com.hyperion.grabber.common.BootActivity;
import com.hyperion.grabber.common.HyperionScreenService;
import com.hyperion.grabber.common.util.TclBypass;
import com.hyperion.grabber.common.util.Preferences;
import com.hyperion.grabber.R;
@@ -41,7 +40,6 @@ public class MainActivity extends LeanbackActivity implements ImageView.OnClickL
public static final String BROADCAST_ERROR = "SERVICE_ERROR";
public static final String BROADCAST_TAG = "SERVICE_STATUS";
public static final String BROADCAST_FILTER = "SERVICE_FILTER";
public static final String BROADCAST_TCL_BLOCKED = "TCL_BLOCKED";
private static final String TAG = "DEBUG";
private boolean mRecorderRunning = false;
private static MediaProjectionManager mMediaProjectionManager;
@@ -53,11 +51,8 @@ public class MainActivity extends LeanbackActivity implements ImageView.OnClickL
boolean checked = intent.getBooleanExtra(BROADCAST_TAG, false);
mRecorderRunning = checked;
String error = intent.getStringExtra(BROADCAST_ERROR);
boolean tclBlocked = intent.getBooleanExtra(BROADCAST_TCL_BLOCKED, false);
if (tclBlocked) {
TclBypass.showTclHelpDialog(MainActivity.this, () -> requestScreenCapture());
} else if (error != null) {
if (error != null) {
Toast.makeText(getBaseContext(), error, Toast.LENGTH_SHORT).show();
}
setImageViews(checked, true);
@@ -166,15 +161,12 @@ public class MainActivity extends LeanbackActivity implements ImageView.OnClickL
}
private void requestScreenCapture() {
TclBypass.tryShellBypass(this);
try {
Intent captureIntent = mMediaProjectionManager.createScreenCaptureIntent();
startActivityForResult(captureIntent, REQUEST_MEDIA_PROJECTION);
} catch (Exception e) {
Log.e(TAG, "Failed to request screen capture: " + e.getMessage());
mPermissionDeniedCount++;
TclBypass.showTclHelpDialog(this, this::requestScreenCapture);
}
}
@@ -210,9 +202,6 @@ public class MainActivity extends LeanbackActivity implements ImageView.OnClickL
if (resultCode != Activity.RESULT_OK) {
mPermissionDeniedCount++;
Toast.makeText(this, "Permission denied. Tap again to retry.", Toast.LENGTH_SHORT).show();
if (mPermissionDeniedCount >= 2) {
TclBypass.showTclHelpDialog(this, this::requestScreenCapture);
}
if (mRecorderRunning) {
stopScreenRecorder();
}