feat: add FileProvider and refactor install logic

新增 FileProvider 到 AndroidManifest,使其能检测到修补后的 apk;简化 NewPatchScreen 的安装按钮逻辑;修正 AppManagePage 的闭包结构。
This commit is contained in:
NkBe 2025-09-07 14:38:14 +08:00
parent ed93e43f8c
commit 326afc95ab
No known key found for this signature in database
GPG Key ID: 75EF144ED8F4D7B8
4 changed files with 11 additions and 10 deletions

View File

@ -71,6 +71,15 @@
android:exported="true" android:exported="true"
android:multiprocess="false" android:multiprocess="false"
android:permission="android.permission.INTERACT_ACROSS_USERS_FULL" /> android:permission="android.permission.INTERACT_ACROSS_USERS_FULL" />
</application>
<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> </manifest>

View File

@ -479,13 +479,6 @@ private fun DoPatchBody(modifier: Modifier, navigator: DestinationsNavigator) {
Button( Button(
modifier = Modifier.weight(1f), modifier = Modifier.weight(1f),
onClick = { onClick = {
if (!ShizukuApi.isPermissionGranted) {
scope.launch {
snackbarHost.showSnackbar(shizukuUnavailable)
}
} else {
installing = true
}
installation = if (!ShizukuApi.isPermissionGranted) NewPatchViewModel.InstallMethod.SYSTEM else NewPatchViewModel.InstallMethod.SHIZUKU installation = if (!ShizukuApi.isPermissionGranted) NewPatchViewModel.InstallMethod.SYSTEM else NewPatchViewModel.InstallMethod.SHIZUKU
Log.d(TAG, "Installation method: $installation") Log.d(TAG, "Installation method: $installation")
}, },

View File

@ -197,7 +197,6 @@ fun AppManageBody(
scope.launch { scope.launch {
viewModel.dispatch(AppManageViewModel.ViewAction.UpdateLoader(it.first, it.second)) viewModel.dispatch(AppManageViewModel.ViewAction.UpdateLoader(it.first, it.second))
} }
}
} }
) )
} }

View File

@ -10,7 +10,7 @@ public class Constants {
final static public String PATCH_FILE_SUFFIX = "-lspatched.apk"; final static public String PATCH_FILE_SUFFIX = "-lspatched.apk";
final static public String PROXY_APP_COMPONENT_FACTORY = "org.lsposed.lspatch.metaloader.LSPAppComponentFactoryStub"; final static public String PROXY_APP_COMPONENT_FACTORY = "org.lsposed.lspatch.metaloader.LSPAppComponentFactoryStub";
final static public String MANAGER_PACKAGE_NAME = "org.lsposed.lspatch"; final static public String MANAGER_PACKAGE_NAME = "org.lsposed.npatch";
final static public int MIN_ROLLING_VERSION_CODE = 348; final static public int MIN_ROLLING_VERSION_CODE = 348;
final static public int SIGBYPASS_LV_DISABLE = 0; final static public int SIGBYPASS_LV_DISABLE = 0;