package com.yama.client import android.content.BroadcastReceiver import android.content.Context import android.content.Intent import android.util.Log /** * 覆盖安装完成后的第一现场:系统在新版本进程里发 MY_PACKAGE_REPLACED(只有被替换的 APP * 自己收得到)。此刻 MediaProjection 授权已经随旧进程一起失效,客户端不会自动恢复录屏, * 必须由人打开 App 重新授权 —— 用一条通知把这一步交到用户手上。 */ class ReplacedReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { if (intent.action != Intent.ACTION_MY_PACKAGE_REPLACED) return Log.i("YAMA", "MY_PACKAGE_REPLACED: upgraded, asking user to grant screen capture") UpdateInstaller.notifyUser(context, 201, "YAMA 已升级", "点按打开 YAMA 并重新授权录屏,远程控制才能恢复。", UpdateInstaller.mainActivityPendingIntent(context)) } }