mirror of
https://git.undefined-dev.fr/Blendman974/faceclaw.git
synced 2026-11-19 21:03:09 +00:00
Correct how the app ends up with no Activity
The previous commit's comment and test said Android starts the app in the background (a home-widget update, a notification-listener rebind) with the glasses session running. A background start alone doesn't connect the glasses; only the main page does. The state that breaks voice is the Activity being destroyed afterwards: swiping the app away in Recents destroys it while the foreground service keeps the process and session running, and NativeScript then clears both foregroundActivity and startActivity. On Android 12+ Back on the main page only moves the task to the back, so the Activity survives it. Comment and test wording only.
This commit is contained in:
1 parent
9fac7a29ba
commit
bdf4fc2f1d
2 files changed
+9
-8
No files matched your search
@@ -8,9 +8,10 @@ const RECORD_AUDIO = 'android.permission.RECORD_AUDIO';
|
||||
|
||||
/**
|
||||
* app/g2/android-permissions.ts against a stubbed Android: `granted` is the set
|
||||
* of permissions already held, `activity` the foreground/start Activity (null
|
||||
* when Android started the process in the background, e.g. for a home-widget
|
||||
* update, and the app has not been opened yet).
|
||||
* of permissions already held, `activity` the foreground/start Activity. It is
|
||||
* null once the app's Activity is destroyed (swiped away in Recents) while the
|
||||
* foreground service keeps the process and the glasses session running:
|
||||
* NativeScript then clears both foregroundActivity and startActivity.
|
||||
*/
|
||||
function permissions({ granted = [], activity = null } = {}) {
|
||||
const held = new Set(granted);
|
||||
@@ -45,7 +46,7 @@ function permissions({ granted = [], activity = null } = {}) {
|
||||
return { api: load('app/g2/android-permissions.ts'), requests };
|
||||
}
|
||||
|
||||
test('a granted permission needs no Activity, so voice works after a background start', async () => {
|
||||
test('a granted permission needs no Activity, so voice works after the app is swiped away', async () => {
|
||||
const { api, requests } = permissions({ granted: [RECORD_AUDIO], activity: null });
|
||||
await api.ensureVoicePermissions();
|
||||
assert.equal(requests.length, 0);
|
||||
|
||||
Reference in new issue
Block a user