-
-
Notifications
You must be signed in to change notification settings - Fork 6
feat(android): add "Don't keep activities" functionality #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
lib/android-controller.ts
Outdated
|
||
public static setDontKeepActivities(value: boolean, device: IDevice) { | ||
let status: 0 | 1; | ||
value ? status = 1 : status = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const status = value ? 1 : 0;
lib/android-controller.ts
Outdated
value ? status = 1 : status = 0; | ||
|
||
const prefix = AndroidController.gettokenPrefix(device.type); | ||
executeCommand(AndroidController.ADB + ` -s ${prefix}${device.token} shell service call activity 43 i32 ${status}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
`${AndroidController.ADB} -s ${prefix}${device.token} shell service call activity 43 i32 ${status}`
lib/android-controller.ts
Outdated
executeCommand(AndroidController.ADB + ` -s ${prefix}${device.token} shell service call activity 43 i32 ${status}`); | ||
|
||
if (this.getAlwaysFinishActivitiesGlobalSettingsValue(device) !== value) { | ||
throw new Error(`Failed to set \"Don't keep activities\" to ${value}!`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to escape the quotes when using backticks (`).
lib/android-controller.ts
Outdated
|
||
private static getAlwaysFinishActivitiesGlobalSettingsValue(device: IDevice): boolean { | ||
const prefix = AndroidController.gettokenPrefix(device.type); | ||
return executeCommand(AndroidController.ADB + " -s " + `${prefix}${device.token}` + " shell settings get global always_finish_activities").trim() === "1"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can move the command to a variable.
Also you can move the result of the execution to a variable.
AndroidController.ADB + " -s " + `${prefix}${device.token}` + " shell settings get global always_finish_activities"
-->
`${AndroidController.ADB} -s ${prefix}${device.token} shell settings get global always_finish_activities`
This allows you to turn on/off "Don't keep activities" setting in the Developer options for Android.
fcb961c
to
4649708
Compare
Ping @sis0k0 and @SvetoslavTsenov. |
d2c3508
to
d64efd1
Compare
This allows you to turn on/off "Don't keep activities" setting in the Developer options for Android.