diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 5fd3bee1..a508ba48 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -9,8 +9,9 @@ - - + + diff --git a/src/lib/__tests__/screen-capture-permission.test.ts b/src/lib/__tests__/screen-capture-permission.test.ts new file mode 100644 index 00000000..982dca6e --- /dev/null +++ b/src/lib/__tests__/screen-capture-permission.test.ts @@ -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(//); + expect(manifest).not.toMatch(/DETECT_SCREEN_CAPTURE"\s+tools:node="remove"/); + }); +});