1e41f4b71Sopenharmony_ci# Ability Subsystem Changelog 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci## cl.ability.1 API restartApp Changed 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci**Access Level** 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ciPublic API 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci**Reason for Change** 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ciThe change is made to prevent malicious applications from restarting themselves when they do not gain focus. 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci**Change Impact** 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ciThis change is a non-compatible change. An application should call the **restartApp** API when it is in the focus state. Otherwise, functions will be affected. 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci**Start API Level** 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci12 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci**Change Since** 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ciOpenHarmony SDK 5.0.0.31 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci**Adaptation Guide** 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ciCall the **restartApp** API when the application is in the focus state. 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci**Example** 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ci```ts 32e41f4b71Sopenharmony_ciimport { UIAbility, Want } from '@kit.AbilityKit'; 33e41f4b71Sopenharmony_ci 34e41f4b71Sopenharmony_ciexport default class MyAbility extends UIAbility { 35e41f4b71Sopenharmony_ci onForeground() { 36e41f4b71Sopenharmony_ci let applicationContext = this.context.getApplicationContext(); 37e41f4b71Sopenharmony_ci let want: Want = { 38e41f4b71Sopenharmony_ci bundleName: 'com.example.myapp', 39e41f4b71Sopenharmony_ci abilityName: 'EntryAbility' 40e41f4b71Sopenharmony_ci }; 41e41f4b71Sopenharmony_ci try { 42e41f4b71Sopenharmony_ci applicationContext.restartApp(want); 43e41f4b71Sopenharmony_ci } catch (error) { 44e41f4b71Sopenharmony_ci console.error(`restartApp fail, error: ${JSON.stringify(error)}`); 45e41f4b71Sopenharmony_ci } 46e41f4b71Sopenharmony_ci } 47e41f4b71Sopenharmony_ci} 48e41f4b71Sopenharmony_ci``` 49