mirror of
https://github.com/bulwarkmail/native.git
synced 2026-11-01 00:07:01 +00:00
fix: stop the app from crashing at launch on android 14 and later
This commit is contained in:
@@ -9,8 +9,9 @@
|
||||
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" tools:node="remove"/>
|
||||
<!-- expo-camera declares the microphone for video; QR scanning never records audio. -->
|
||||
<uses-permission android:name="android.permission.RECORD_AUDIO" tools:node="remove"/>
|
||||
<!-- expo-screen-capture declares it for its screenshot listener; the app only blocks capture. -->
|
||||
<uses-permission android:name="android.permission.DETECT_SCREEN_CAPTURE" tools:node="remove"/>
|
||||
<!-- expo-screen-capture registers its screenshot listener on Android 14+ as soon
|
||||
as it loads; without this permission the app crashes at launch. -->
|
||||
<uses-permission android:name="android.permission.DETECT_SCREEN_CAPTURE"/>
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
<!-- Device sync (#34): contacts and calendars in Android's providers, driven by the sync framework. -->
|
||||
<uses-permission android:name="android.permission.READ_CONTACTS"/>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
// expo-screen-capture calls Activity.registerScreenCaptureCallback on
|
||||
// Android 14+ when its module loads. With DETECT_SCREEN_CAPTURE removed from
|
||||
// the manifest that throws a SecurityException and the app crashed at launch.
|
||||
|
||||
const root = path.resolve(__dirname, '../../..');
|
||||
|
||||
describe('screen capture permission', () => {
|
||||
it('keeps DETECT_SCREEN_CAPTURE while expo-screen-capture is a dependency', () => {
|
||||
const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
|
||||
expect(pkg.dependencies['expo-screen-capture']).toBeTruthy();
|
||||
const manifest = fs.readFileSync(path.join(root, 'android/app/src/main/AndroidManifest.xml'), 'utf8');
|
||||
expect(manifest).toMatch(/<uses-permission android:name="android\.permission\.DETECT_SCREEN_CAPTURE"\s*\/>/);
|
||||
expect(manifest).not.toMatch(/DETECT_SCREEN_CAPTURE"\s+tools:node="remove"/);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user