Skip to content

AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.

fix(android): exclude sideload permission from Play builds

tianma-if7f8919b96348
diff --git a/apps/ios/Config/Version.xcconfig b/apps/ios/Config/Version.xcconfig
index 6c6d85b0..3ea4878f 100644
--- a/apps/ios/Config/Version.xcconfig
+++ b/apps/ios/Config/Version.xcconfig
@@ -6,6 +6,6 @@
// (App Store Connect → Xcode Cloud → Settings → Build Number). Keep that value
// ≥ this file and ≥ the latest ASC build. ci_pre_xcodebuild.sh also stamps
// CI_BUILD_NUMBER into the archive when present.
-// Last ASC store build: 33 (2026-08-18, Cloud + altool). Floor for next Cloud run: 34+.
-MARKETING_VERSION = 1.35.1
-CURRENT_PROJECT_VERSION = 34
+// Last completed ASC store build: 33 (2026-08-18, Cloud + altool). Build 35 was canceled; next Cloud run is 36+.
+MARKETING_VERSION = 1.35.2
+CURRENT_PROJECT_VERSION = 36
diff --git a/apps/ios/EdgeEver.xcodeproj/project.pbxproj b/apps/ios/EdgeEver.xcodeproj/project.pbxproj
index 1778e5d4..43ec5048 100644
--- a/apps/ios/EdgeEver.xcodeproj/project.pbxproj
+++ b/apps/ios/EdgeEver.xcodeproj/project.pbxproj
@@ -782,7 +782,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 34;
+ CURRENT_PROJECT_VERSION = 36;
DEVELOPMENT_TEAM = 9KA3NM38B6;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -795,7 +795,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
- MARKETING_VERSION = 1.35.1;
+ MARKETING_VERSION = 1.35.2;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -866,7 +866,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_STYLE = Automatic;
COPY_PHASE_STRIP = NO;
- CURRENT_PROJECT_VERSION = 34;
+ CURRENT_PROJECT_VERSION = 36;
DEVELOPMENT_TEAM = 9KA3NM38B6;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@@ -885,7 +885,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
- MARKETING_VERSION = 1.35.1;
+ MARKETING_VERSION = 1.35.2;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
diff --git a/apps/ios/project.yml b/apps/ios/project.yml
index 5944afbb..e1738867 100644
--- a/apps/ios/project.yml
+++ b/apps/ios/project.yml
@@ -20,8 +20,8 @@ settings:
TARGETED_DEVICE_FAMILY: "1"
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD: false
IPHONEOS_DEPLOYMENT_TARGET: "17.0"
- CURRENT_PROJECT_VERSION: 34
- MARKETING_VERSION: 1.35.1
+ CURRENT_PROJECT_VERSION: 36
+ MARKETING_VERSION: 1.35.2
# Automatic signing: required for Xcode Cloud (managed certs/profiles for
# App Store + Development exports). Local ExportOptions.plist still pins
# App Store profiles for Scripts/archive-app-store.sh export.
diff --git a/package.json b/package.json
index e74897a3..2a000259 100644
--- a/package.json
+++ b/package.json
@@ -53,7 +53,7 @@
"build:desktop": "EDGE_EVER_DESKTOP_BUILD=1 bun run prepare:desktop:icons && bun run build:web && bun run build:desktop:sidecar && bun run --cwd apps/desktop dist",
"benchmark:desktop:sidecar": "bun scripts/benchmark-desktop-sidecar.mjs",
"verify:web-performance": "bun scripts/verify-web-performance.mjs",
- "test:release-planning": "bun test scripts/plan-native-release.test.mjs scripts/check-native-release-assets.test.mjs scripts/create-mac-update-metadata.test.mjs scripts/desktop-build-workflow.test.mjs scripts/report-native-build-timings.test.mjs scripts/release.test.mjs scripts/validate-store-delivery.test.mjs scripts/store-delivery.test.mjs scripts/download-play-universal-apk.test.mjs scripts/verify-android-apk-signature.test.mjs scripts/desktop-icns.test.mjs scripts/preview-macos-dock-icon.test.mjs apps/web/src/lib/version-check.test.mjs apps/mobile/src/lib/mobile-release.test.ts",
+ "test:release-planning": "bun test scripts/plan-native-release.test.mjs scripts/check-native-release-assets.test.mjs scripts/create-mac-update-metadata.test.mjs scripts/desktop-build-workflow.test.mjs scripts/report-native-build-timings.test.mjs scripts/release.test.mjs scripts/validate-store-delivery.test.mjs scripts/store-delivery.test.mjs scripts/configure-android-package-permissions.test.mjs scripts/download-play-universal-apk.test.mjs scripts/verify-android-apk-signature.test.mjs scripts/desktop-icns.test.mjs scripts/preview-macos-dock-icon.test.mjs apps/web/src/lib/version-check.test.mjs apps/mobile/src/lib/mobile-release.test.ts",
"release": "bun scripts/release.mjs",
"publish:stores": "bun scripts/store-delivery.mjs",
"test:desktop:sidecar": "bun scripts/test-desktop-sidecar.mjs",
diff --git a/scripts/build-android-local.sh b/scripts/build-android-local.sh
index 6409b85c..dfa3393e 100755
--- a/scripts/build-android-local.sh
+++ b/scripts/build-android-local.sh
@@ -69,6 +69,17 @@ else
echo "跳过 Android prebuild:原生配置未变化。"
fi
+ANDROID_MANIFEST="$ANDROID_DIR/app/src/main/AndroidManifest.xml"
+if [[ "$MODE" == "play" ]]; then
+ run_timed "移除 Play 不需要的侧载安装权限" \
+ node "$PROJECT_ROOT/scripts/configure-android-package-permissions.mjs" \
+ "$ANDROID_MANIFEST" play
+else
+ run_timed "保留 APK 自更新所需的安装权限" \
+ node "$PROJECT_ROOT/scripts/configure-android-package-permissions.mjs" \
+ "$ANDROID_MANIFEST" sideload
+fi
+
cd "$ANDROID_DIR"
COMMON_ARGS=(
--build-cache
@@ -144,6 +155,12 @@ run_timed "Gradle 生产 AAB 构建" ./gradlew bundleRelease \
-Pandroid.injected.signing.store.type=PKCS12
AAB_PATH="app/build/outputs/bundle/release/app-release.aab"
+PACKAGED_MANIFEST="app/build/intermediates/packaged_manifests/release/processReleaseManifestForPackage/AndroidManifest.xml"
+test -s "$PACKAGED_MANIFEST"
+if grep -q "android.permission.REQUEST_INSTALL_PACKAGES" "$PACKAGED_MANIFEST"; then
+ echo "Play AAB 的最终合并清单仍包含 REQUEST_INSTALL_PACKAGES,停止发布。" >&2
+ exit 1
+fi
ACTUAL_PLAY_ARCHS="$(unzip -Z1 "$AAB_PATH" | sed -n 's#^base/lib/\([^/]*\)/.*#\1#p' | sort -u | paste -sd, -)"
if [[ "$ACTUAL_PLAY_ARCHS" != "$PLAY_ARCHS" ]]; then
echo "AAB 架构不符合预期:期望 ${PLAY_ARCHS},实际 ${ACTUAL_PLAY_ARCHS:-无原生库}。" >&2
diff --git a/scripts/configure-android-package-permissions.mjs b/scripts/configure-android-package-permissions.mjs
new file mode 100644
index 00000000..829aafe6
--- /dev/null
+++ b/scripts/configure-android-package-permissions.mjs
@@ -0,0 +1,57 @@
+import { readFile, writeFile } from "node:fs/promises";
+import { pathToFileURL } from "node:url";
+
+export const INSTALL_PACKAGES_PERMISSION =
+ "android.permission.REQUEST_INSTALL_PACKAGES";
+
+export function configurePackagePermissions(manifest, target) {
+ if (target !== "play" && target !== "sideload") {
+ throw new Error(`Unsupported Android distribution target: ${target}`);
+ }
+
+ const permissionPattern = new RegExp(
+ `^[\\t ]*<uses-permission\\s+android:name=["']${INSTALL_PACKAGES_PERMISSION}["'][^>]*\\/?>[\\t ]*\\r?\\n?`,
+ "gm",
+ );
+ const withoutInstallPermission = manifest.replace(permissionPattern, "");
+
+ if (target === "play") {
+ return withoutInstallPermission;
+ }
+
+ const manifestOpenTag = /<manifest\b[^>]*>\r?\n/;
+ if (!manifestOpenTag.test(withoutInstallPermission)) {
+ throw new Error("Android manifest is missing its opening <manifest> tag");
+ }
+
+ return withoutInstallPermission.replace(
+ manifestOpenTag,
+ (openTag) =>
+ `${openTag} <uses-permission android:name="${INSTALL_PACKAGES_PERMISSION}"/>\n`,
+ );
+}
+
+export async function configureManifestFile(manifestPath, target) {
+ const original = await readFile(manifestPath, "utf8");
+ const configured = configurePackagePermissions(original, target);
+ if (configured !== original) {
+ await writeFile(manifestPath, configured);
+ }
+}
+
+async function main(argv) {
+ const [manifestPath, target] = argv;
+ if (!manifestPath || !target) {
+ throw new Error(
+ "Usage: node scripts/configure-android-package-permissions.mjs <AndroidManifest.xml> <play|sideload>",
+ );
+ }
+ await configureManifestFile(manifestPath, target);
+}
+
+if (import.meta.url === pathToFileURL(process.argv[1]).href) {
+ main(process.argv.slice(2)).catch((error) => {
+ console.error(error instanceof Error ? error.message : String(error));
+ process.exitCode = 1;
+ });
+}
diff --git a/scripts/configure-android-package-permissions.test.mjs b/scripts/configure-android-package-permissions.test.mjs
new file mode 100644
index 00000000..39ffad26
--- /dev/null
+++ b/scripts/configure-android-package-permissions.test.mjs
@@ -0,0 +1,40 @@
+import { describe, expect, test } from "bun:test";
+import {
+ configurePackagePermissions,
+ INSTALL_PACKAGES_PERMISSION,
+} from "./configure-android-package-permissions.mjs";
+
+const baseManifest = `<manifest xmlns:android="http://schemas.android.com/apk/res/android">
+ <uses-permission android:name="android.permission.INTERNET"/>
+ <application android:name=".MainApplication"/>
+</manifest>
+`;
+
+describe("Android package permission configuration", () => {
+ test("removes the sideload-only install permission from Play builds", () => {
+ const configured = configurePackagePermissions(
+ baseManifest.replace(
+ " <application",
+ ` <uses-permission android:name="${INSTALL_PACKAGES_PERMISSION}"/>\n <application`,
+ ),
+ "play",
+ );
+
+ expect(configured).not.toContain(INSTALL_PACKAGES_PERMISSION);
+ expect(configured).toContain("android.permission.INTERNET");
+ });
+
+ test("adds the install permission to sideload builds", () => {
+ const configured = configurePackagePermissions(baseManifest, "sideload");
+
+ expect(configured).toContain(INSTALL_PACKAGES_PERMISSION);
+ });
+
+ test("keeps sideload configuration idempotent", () => {
+ const configured = configurePackagePermissions(baseManifest, "sideload");
+ const configuredAgain = configurePackagePermissions(configured, "sideload");
+
+ expect(configuredAgain).toBe(configured);
+ expect(configuredAgain.match(/REQUEST_INSTALL_PACKAGES/g)).toHaveLength(1);
+ });
+});
diff --git a/scripts/plan-native-release.mjs b/scripts/plan-native-release.mjs
index fa08d4da..ec82ba13 100644
--- a/scripts/plan-native-release.mjs
+++ b/scripts/plan-native-release.mjs
@@ -42,6 +42,7 @@ export const planNativeRelease = (platform, changedFiles) => {
".github/workflows/store-delivery.yml",
"bun.lock",
"scripts/build-android-local.sh",
+ "scripts/configure-android-package-permissions.mjs",
"scripts/download-play-universal-apk.mjs",
"scripts/verify-android-apk-signature.mjs",
...mobileOnlyDependencyPatches,
diff --git a/scripts/plan-native-release.test.mjs b/scripts/plan-native-release.test.mjs
index e694b122..cee8be53 100644
--- a/scripts/plan-native-release.test.mjs
+++ b/scripts/plan-native-release.test.mjs
@@ -19,6 +19,7 @@ describe("native release planning", () => {
"packages/shared/src/index.ts",
"bun.lock",
"scripts/build-android-local.sh",
+ "scripts/configure-android-package-permissions.mjs",
"scripts/verify-android-apk-signature.mjs",
".github/workflows/mobile-build.yml",
".github/workflows/store-delivery.yml",
diff --git a/scripts/release.mjs b/scripts/release.mjs
index b882cfc6..12e8660d 100644
--- a/scripts/release.mjs
+++ b/scripts/release.mjs
@@ -42,6 +42,7 @@ export const RELEASE_VALIDATIONS = [
"scripts/release.test.mjs",
"scripts/validate-store-delivery.test.mjs",
"scripts/store-delivery.test.mjs",
+ "scripts/configure-android-package-permissions.test.mjs",
"scripts/download-play-universal-apk.test.mjs",
"scripts/desktop-icns.test.mjs",
"apps/web/src/lib/version-check.test.mjs",
diff --git a/scripts/store-delivery.test.mjs b/scripts/store-delivery.test.mjs
index 21547324..075b76e2 100644
--- a/scripts/store-delivery.test.mjs
+++ b/scripts/store-delivery.test.mjs
@@ -76,4 +76,18 @@ describe("store delivery command", () => {
expect(buildScript).not.toContain("EDGE_EVER_ANDROID_ARCHS:-");
expect(buildScript).not.toContain("armeabi-v7a,arm64-v8a,x86,x86_64");
});
+
+ test("removes the sideload-only install permission from Play bundles", () => {
+ const buildScript = readFileSync(
+ new URL("./build-android-local.sh", import.meta.url),
+ "utf8",
+ );
+
+ expect(buildScript).toContain('if [[ "$MODE" == "play" ]]');
+ expect(buildScript).toContain('"$ANDROID_MANIFEST" play');
+ expect(buildScript).toContain('"$ANDROID_MANIFEST" sideload');
+ expect(buildScript).toContain(
+ 'grep -q "android.permission.REQUEST_INSTALL_PACKAGES" "$PACKAGED_MANIFEST"',
+ );
+ });
});