@@ -16,7 +16,7 @@ import {
1616import {
1717 resetAndroidTestImeActivationCacheForTests ,
1818 setAndroidTestImeActiveForTests ,
19- testImeLastRestoreAtMs ,
19+ testImeLastRestoreAtPerfMs ,
2020} from './ime-state.ts' ;
2121import { fakeImeDeviceAdb , type FakeImeDeviceState } from './ime-device.fixtures.ts' ;
2222
@@ -190,7 +190,7 @@ describe('a close cancelled mid-settle', () => {
190190 // monotonic timestamp keeps the remaining wait derivable for the next kill-bound caller.
191191 expect ( result ) . toMatchObject ( { restored : true , reason : 'ok' } ) ;
192192 expect ( [ ...( host . markerStore . get ( STATE_DIR ) ?? [ ] ) ] ) . toEqual ( [ DEVICE . id ] ) ;
193- expect ( [ ...testImeLastRestoreAtMs . keys ( ) ] ) . toEqual ( [ DEVICE . id ] ) ;
193+ expect ( [ ...testImeLastRestoreAtPerfMs . keys ( ) ] ) . toEqual ( [ DEVICE . id ] ) ;
194194 } ) ;
195195
196196 test ( 'a second close waits out the remaining window before it may return to the kill' , async ( ) => {
@@ -234,7 +234,7 @@ describe('a close cancelled mid-settle', () => {
234234 expect ( sleep ) . toHaveBeenCalledTimes ( 1 ) ;
235235 expect ( sleep . mock . calls [ 0 ] ?. [ 0 ] ) . toBeGreaterThan ( 0 ) ;
236236 expect ( sleep . mock . calls [ 0 ] ?. [ 1 ] ) . toBe ( second . signal ) ;
237- expect ( [ ...testImeLastRestoreAtMs . keys ( ) ] ) . toEqual ( [ ] ) ;
237+ expect ( [ ...testImeLastRestoreAtPerfMs . keys ( ) ] ) . toEqual ( [ ] ) ;
238238 expect ( [ ...( host . markerStore . get ( STATE_DIR ) ?? [ ] ) ] ) . toEqual ( [ ] ) ;
239239 } ) ;
240240
@@ -244,7 +244,7 @@ describe('a close cancelled mid-settle', () => {
244244 // A window from an earlier aborted close still has most of its budget left when this close's
245245 // own restore writes again. SettingsState rewrites the whole file, so one wait to the newer
246246 // write's window persists both writes — the timestamp takes the max, never a second entry.
247- testImeLastRestoreAtMs . set ( DEVICE . id , performance . now ( ) - 100 ) ;
247+ testImeLastRestoreAtPerfMs . set ( DEVICE . id , performance . now ( ) - 100 ) ;
248248
249249 const result = await withAndroidAdbProvider (
250250 { exec : fakeImeDeviceAdb ( stuckDeviceState ( ) ) } ,
@@ -256,14 +256,14 @@ describe('a close cancelled mid-settle', () => {
256256 expect ( result ) . toMatchObject ( { restored : true , reason : 'ok' } ) ;
257257 expect ( sleep ) . toHaveBeenCalledTimes ( 1 ) ;
258258 expect ( sleep . mock . calls [ 0 ] ?. [ 0 ] ) . toBeGreaterThan ( 2_000 ) ;
259- expect ( [ ...testImeLastRestoreAtMs . keys ( ) ] ) . toEqual ( [ ] ) ;
259+ expect ( [ ...testImeLastRestoreAtPerfMs . keys ( ) ] ) . toEqual ( [ ] ) ;
260260 } ) ;
261261
262262 test ( 'a second close after the window already elapsed skips the wait' , async ( ) => {
263263 const host = bindAndroidAdbHostStub ( ) ;
264264 await host . imeRecoveryMarkers . write ( STATE_DIR , DEVICE . id ) ;
265265 // A restore whose whole flush window has already passed.
266- testImeLastRestoreAtMs . set ( DEVICE . id , performance . now ( ) - 2_501 ) ;
266+ testImeLastRestoreAtPerfMs . set ( DEVICE . id , performance . now ( ) - 2_501 ) ;
267267
268268 const result = await withAndroidAdbProvider (
269269 { exec : fakeImeDeviceAdb ( stuckDeviceState ( ) ) } ,
@@ -274,7 +274,7 @@ describe('a close cancelled mid-settle', () => {
274274
275275 expect ( result ) . toEqual ( { restored : false , reason : 'not-activated-here' } ) ;
276276 expect ( sleep ) . not . toHaveBeenCalled ( ) ;
277- expect ( [ ...testImeLastRestoreAtMs . keys ( ) ] ) . toEqual ( [ ] ) ;
277+ expect ( [ ...testImeLastRestoreAtPerfMs . keys ( ) ] ) . toEqual ( [ ] ) ;
278278 // Load-bearing on this close: it inspected nothing (not-activated-here), and covering the
279279 // window a confirmed restore had opened is the only thing that earns clearing this marker.
280280 expect ( [ ...( host . markerStore . get ( STATE_DIR ) ?? [ ] ) ] ) . toEqual ( [ ] ) ;
@@ -283,7 +283,7 @@ describe('a close cancelled mid-settle', () => {
283283 test ( 'an ordinary close never waits on a pending window it cannot race' , async ( ) => {
284284 const host = bindAndroidAdbHostStub ( ) ;
285285 await host . imeRecoveryMarkers . write ( STATE_DIR , DEVICE . id ) ;
286- testImeLastRestoreAtMs . set ( DEVICE . id , performance . now ( ) ) ;
286+ testImeLastRestoreAtPerfMs . set ( DEVICE . id , performance . now ( ) ) ;
287287
288288 const result = await withAndroidAdbProvider (
289289 { exec : fakeImeDeviceAdb ( stuckDeviceState ( ) ) } ,
@@ -294,7 +294,7 @@ describe('a close cancelled mid-settle', () => {
294294 expect ( result ) . toEqual ( { restored : false , reason : 'not-activated-here' } ) ;
295295 expect ( sleep ) . not . toHaveBeenCalled ( ) ;
296296 // An ordinary close consumes nothing and inspects nothing: both stay for the next caller.
297- expect ( [ ...testImeLastRestoreAtMs . keys ( ) ] ) . toEqual ( [ DEVICE . id ] ) ;
297+ expect ( [ ...testImeLastRestoreAtPerfMs . keys ( ) ] ) . toEqual ( [ DEVICE . id ] ) ;
298298 expect ( [ ...( host . markerStore . get ( STATE_DIR ) ?? [ ] ) ] ) . toEqual ( [ DEVICE . id ] ) ;
299299 } ) ;
300300} ) ;
@@ -313,7 +313,7 @@ test('an ordinary close restores without any flush wait but registers the window
313313 expect ( sleep ) . not . toHaveBeenCalled ( ) ;
314314 // Registration is what lets a later kill-bound close — including another session's — see the
315315 // window this restore opened.
316- expect ( [ ...testImeLastRestoreAtMs . keys ( ) ] ) . toEqual ( [ DEVICE . id ] ) ;
316+ expect ( [ ...testImeLastRestoreAtPerfMs . keys ( ) ] ) . toEqual ( [ DEVICE . id ] ) ;
317317} ) ;
318318
319319test ( "a kill-bound close after another close's restore waits out the registered window" , async ( ) => {
@@ -335,7 +335,7 @@ test("a kill-bound close after another close's restore waits out the registered
335335 // 'ok' with no wait owed — is what this asserts; the clear-not-earned branches live in the
336336 // cancelled-mid-settle suite, where the first close leaves the marker in place.)
337337 expect ( [ ...( host . markerStore . get ( STATE_DIR ) ?? [ ] ) ] ) . toEqual ( [ ] ) ;
338- expect ( [ ...testImeLastRestoreAtMs . keys ( ) ] ) . toEqual ( [ DEVICE . id ] ) ;
338+ expect ( [ ...testImeLastRestoreAtPerfMs . keys ( ) ] ) . toEqual ( [ DEVICE . id ] ) ;
339339
340340 sleep . mockClear ( ) ;
341341 const result = await withAndroidAdbProvider (
@@ -349,7 +349,7 @@ test("a kill-bound close after another close's restore waits out the registered
349349 expect ( result ) . toEqual ( { restored : false , reason : 'not-activated-here' } ) ;
350350 expect ( sleep ) . toHaveBeenCalledTimes ( 1 ) ;
351351 expect ( sleep . mock . calls [ 0 ] ?. [ 0 ] ) . toBeGreaterThan ( 0 ) ;
352- expect ( [ ...testImeLastRestoreAtMs . keys ( ) ] ) . toEqual ( [ ] ) ;
352+ expect ( [ ...testImeLastRestoreAtPerfMs . keys ( ) ] ) . toEqual ( [ ] ) ;
353353} ) ;
354354
355355test ( 'a shutdown of a physical device restores without any flush wait' , async ( ) => {
@@ -423,7 +423,7 @@ test.each([false, true])('startup recovers a stuck orphan with displaced=%s', as
423423 // The startup path writes `ime set` like any other restore, so it owes the same flush window:
424424 // a later kill-bound path (close --shutdown or the shutdown runtime) must not land inside it.
425425 // Registration is synchronous — daemon boot never pays a sleep for the window.
426- expect ( [ ...testImeLastRestoreAtMs . keys ( ) ] ) . toEqual ( [ DEVICE . id ] ) ;
426+ expect ( [ ...testImeLastRestoreAtPerfMs . keys ( ) ] ) . toEqual ( [ DEVICE . id ] ) ;
427427 expect ( sleep ) . not . toHaveBeenCalled ( ) ;
428428 expect ( host . diagnostics ) . toContainEqual ( {
429429 phase : 'android_test_ime_orphan_restored' ,
0 commit comments