Skip to content

Commit b973ec7

Browse files
committed
fix(android): retain rebind record cleanup diagnostics
1 parent a8acc11 commit b973ec7

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

‎packages/platform-android/src/ime-rebind.ts‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
resolveAndroidAdbProvider,
77
runAdbShell,
88
} from './adb-provider-scope.ts';
9+
import type { AndroidAdbExecutor } from './adb-transport.ts';
910
import { selectAndroidImeHelperArtifact } from './ime-helper.ts';
1011
import {
1112
clearPersistedRebindDisplacement,
@@ -55,7 +56,7 @@ export async function rebindAndroidTestIme(
5556
return unconfirmed(device.id, activeIme ? 'helper-not-selected' : 'read-failed');
5657
}
5758
// Failed cleanup keeps admission on the rebind path even with the helper selected.
58-
ownership.rebindUnconfirmed = !(await clearPersistedRebindDisplacement(adb));
59+
ownership.rebindUnconfirmed = !(await clearRebindRecord(adb, device.id));
5960
return { kind: 'confirmed' };
6061
} catch (error) {
6162
if (isRequestCanceledError(error)) throw error;
@@ -75,3 +76,14 @@ function unconfirmed(
7576
});
7677
return { kind: 'unconfirmed', cause };
7778
}
79+
80+
async function clearRebindRecord(adb: AndroidAdbExecutor, deviceId: string): Promise<boolean> {
81+
const cleared = await clearPersistedRebindDisplacement(adb);
82+
if (!cleared)
83+
emitAndroidAdbDiagnostic({
84+
level: 'warn',
85+
phase: 'android_test_ime_rebind_record_clear_failed',
86+
data: { device: deviceId },
87+
});
88+
return cleared;
89+
}

‎packages/platform-android/src/ime-restore.test.ts‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -102,17 +102,6 @@ test('a failed restore keeps the record and the marker for a later retry', async
102102
expect([...(host.markerStore.get(STATE_DIR) ?? [])]).toEqual([DEVICE.id]);
103103
});
104104

105-
test('close leaves the user-selected keyboard alone', async () => {
106-
bindAndroidAdbHostStub();
107-
setAndroidTestImeActiveForTests(DEVICE, true);
108-
const state = stuckDeviceState();
109-
state.settings.set('default_input_method', 'com.android.inputmethod.latin/.LatinIME');
110-
expect(await restoreWith(state)).toMatchObject({ reason: 'helper-not-active' });
111-
expect(state.settings.get('default_input_method')).toBe(
112-
'com.android.inputmethod.latin/.LatinIME',
113-
);
114-
});
115-
116105
test('devices this process never activated are left alone', async () => {
117106
bindAndroidAdbHostStub();
118107
const state = stuckDeviceState();

0 commit comments

Comments
 (0)