mirror of
https://github.com/screentinker/screentinker.git
synced 2026-08-13 22:03:13 -06:00
After the OTA installs, PACKAGE_REPLACED kills the old process and nothing brought
MainActivity back, so updating screens dropped to the launcher (the 1.9.0 fleet bug). Add a
MY_PACKAGE_REPLACED receiver that relaunches via a shared Relauncher cascade (extracted from
BootReceiver so boot + post-update share one path):
1. overlay-direct startActivity (SYSTEM_ALERT_WINDOW) - legal on all versions when granted
2. full-screen-intent notification - auto-launches <14; on 14+ (USE_FULL_SCREEN_INTENT
revoked) degrades to a VISIBLE, tappable "tap to resume" prompt - fail loud, never a
silent dark screen
Emulator-proven on Android 16: MY_PACKAGE_REPLACED -> Relauncher[update] -> overlay-direct
(BAL_ALLOW_SAW_PERMISSION) -> MainActivity on the new version. Accessibility re-binds across
the package-replace (Service connected fires post-relaunch), so sequential OTAs keep their
auto-confirm.
Unattended OTA requires accessibility (auto-confirm the install) + overlay (relaunch); the
setup wizard grants both. A device where they're skipped degrades to the visible prompt.
Closes #96.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
138 lines
6.3 KiB
XML
138 lines
6.3 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
|
|
|
<uses-permission android:name="android.permission.INTERNET" />
|
|
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
|
|
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
|
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
|
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" />
|
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
|
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
|
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
|
|
|
|
<application
|
|
android:name=".RemoteDisplayApp"
|
|
android:allowBackup="false"
|
|
android:icon="@android:drawable/ic_media_play"
|
|
android:label="RemoteDisplay"
|
|
android:largeHeap="true"
|
|
android:theme="@style/Theme.RemoteDisplay"
|
|
android:usesCleartextTraffic="true"
|
|
android:supportsRtl="true">
|
|
|
|
<!-- Main fullscreen media player activity -->
|
|
<activity
|
|
android:name=".MainActivity"
|
|
android:exported="true"
|
|
android:configChanges="orientation|screenSize|keyboardHidden"
|
|
android:screenOrientation="landscape"
|
|
android:theme="@style/Theme.RemoteDisplay.Fullscreen"
|
|
android:keepScreenOn="true"
|
|
android:launchMode="singleTask">
|
|
<intent-filter>
|
|
<action android:name="android.intent.action.MAIN" />
|
|
<category android:name="android.intent.category.LAUNCHER" />
|
|
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
|
|
</intent-filter>
|
|
<intent-filter>
|
|
<action android:name="android.intent.action.MAIN" />
|
|
<category android:name="android.intent.category.HOME" />
|
|
<category android:name="android.intent.category.DEFAULT" />
|
|
</intent-filter>
|
|
</activity>
|
|
|
|
<!-- Screen capture permission request (transparent) -->
|
|
<activity
|
|
android:name=".ScreenCapturePermissionActivity"
|
|
android:exported="false"
|
|
android:theme="@android:style/Theme.Translucent.NoTitleBar"
|
|
android:screenOrientation="landscape" />
|
|
|
|
<!-- Initial setup wizard (permissions) -->
|
|
<activity
|
|
android:name=".SetupActivity"
|
|
android:exported="false"
|
|
android:screenOrientation="landscape"
|
|
android:theme="@style/Theme.RemoteDisplay.Fullscreen" />
|
|
|
|
<!-- Provisioning/setup activity -->
|
|
<activity
|
|
android:name=".ProvisioningActivity"
|
|
android:exported="false"
|
|
android:screenOrientation="landscape"
|
|
android:theme="@style/Theme.RemoteDisplay.Fullscreen" />
|
|
|
|
<!-- WebSocket foreground service. #5: declares ONLY mediaPlayback - the
|
|
always-on service must not claim the mediaProjection FGS type, which
|
|
Android 14+ rejects unless a projection consent token is held. -->
|
|
<service
|
|
android:name=".service.WebSocketService"
|
|
android:exported="false"
|
|
android:foregroundServiceType="mediaPlayback" />
|
|
|
|
<!-- #5: dedicated MediaProjection foreground service for system screen
|
|
capture. Started only after the user grants consent, so claiming the
|
|
mediaProjection FGS type is valid on Android 14+. -->
|
|
<service
|
|
android:name=".service.MediaProjectionService"
|
|
android:exported="false"
|
|
android:foregroundServiceType="mediaProjection" />
|
|
|
|
<!-- Accessibility service for power controls -->
|
|
<service
|
|
android:name=".service.PowerAccessibilityService"
|
|
android:exported="true"
|
|
android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
|
|
<intent-filter>
|
|
<action android:name="android.accessibilityservice.AccessibilityService" />
|
|
</intent-filter>
|
|
<meta-data
|
|
android:name="android.accessibilityservice"
|
|
android:resource="@xml/accessibility_service_config" />
|
|
</service>
|
|
|
|
<!-- Boot receiver for auto-start -->
|
|
<receiver
|
|
android:name=".service.BootReceiver"
|
|
android:enabled="true"
|
|
android:exported="true">
|
|
<intent-filter>
|
|
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
|
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
|
|
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
|
|
</intent-filter>
|
|
</receiver>
|
|
|
|
<!-- #96: relaunch the player after a self-update (OTA). MY_PACKAGE_REPLACED is
|
|
delivered to the freshly-installed app; the receiver relaunches via the same
|
|
cascade as boot so the screen doesn't drop to the launcher after an update. -->
|
|
<receiver
|
|
android:name=".service.PackageReplacedReceiver"
|
|
android:enabled="true"
|
|
android:exported="true">
|
|
<intent-filter>
|
|
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
|
|
</intent-filter>
|
|
</receiver>
|
|
|
|
<!-- FileProvider for APK updates -->
|
|
<provider
|
|
android:name="androidx.core.content.FileProvider"
|
|
android:authorities="${applicationId}.fileprovider"
|
|
android:exported="false"
|
|
android:grantUriPermissions="true">
|
|
<meta-data
|
|
android:name="android.support.FILE_PROVIDER_PATHS"
|
|
android:resource="@xml/file_paths" />
|
|
</provider>
|
|
|
|
</application>
|
|
</manifest>
|