[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']);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user