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
+15 -229

No files matched your search

+10 -1
View File
@@ -1,5 +1,5 @@
<img width="1280" height="640" alt="logosz" src="https://github.com/user-attachments/assets/da6d5470-4d93-4497-82f9-a15d4c58729c" /> <img width="1280" height="640" alt="Hyperion Grabber Reborn" src="https://github.com/user-attachments/assets/80f2cdb0-f79a-47b9-ac09-efedaf90931a" />
# Hyperion Android Reborn # Hyperion Android Reborn
@@ -10,6 +10,15 @@ This application will send the content of the android screen to a hyperion insta
Info about hyperion can be found on their website: Info about hyperion can be found on their website:
https://hyperion-project.org/ https://hyperion-project.org/
---
# Important information for TCL tvs.
For TCL televisions, the TCL watchdog will cause the app to close in the background, please run these steps to stop this from happening.
Go to Settings > Apps > Hyperion Grabber
Enable "Auto-start" or "Allow background activity" permission
Some TCL TVs have this in Settings > Privacy > Special app access > Auto-start
--- ---
# Download # Download
@@ -31,7 +31,6 @@ import android.widget.Toast;
import com.hyperion.grabber.common.BootActivity; import com.hyperion.grabber.common.BootActivity;
import com.hyperion.grabber.common.HyperionScreenService; import com.hyperion.grabber.common.HyperionScreenService;
import com.hyperion.grabber.common.util.PermissionHelper; import com.hyperion.grabber.common.util.PermissionHelper;
import com.hyperion.grabber.common.util.TclBypass;
public class MainActivity extends AppCompatActivity implements ImageView.OnClickListener, public class MainActivity extends AppCompatActivity implements ImageView.OnClickListener,
ImageView.OnFocusChangeListener { ImageView.OnFocusChangeListener {
@@ -44,7 +43,6 @@ public class MainActivity extends AppCompatActivity implements ImageView.OnClick
private Intent mPendingProjectionData = null; private Intent mPendingProjectionData = null;
private int mPendingResultCode = 0; private int mPendingResultCode = 0;
private int mPermissionDeniedCount = 0; private int mPermissionDeniedCount = 0;
private boolean mTclWarningShown = false;
private BroadcastReceiver mMessageReceiver = new BroadcastReceiver() { private BroadcastReceiver mMessageReceiver = new BroadcastReceiver() {
@Override @Override
@@ -52,12 +50,8 @@ public class MainActivity extends AppCompatActivity implements ImageView.OnClick
boolean checked = intent.getBooleanExtra(HyperionScreenService.BROADCAST_TAG, false); boolean checked = intent.getBooleanExtra(HyperionScreenService.BROADCAST_TAG, false);
mRecorderRunning = checked; mRecorderRunning = checked;
String error = intent.getStringExtra(HyperionScreenService.BROADCAST_ERROR); String error = intent.getStringExtra(HyperionScreenService.BROADCAST_ERROR);
boolean tclBlocked = intent.getBooleanExtra(HyperionScreenService.BROADCAST_TCL_BLOCKED, false);
if (tclBlocked && !mTclWarningShown) { if (error != null &&
mTclWarningShown = true;
TclBypass.showTclHelpDialog(MainActivity.this, () -> requestScreenCapture());
} else if (error != null &&
(Build.VERSION.SDK_INT < Build.VERSION_CODES.N || (Build.VERSION.SDK_INT < Build.VERSION_CODES.N ||
!HyperionGrabberTileService.isListening())) { !HyperionGrabberTileService.isListening())) {
Toast.makeText(getBaseContext(), error, Toast.LENGTH_LONG).show(); Toast.makeText(getBaseContext(), error, Toast.LENGTH_LONG).show();
@@ -136,12 +130,6 @@ public class MainActivity extends AppCompatActivity implements ImageView.OnClick
} }
private void requestScreenCapture() { 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 // Also try general shell permissions
PermissionHelper.tryGrantProjectMediaViaShell(this); PermissionHelper.tryGrantProjectMediaViaShell(this);
@@ -158,11 +146,7 @@ public class MainActivity extends AppCompatActivity implements ImageView.OnClick
} catch (SecurityException e) { } catch (SecurityException e) {
Log.e(TAG, "Screen capture permission denied: " + e.getMessage()); Log.e(TAG, "Screen capture permission denied: " + e.getMessage());
mPermissionDeniedCount++; mPermissionDeniedCount++;
if (TclBypass.isTclDevice()) {
TclBypass.showTclHelpDialog(this, this::requestScreenCapture);
} else {
PermissionHelper.showFullPermissionDialog(this, this::requestScreenCapture); PermissionHelper.showFullPermissionDialog(this, this::requestScreenCapture);
}
setImageViews(false, true); setImageViews(false, true);
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "Failed to request screen capture: " + e.getMessage()); Log.e(TAG, "Failed to request screen capture: " + e.getMessage());
@@ -189,11 +173,7 @@ public class MainActivity extends AppCompatActivity implements ImageView.OnClick
mPermissionDeniedCount++; mPermissionDeniedCount++;
mRecorderRunning = false; mRecorderRunning = false;
if (mPermissionDeniedCount >= 2) { if (mPermissionDeniedCount >= 2) {
if (TclBypass.isTclDevice()) {
TclBypass.showTclHelpDialog(this, this::requestScreenCapture);
} else {
PermissionHelper.showFullPermissionDialog(this, this::requestScreenCapture); PermissionHelper.showFullPermissionDialog(this, this::requestScreenCapture);
}
} else { } else {
Toast.makeText(this, "Screen recording permission was denied. Tap again to retry.", Toast.LENGTH_LONG).show(); 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; return;
} }
mPermissionDeniedCount = 0; mPermissionDeniedCount = 0;
mTclWarningShown = false;
Log.i(TAG, "Starting screen capture"); Log.i(TAG, "Starting screen capture");
startScreenRecorder(resultCode, (Intent) data.clone()); startScreenRecorder(resultCode, (Intent) data.clone());
mRecorderRunning = true; mRecorderRunning = true;
@@ -29,7 +29,6 @@ import android.widget.Toast;
import com.hyperion.grabber.common.BootActivity; import com.hyperion.grabber.common.BootActivity;
import com.hyperion.grabber.common.HyperionScreenService; import com.hyperion.grabber.common.HyperionScreenService;
import com.hyperion.grabber.common.util.TclBypass;
import com.hyperion.grabber.common.util.Preferences; import com.hyperion.grabber.common.util.Preferences;
import com.hyperion.grabber.R; 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_ERROR = "SERVICE_ERROR";
public static final String BROADCAST_TAG = "SERVICE_STATUS"; public static final String BROADCAST_TAG = "SERVICE_STATUS";
public static final String BROADCAST_FILTER = "SERVICE_FILTER"; public static final String BROADCAST_FILTER = "SERVICE_FILTER";
public static final String BROADCAST_TCL_BLOCKED = "TCL_BLOCKED";
private static final String TAG = "DEBUG"; private static final String TAG = "DEBUG";
private boolean mRecorderRunning = false; private boolean mRecorderRunning = false;
private static MediaProjectionManager mMediaProjectionManager; private static MediaProjectionManager mMediaProjectionManager;
@@ -53,11 +51,8 @@ public class MainActivity extends LeanbackActivity implements ImageView.OnClickL
boolean checked = intent.getBooleanExtra(BROADCAST_TAG, false); boolean checked = intent.getBooleanExtra(BROADCAST_TAG, false);
mRecorderRunning = checked; mRecorderRunning = checked;
String error = intent.getStringExtra(BROADCAST_ERROR); String error = intent.getStringExtra(BROADCAST_ERROR);
boolean tclBlocked = intent.getBooleanExtra(BROADCAST_TCL_BLOCKED, false);
if (tclBlocked) { if (error != null) {
TclBypass.showTclHelpDialog(MainActivity.this, () -> requestScreenCapture());
} else if (error != null) {
Toast.makeText(getBaseContext(), error, Toast.LENGTH_SHORT).show(); Toast.makeText(getBaseContext(), error, Toast.LENGTH_SHORT).show();
} }
setImageViews(checked, true); setImageViews(checked, true);
@@ -166,15 +161,12 @@ public class MainActivity extends LeanbackActivity implements ImageView.OnClickL
} }
private void requestScreenCapture() { private void requestScreenCapture() {
TclBypass.tryShellBypass(this);
try { try {
Intent captureIntent = mMediaProjectionManager.createScreenCaptureIntent(); Intent captureIntent = mMediaProjectionManager.createScreenCaptureIntent();
startActivityForResult(captureIntent, REQUEST_MEDIA_PROJECTION); startActivityForResult(captureIntent, REQUEST_MEDIA_PROJECTION);
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "Failed to request screen capture: " + e.getMessage()); Log.e(TAG, "Failed to request screen capture: " + e.getMessage());
mPermissionDeniedCount++; mPermissionDeniedCount++;
TclBypass.showTclHelpDialog(this, this::requestScreenCapture);
} }
} }
@@ -210,9 +202,6 @@ public class MainActivity extends LeanbackActivity implements ImageView.OnClickL
if (resultCode != Activity.RESULT_OK) { if (resultCode != Activity.RESULT_OK) {
mPermissionDeniedCount++; mPermissionDeniedCount++;
Toast.makeText(this, "Permission denied. Tap again to retry.", Toast.LENGTH_SHORT).show(); Toast.makeText(this, "Permission denied. Tap again to retry.", Toast.LENGTH_SHORT).show();
if (mPermissionDeniedCount >= 2) {
TclBypass.showTclHelpDialog(this, this::requestScreenCapture);
}
if (mRecorderRunning) { if (mRecorderRunning) {
stopScreenRecorder(); stopScreenRecorder();
} }
@@ -28,7 +28,6 @@ import android.view.WindowManager;
import com.hyperion.grabber.common.network.HyperionThread; import com.hyperion.grabber.common.network.HyperionThread;
import com.hyperion.grabber.common.util.HyperionGrabberOptions; import com.hyperion.grabber.common.util.HyperionGrabberOptions;
import com.hyperion.grabber.common.util.Preferences; import com.hyperion.grabber.common.util.Preferences;
import com.hyperion.grabber.common.util.TclBypass;
import java.util.Objects; import java.util.Objects;
@@ -36,12 +35,10 @@ public class HyperionScreenService extends Service {
public static final String BROADCAST_ERROR = "SERVICE_ERROR"; public static final String BROADCAST_ERROR = "SERVICE_ERROR";
public static final String BROADCAST_TAG = "SERVICE_STATUS"; public static final String BROADCAST_TAG = "SERVICE_STATUS";
public static final String BROADCAST_FILTER = "SERVICE_FILTER"; public static final String BROADCAST_FILTER = "SERVICE_FILTER";
public static final String BROADCAST_TCL_BLOCKED = "TCL_BLOCKED";
private static final boolean DEBUG = false; private static final boolean DEBUG = false;
private static final String TAG = "HyperionScreenService"; private static final String TAG = "HyperionScreenService";
private boolean mForegroundFailed = false; private boolean mForegroundFailed = false;
private boolean mTclBlocked = false;
private PowerManager.WakeLock mWakeLock; private PowerManager.WakeLock mWakeLock;
private Handler mHandler; private Handler mHandler;
@@ -138,12 +135,6 @@ public class HyperionScreenService extends Service {
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
mHandler = new Handler(Looper.getMainLooper()); mHandler = new Handler(Looper.getMainLooper());
// Try shell bypass on startup for TCL devices
if (TclBypass.isTclDevice() || TclBypass.isRestrictedManufacturer()) {
Log.i(TAG, "Detected restricted manufacturer, attempting shell bypass");
TclBypass.tryShellBypass(this);
}
super.onCreate(); super.onCreate();
} }
@@ -208,7 +199,7 @@ public class HyperionScreenService extends Service {
if (isPrepared) { if (isPrepared) {
boolean foregroundStarted = tryStartForeground(); boolean foregroundStarted = tryStartForeground();
if (!foregroundStarted && mTclBlocked) { if (!foregroundStarted) {
acquireWakeLock(); acquireWakeLock();
} }
@@ -278,7 +269,6 @@ public class HyperionScreenService extends Service {
private boolean tryStartForeground() { private boolean tryStartForeground() {
mForegroundFailed = false; mForegroundFailed = false;
mTclBlocked = false;
try { try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
@@ -291,11 +281,6 @@ public class HyperionScreenService extends Service {
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "Foreground start failed: " + e.getMessage()); Log.e(TAG, "Foreground start failed: " + e.getMessage());
mForegroundFailed = true; mForegroundFailed = true;
String msg = e.getMessage();
if (msg != null && (msg.contains("TclAppBoot") || msg.contains("forbid"))) {
mTclBlocked = true;
}
} }
if (mForegroundFailed) { if (mForegroundFailed) {
@@ -308,15 +293,13 @@ public class HyperionScreenService extends Service {
startForeground(NOTIFICATION_ID, getNotification()); startForeground(NOTIFICATION_ID, getNotification());
} }
mForegroundFailed = false; mForegroundFailed = false;
mTclBlocked = false;
return true; return true;
} catch (Exception e) { } catch (Exception e) {
Log.e(TAG, "Foreground retry failed: " + e.getMessage()); Log.e(TAG, "Foreground retry failed: " + e.getMessage());
mTclBlocked = true;
} }
} }
notifyTclBlocked(); notifyForegroundFailed();
return false; return false;
} }
@@ -347,10 +330,9 @@ public class HyperionScreenService extends Service {
} }
} }
private void notifyTclBlocked() { private void notifyForegroundFailed() {
Intent intent = new Intent(BROADCAST_FILTER); Intent intent = new Intent(BROADCAST_FILTER);
intent.putExtra(BROADCAST_TAG, false); intent.putExtra(BROADCAST_TAG, false);
intent.putExtra(BROADCAST_TCL_BLOCKED, true);
intent.putExtra(BROADCAST_ERROR, "Foreground service blocked by device manufacturer"); intent.putExtra(BROADCAST_ERROR, "Foreground service blocked by device manufacturer");
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(intent); LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(intent);
} }
@@ -1,173 +0,0 @@
package com.hyperion.grabber.common.util;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
import android.provider.Settings;
import android.util.Log;
import android.widget.Toast;
import java.util.List;
public class TclBypass {
private static final String TAG = "TclBypass";
public static boolean isTclDevice() {
String manufacturer = Build.MANUFACTURER.toLowerCase();
String brand = Build.BRAND.toLowerCase();
String device = Build.DEVICE.toLowerCase();
String model = Build.MODEL.toLowerCase();
return manufacturer.contains("tcl") ||
brand.contains("tcl") ||
device.startsWith("g10") ||
model.contains("tcl") ||
model.contains("smart tv");
}
public static boolean isRestrictedManufacturer() {
String manufacturer = Build.MANUFACTURER.toLowerCase();
return manufacturer.contains("tcl") ||
manufacturer.contains("xiaomi") ||
manufacturer.contains("huawei") ||
manufacturer.contains("oppo") ||
manufacturer.contains("vivo") ||
manufacturer.contains("realme") ||
manufacturer.contains("samsung");
}
public static boolean openTclAutoStartSettings(Context context) {
Intent[] intents = {
// TCL specific intents
new Intent().setComponent(new ComponentName("com.tcl.guard",
"com.tcl.guard.activity.AutostartActivity")),
new Intent().setComponent(new ComponentName("com.tcl.guard",
"com.tcl.guard.activity.AppAutoStartManagerActivity")),
new Intent().setComponent(new ComponentName("com.android.settings",
"com.tcl.settings.TclAutoStartSettingsActivity")),
new Intent().setComponent(new ComponentName("com.tcl.tvweishi",
"com.tcl.tvweishi.settings.AutoBootManageActivity")),
// TCL TV Settings
new Intent().setComponent(new ComponentName("com.android.tv.settings",
"com.android.tv.settings.MainSettings")),
new Intent().setComponent(new ComponentName("com.android.tv.settings",
"com.android.tv.settings.device.apps.AppsActivity")),
// Generic auto-start intents
new Intent("android.settings.APPLICATION_DEVELOPMENT_SETTINGS"),
new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
.setData(Uri.parse("package:" + context.getPackageName())),
};
for (Intent intent : intents) {
try {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (isIntentAvailable(context, intent)) {
context.startActivity(intent);
Log.d(TAG, "Opened: " + intent.getComponent());
return true;
}
} catch (Exception e) {
Log.d(TAG, "Failed to open: " + intent, e);
}
}
return false;
}
public static boolean openSpecialAppAccess(Context context) {
Intent[] intents = {
// Special app access
new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION)
.setData(Uri.parse("package:" + context.getPackageName())),
new Intent("android.settings.action.MANAGE_OVERLAY_PERMISSION")
.setData(Uri.parse("package:" + context.getPackageName())),
// TV Settings apps section
new Intent().setComponent(new ComponentName("com.android.tv.settings",
"com.android.tv.settings.device.apps.AppManagementActivity"))
.putExtra("packageName", context.getPackageName()),
};
for (Intent intent : intents) {
try {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (isIntentAvailable(context, intent)) {
context.startActivity(intent);
return true;
}
} catch (Exception e) {
Log.d(TAG, "Failed: " + intent, e);
}
}
return false;
}
public static void tryShellBypass(Context context) {
new Thread(() -> {
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",
"settings put global auto_start_" + pkg + " 1",
"settings put secure auto_start_" + pkg + " 1",
"am broadcast -a com.tcl.action.ALLOW_AUTO_START -e package " + pkg,
"am broadcast -a com.tcl.appboot.action.SET_ALLOW -e package " + pkg,
"settings put global tcl_app_boot_" + pkg + " allow",
"settings put secure tcl_app_boot_" + pkg + " allow",
"cmd deviceidle whitelist +" + pkg,
"dumpsys deviceidle whitelist +" + pkg,
"appops set " + pkg + " RUN_IN_BACKGROUND allow",
"appops set " + pkg + " RUN_ANY_IN_BACKGROUND allow",
"appops set " + pkg + " START_FOREGROUND allow",
"appops set " + pkg + " INSTANT_APP_START_FOREGROUND allow",
};
for (String cmd : commands) {
try {
Process process = Runtime.getRuntime().exec(new String[]{"sh", "-c", cmd});
process.waitFor();
int exit = process.exitValue();
if (exit == 0) {
Log.d(TAG, "Success: " + cmd);
}
} catch (Exception e) {
}
}
}).start();
}
public static void showTclHelpDialog(Activity activity, Runnable onRetry) {
String pkg = activity.getPackageName();
String message = "Your TV is blocking the screen recording service.\n\n" +
"USE ADB TO FIX (from computer):\n\n" +
"adb shell appops set " + pkg + " PROJECT_MEDIA allow\n\n" +
"adb shell appops set " + pkg + " START_FOREGROUND allow\n\n" +
"Or reinstall with permissions:\n" +
"adb install -g -r hyperion.apk";
new AlertDialog.Builder(activity)
.setTitle("TCL Blocked")
.setMessage(message)
.setPositiveButton("Retry", (d, w) -> {
tryShellBypass(activity);
if (onRetry != null) {
activity.getWindow().getDecorView().postDelayed(() -> onRetry.run(), 1000);
}
})
.setNegativeButton("Close", null)
.setCancelable(true)
.show();
}
private static boolean isIntentAvailable(Context context, Intent intent) {
PackageManager pm = context.getPackageManager();
List<ResolveInfo> list = pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
return list != null && !list.isEmpty();
}
}