Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fe2840ea authored by Jackeagle's avatar Jackeagle
Browse files

Fix unlock/lock timeout: use 5-minute timeout for user-interactive commands



The flashing unlock/lock commands show a confirmation screen on the device
requiring physical button presses. The default 30s command timeout is not
enough time for the user to confirm. Pass a 5-minute timeout through the
call chain for these interactive operations.

Signed-off-by: default avatarJackeagle <jackeagle102@gmail.com>
parent 1929aeb5
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -140,12 +140,16 @@ export class DeviceManager {
  }

  async unlock(command) {
    await this.bootloader.runCommand(command);
    // Unlock requires physical confirmation on the device (volume keys +
    // power button), so use a generous 5-minute timeout instead of the
    // default 30 seconds.
    await this.bootloader.runCommand(command, 300_000);
    return true;
  }

  async lock(command) {
    await this.bootloader.runCommand(command);
    // Lock may also require physical confirmation on the device.
    await this.bootloader.runCommand(command, 300_000);
    return true;
  }

+2 −2
Original line number Diff line number Diff line
@@ -24,8 +24,8 @@ export class Bootloader extends Device {
    return this.fastboot.reboot(mode);
  }

  runCommand(command) {
    return this.fastboot.runCommand(command);
  runCommand(command, timeoutMs) {
    return this.fastboot.runCommand(command, timeoutMs);
  }

  isBootloader() {
+2 −2
Original line number Diff line number Diff line
@@ -101,9 +101,9 @@ export class FastbootDevice {
   * Run an arbitrary fastboot command and return the response message.
   * Used for commands like "flashing unlock", "oem unlock", "flashing lock", etc.
   */
  async runCommand(command: string): Promise<string> {
  async runCommand(command: string, timeoutMs?: number): Promise<string> {
    this.ensureConnected();
    const result = await sendCommand(this._transport, command);
    const result = await sendCommand(this._transport, command, timeoutMs);
    return result.message;
  }