Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions manager/src/main/java/org/lsposed/lspatch/Patcher.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ object Patcher {
.usesCleartextTraffic(if (usesCleartextTraffic) true else null)
.permissions(addedPermissions)
.injectDocumentsProvider(injectDocumentsProvider)
.useMicroGRe(useMicroGRe)
.declareFakeSignature(declareFakeSignature)
.build()
)
.keystore(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ data class PatchRequest(
// Inject a DocumentsProvider exposing the app's private data. Recorded in the config for the same
// reason as the permissions above.
val injectDocumentsProvider: Boolean = false,
// Redirect Google Play services to an installed MicroG RE. Recorded in the config for the same reason.
val useMicroGRe: Boolean = false,
// Declare the original signature as fake-signature for ROM signature spoofing. Recorded for the same reason.
val declareFakeSignature: Boolean = false,
val origin: PatchOrigin = PatchOrigin.New,
) {
val packageName: String get() = target.packageName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ object PatchReport {
"Added perms ${if (request.addedPermissions.isEmpty()) "none" else request.addedPermissions.joinToString(", ")}"
)
add("Docs provider ${request.injectDocumentsProvider}")
add("MicroG RE ${request.useMicroGRe}")
add("Fake sig ${request.declareFakeSignature}")
add("Keystore ${if (MyKeyStore.useDefault) "built-in" else "custom (${MyKeyStore.file.name})"}")
add("Verbose ${Configs.detailPatchLogs}")
add("")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,14 @@ fun AppDetailScreen(navigator: Navigator, packageName: String) {
stringResource(R.string.appdetail_info_inject_dex),
yesNo(config?.injectDex == true),
)
InfoRow(
stringResource(R.string.patch_manifest_microg_re),
yesNo(config?.useMicroGRe == true),
)
InfoRow(
stringResource(R.string.patch_manifest_fake_signature),
yesNo(config?.declareFakeSignature == true),
)
// Manifest attributes, read from the installed manifest rather than the patch
// config: they are baked into the manifest at patch time and are not carried in the
// runtime config, so this reflects the app's actual manifest. Grouped and ordered to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.rounded.Notes
import androidx.compose.material.icons.outlined.Ballot
import androidx.compose.material.icons.rounded.AccountCircle
import androidx.compose.material.icons.rounded.Add
import androidx.compose.material.icons.rounded.Android
import androidx.compose.material.icons.rounded.Api
Expand All @@ -63,6 +64,7 @@ import androidx.compose.material.icons.rounded.Share
import androidx.compose.material.icons.rounded.Smartphone
import androidx.compose.material.icons.rounded.Terminal
import androidx.compose.material.icons.rounded.Tune
import androidx.compose.material.icons.rounded.VerifiedUser
import androidx.compose.material.icons.rounded.WorkOutline
import androidx.compose.material3.Badge
import androidx.compose.material3.BadgedBox
Expand Down Expand Up @@ -340,6 +342,8 @@ fun NewPatchScreen(navigator: Navigator, token: String) {
onAddPermission = viewModel::addPermission,
onRemovePermission = viewModel::removePermission,
onInjectDocumentsProvider = viewModel::setInjectDocumentsProvider,
onUseMicroGRe = viewModel::setUseMicroGRe,
onDeclareFakeSignature = viewModel::setDeclareFakeSignature,
)
else ->
Column(
Expand Down Expand Up @@ -387,6 +391,8 @@ private fun ConfigureBody(
onAddPermission: (String) -> Unit,
onRemovePermission: (String) -> Unit,
onInjectDocumentsProvider: (Boolean) -> Unit,
onUseMicroGRe: (Boolean) -> Unit,
onDeclareFakeSignature: (Boolean) -> Unit,
) {
val scope = rememberCoroutineScope()
val snackbarHost = LocalSnackbarHost.current
Expand Down Expand Up @@ -595,6 +601,20 @@ private fun ConfigureBody(
checked = request.injectDocumentsProvider,
onCheckedChange = onInjectDocumentsProvider,
)
ToggleRow(
title = stringResource(R.string.patch_manifest_microg_re),
icon = Icons.Rounded.AccountCircle,
subtitle = stringResource(R.string.patch_manifest_microg_re_desc),
checked = request.useMicroGRe,
onCheckedChange = onUseMicroGRe,
)
ToggleRow(
title = stringResource(R.string.patch_manifest_fake_signature),
icon = Icons.Rounded.VerifiedUser,
subtitle = stringResource(R.string.patch_manifest_fake_signature_desc),
checked = request.declareFakeSignature,
onCheckedChange = onDeclareFakeSignature,
)
// Last of the manifest controls: its chip list and field are the tallest thing here,
// so it sits below the compact toggles rather than pushing them down the screen.
PermissionEditor(
Expand Down Expand Up @@ -779,6 +799,12 @@ private fun advancedChips(request: PatchRequest): List<OptionChipData> = buildLi
if (request.injectDocumentsProvider) {
add(OptionChipData(stringResource(R.string.patch_manifest_documents_provider), true, Icons.Rounded.FolderOpen))
}
if (request.useMicroGRe) {
add(OptionChipData(stringResource(R.string.patch_manifest_microg_re), true, Icons.Rounded.AccountCircle))
}
if (request.declareFakeSignature) {
add(OptionChipData(stringResource(R.string.patch_manifest_fake_signature), true, Icons.Rounded.VerifiedUser))
}
if (!MyKeyStore.useDefault) {
add(OptionChipData(stringResource(R.string.settings_keystore_custom), true, Icons.Outlined.Ballot))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ suspend fun rePatchRequestFor(
// Recovered from the recorded config, not the original apks -- those never carried them.
addedPermissions = config?.addedPermissions?.toList() ?: emptyList(),
injectDocumentsProvider = config?.injectDocumentsProvider ?: false,
useMicroGRe = config?.useMicroGRe ?: false,
declareFakeSignature = config?.declareFakeSignature ?: false,
sigBypassLevel = config?.sigBypassLevel ?: 2,
injectDex = config?.injectDex ?: false,
modules = modules ?: embedded,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ class NewPatchViewModel(private val token: String) : ViewModel() {

fun setInjectDocumentsProvider(value: Boolean) = mutate { it.copy(injectDocumentsProvider = value) }

fun setUseMicroGRe(value: Boolean) = mutate { it.copy(useMicroGRe = value) }

fun setDeclareFakeSignature(value: Boolean) = mutate { it.copy(declareFakeSignature = value) }

/**
* Adds modules to the set, keeping what is already there.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ object LocalAppsUpdater {
.versionCode(config.versionCode)
.permissions(config.addedPermissions?.toList() ?: emptyList())
.injectDocumentsProvider(config.injectDocumentsProvider)
.useMicroGRe(config.useMicroGRe)
.declareFakeSignature(config.declareFakeSignature)
.build()
)
.keystore(
Expand Down
4 changes: 4 additions & 0 deletions manager/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@
<string name="patch_manifest_permissions_remove">移除</string>
<string name="patch_manifest_permissions_count">已添加 %1$d 个</string>
<string name="patch_manifest_documents_provider">暴露私有数据</string>
<string name="patch_manifest_microg_re">MicroG RE 支持</string>
<string name="patch_manifest_microg_re_desc">将 Google Play 服务的调用与推送转向已安装的 MicroG RE(ReVanced GmsCore),并向它声明原始签名,使重新签名后仍能使用 Google 登录与推送。集成模式需另外加入 QUERY_ALL_PACKAGES 权限。不适用原版 microG。</string>
<string name="patch_manifest_fake_signature">声明伪装签名</string>
<string name="patch_manifest_fake_signature_desc">以 fake-signature 声明原始签名,让支持签名伪装的 ROM 报告原始签名,供原版 microG 使用。ROM 不支持签名伪装时没有作用。</string>
<string name="patch_manifest_documents_provider_desc">添加一个提供程序,让文件管理器无需 root 即可通过系统文件选择器浏览应用的私有数据目录。这会扩大可访问应用数据的范围——若无需要请保持关闭。</string>
<string name="home_package">包名</string>
<string name="settings_cloak_dialog_title">更改包名</string>
Expand Down
4 changes: 4 additions & 0 deletions manager/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@
<string name="patch_manifest_permissions_remove">移除</string>
<string name="patch_manifest_permissions_count">已新增 %1$d 個</string>
<string name="patch_manifest_documents_provider">公開私有資料</string>
<string name="patch_manifest_microg_re">MicroG RE 支援</string>
<string name="patch_manifest_microg_re_desc">將 Google Play 服務的呼叫與推播導向已安裝的 MicroG RE(ReVanced GmsCore),並向它宣告原始簽章,讓重新簽名後仍能使用 Google 登入與推播。整合模式需另外加入 QUERY_ALL_PACKAGES 權限。不適用原版 microG。</string>
<string name="patch_manifest_fake_signature">宣告偽裝簽章</string>
<string name="patch_manifest_fake_signature_desc">以 fake-signature 宣告原始簽章,讓支援簽章偽裝的 ROM 回報原始簽章,供原版 microG 使用。ROM 不支援簽章偽裝時沒有作用。</string>
<string name="patch_manifest_documents_provider_desc">新增一個提供者,讓檔案管理器無需 root 即可透過系統檔案選擇器瀏覽應用程式的私有資料目錄。這會擴大可存取應用程式資料的範圍——若無需要請保持關閉。</string>
<string name="patch_select_target">選擇要修補的應用程式</string>
<string name="patch_target_loading">正在載入已安裝的應用程式…</string>
Expand Down
4 changes: 4 additions & 0 deletions manager/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@
<string name="patch_manifest_permissions_remove">Remove</string>
<string name="patch_manifest_permissions_count">%1$d added</string>
<string name="patch_manifest_documents_provider">Expose private data</string>
<string name="patch_manifest_microg_re">MicroG RE support</string>
<string name="patch_manifest_microg_re_desc">Send Google Play services calls and pushes to an installed MicroG RE (ReVanced GmsCore) and declare the original signature to it, so Google sign-in and push keep working after re-signing. In Integrated mode, also add the QUERY_ALL_PACKAGES permission. Not for upstream microG.</string>
<string name="patch_manifest_fake_signature">Declare fake signature</string>
<string name="patch_manifest_fake_signature_desc">Declare the original signature as fake-signature, for a ROM with signature spoofing to report in place of the patched one — for upstream microG. No effect on a ROM without signature spoofing.</string>
<string name="patch_manifest_documents_provider_desc">Add a provider so a file manager can browse the app\'s private data folder through the system file picker, no root needed. Widens what can reach the app\'s data — leave off unless you need it.</string>
<string name="patch_status_patching">Patching…</string>
<string name="patch_status_error">Patch failed</string>
Expand Down
Loading