[tauri] TauriPlatforms: Read the built APK's own values, carry Rosea's launcher icon into gen/android, survive a dropped USB link
This commit is contained in:
@@ -7,6 +7,7 @@ import { dirname, join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import {
|
||||
apkProblems,
|
||||
APPLICATION_ATTRS,
|
||||
DOMAINS,
|
||||
manifestProblems,
|
||||
@@ -136,3 +137,44 @@ describe('the committed rule files', () => {
|
||||
expect(DOMAINS).toHaveLength(9);
|
||||
});
|
||||
});
|
||||
|
||||
describe('apkProblems, on aapt2 output of the APK built 2026-11-17 (Tauri 2.12.5, AGP 9.3.1)', () => {
|
||||
const permissions = readFileSync(join(HERE, 'fixtures', 'apk-permissions.txt'), 'utf8');
|
||||
const tree = readFileSync(join(HERE, 'fixtures', 'apk-manifest.xmltree.txt'), 'utf8');
|
||||
|
||||
it('passes the patched APK: no permission asked but androidx own receiver guard', () => {
|
||||
expect(apkProblems(permissions, tree)).toEqual([]);
|
||||
});
|
||||
|
||||
it('names INTERNET, or any permission a library merges in', () => {
|
||||
const more = `${permissions.trimEnd()}\nuses-permission: name='android.permission.INTERNET'\nuses-permission: name='android.permission.ACCESS_NETWORK_STATE'\n`;
|
||||
expect(apkProblems(more, tree)).toEqual([
|
||||
'the APK asks for android.permission.INTERNET',
|
||||
'the APK asks for android.permission.ACCESS_NETWORK_STATE'
|
||||
]);
|
||||
});
|
||||
|
||||
it("does not let another app's receiver guard through", () => {
|
||||
const other = `${permissions.trimEnd()}\nuses-permission: name='com.example.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION'\n`;
|
||||
expect(apkProblems(other, tree)).toEqual(['the APK asks for com.example.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION']);
|
||||
});
|
||||
|
||||
it('names backup left on', () => {
|
||||
expect(apkProblems(permissions, tree.replace(/allowBackup\((0x[0-9a-f]+)\)=false/, 'allowBackup($1)=true'))).toEqual([
|
||||
'the APK does not set allowBackup=false'
|
||||
]);
|
||||
});
|
||||
|
||||
it("reads each WebView switch's own value, not its neighbour's", () => {
|
||||
const flipped = tree.replace(
|
||||
/("android\.webkit\.WebView\.EnableSafeBrowsing"[^\n]*\r?\n\s*A: [^\n]*:value\(0x[0-9a-f]+\))=false/,
|
||||
'$1=true'
|
||||
);
|
||||
expect(flipped).not.toBe(tree);
|
||||
expect(apkProblems(permissions, flipped)).toEqual([
|
||||
"the APK's meta-data android.webkit.WebView.EnableSafeBrowsing is true, not false"
|
||||
]);
|
||||
const gone = tree.replace('"android.webkit.WebView.MetricsOptOut"', '"android.webkit.WebView.Something"');
|
||||
expect(apkProblems(permissions, gone)).toEqual(['the APK has no meta-data android.webkit.WebView.MetricsOptOut']);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
N: android=http://schemas.android.com/apk/res/android (line=2)
|
||||
E: manifest (line=2)
|
||||
A: http://schemas.android.com/apk/res/android:versionCode(0x0101021b)=1000
|
||||
A: http://schemas.android.com/apk/res/android:versionName(0x0101021c)="0.1.0" (Raw: "0.1.0")
|
||||
A: http://schemas.android.com/apk/res/android:compileSdkVersion(0x01010572)=37
|
||||
A: http://schemas.android.com/apk/res/android:compileSdkVersionCodename(0x01010573)="17" (Raw: "17")
|
||||
A: package="cz.mareknovak.domi.rosea" (Raw: "cz.mareknovak.domi.rosea")
|
||||
A: platformBuildVersionCode=37
|
||||
A: platformBuildVersionName=17
|
||||
E: uses-sdk (line=7)
|
||||
A: http://schemas.android.com/apk/res/android:minSdkVersion(0x0101020c)=24
|
||||
A: http://schemas.android.com/apk/res/android:targetSdkVersion(0x01010270)=37
|
||||
E: uses-feature (line=12)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="android.software.leanback" (Raw: "android.software.leanback")
|
||||
A: http://schemas.android.com/apk/res/android:required(0x0101028e)=false
|
||||
E: permission (line=16)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="cz.mareknovak.domi.rosea.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION" (Raw: "cz.mareknovak.domi.rosea.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION")
|
||||
A: http://schemas.android.com/apk/res/android:protectionLevel(0x01010009)=0x00000002
|
||||
E: uses-permission (line=20)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="cz.mareknovak.domi.rosea.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION" (Raw: "cz.mareknovak.domi.rosea.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION")
|
||||
E: application (line=22)
|
||||
A: http://schemas.android.com/apk/res/android:theme(0x01010000)=@0x7f100274
|
||||
A: http://schemas.android.com/apk/res/android:label(0x01010001)=@0x7f0f001c
|
||||
A: http://schemas.android.com/apk/res/android:icon(0x01010002)=@0x7f0d0000
|
||||
A: http://schemas.android.com/apk/res/android:debuggable(0x0101000f)=true
|
||||
A: http://schemas.android.com/apk/res/android:allowBackup(0x01010280)=false
|
||||
A: http://schemas.android.com/apk/res/android:extractNativeLibs(0x010104ea)=false
|
||||
A: http://schemas.android.com/apk/res/android:fullBackupContent(0x010104eb)=@0x7f120001
|
||||
A: http://schemas.android.com/apk/res/android:usesCleartextTraffic(0x010104ec)=true
|
||||
A: http://schemas.android.com/apk/res/android:appComponentFactory(0x0101057a)="androidx.core.app.CoreComponentFactory" (Raw: "androidx.core.app.CoreComponentFactory")
|
||||
A: http://schemas.android.com/apk/res/android:dataExtractionRules(0x0101063e)=@0x7f120002
|
||||
E: activity (line=33)
|
||||
A: http://schemas.android.com/apk/res/android:label(0x01010001)=@0x7f0f0047
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="cz.mareknovak.domi.rosea.MainActivity" (Raw: "cz.mareknovak.domi.rosea.MainActivity")
|
||||
A: http://schemas.android.com/apk/res/android:exported(0x01010010)=true
|
||||
A: http://schemas.android.com/apk/res/android:launchMode(0x0101001d)=2
|
||||
A: http://schemas.android.com/apk/res/android:configChanges(0x0101001f)=0x00000fb4
|
||||
E: intent-filter (line=39)
|
||||
E: action (line=40)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
|
||||
E: category (line=42)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
|
||||
E: category (line=44)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="android.intent.category.LEANBACK_LAUNCHER" (Raw: "android.intent.category.LEANBACK_LAUNCHER")
|
||||
E: provider (line=48)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="androidx.core.content.FileProvider" (Raw: "androidx.core.content.FileProvider")
|
||||
A: http://schemas.android.com/apk/res/android:exported(0x01010010)=false
|
||||
A: http://schemas.android.com/apk/res/android:authorities(0x01010018)="cz.mareknovak.domi.rosea.fileprovider" (Raw: "cz.mareknovak.domi.rosea.fileprovider")
|
||||
A: http://schemas.android.com/apk/res/android:grantUriPermissions(0x0101001b)=true
|
||||
E: meta-data (line=53)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="android.support.FILE_PROVIDER_PATHS" (Raw: "android.support.FILE_PROVIDER_PATHS")
|
||||
A: http://schemas.android.com/apk/res/android:resource(0x01010025)=@0x7f120000
|
||||
E: meta-data (line=58)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="android.webkit.WebView.EnableSafeBrowsing" (Raw: "android.webkit.WebView.EnableSafeBrowsing")
|
||||
A: http://schemas.android.com/apk/res/android:value(0x01010024)=false
|
||||
E: meta-data (line=61)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="android.webkit.WebView.MetricsOptOut" (Raw: "android.webkit.WebView.MetricsOptOut")
|
||||
A: http://schemas.android.com/apk/res/android:value(0x01010024)=true
|
||||
E: provider (line=65)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="androidx.startup.InitializationProvider" (Raw: "androidx.startup.InitializationProvider")
|
||||
A: http://schemas.android.com/apk/res/android:exported(0x01010010)=false
|
||||
A: http://schemas.android.com/apk/res/android:authorities(0x01010018)="cz.mareknovak.domi.rosea.androidx-startup" (Raw: "cz.mareknovak.domi.rosea.androidx-startup")
|
||||
E: meta-data (line=69)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="androidx.emoji2.text.EmojiCompatInitializer" (Raw: "androidx.emoji2.text.EmojiCompatInitializer")
|
||||
A: http://schemas.android.com/apk/res/android:value(0x01010024)="androidx.startup" (Raw: "androidx.startup")
|
||||
E: meta-data (line=72)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="androidx.lifecycle.ProcessLifecycleInitializer" (Raw: "androidx.lifecycle.ProcessLifecycleInitializer")
|
||||
A: http://schemas.android.com/apk/res/android:value(0x01010024)="androidx.startup" (Raw: "androidx.startup")
|
||||
E: meta-data (line=75)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="androidx.profileinstaller.ProfileInstallerInitializer" (Raw: "androidx.profileinstaller.ProfileInstallerInitializer")
|
||||
A: http://schemas.android.com/apk/res/android:value(0x01010024)="androidx.startup" (Raw: "androidx.startup")
|
||||
E: receiver (line=80)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="androidx.profileinstaller.ProfileInstallReceiver" (Raw: "androidx.profileinstaller.ProfileInstallReceiver")
|
||||
A: http://schemas.android.com/apk/res/android:permission(0x01010006)="android.permission.DUMP" (Raw: "android.permission.DUMP")
|
||||
A: http://schemas.android.com/apk/res/android:enabled(0x0101000e)=true
|
||||
A: http://schemas.android.com/apk/res/android:exported(0x01010010)=true
|
||||
A: http://schemas.android.com/apk/res/android:directBootAware(0x01010505)=false
|
||||
E: intent-filter (line=86)
|
||||
E: action (line=87)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="androidx.profileinstaller.action.INSTALL_PROFILE" (Raw: "androidx.profileinstaller.action.INSTALL_PROFILE")
|
||||
E: intent-filter (line=89)
|
||||
E: action (line=90)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="androidx.profileinstaller.action.SKIP_FILE" (Raw: "androidx.profileinstaller.action.SKIP_FILE")
|
||||
E: intent-filter (line=92)
|
||||
E: action (line=93)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="androidx.profileinstaller.action.SAVE_PROFILE" (Raw: "androidx.profileinstaller.action.SAVE_PROFILE")
|
||||
E: intent-filter (line=95)
|
||||
E: action (line=96)
|
||||
A: http://schemas.android.com/apk/res/android:name(0x01010003)="androidx.profileinstaller.action.BENCHMARK_OPERATION" (Raw: "androidx.profileinstaller.action.BENCHMARK_OPERATION")
|
||||
@@ -0,0 +1,3 @@
|
||||
package: cz.mareknovak.domi.rosea
|
||||
permission: cz.mareknovak.domi.rosea.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION
|
||||
uses-permission: name='cz.mareknovak.domi.rosea.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION'
|
||||
Reference in New Issue
Block a user