module Appium::Core::Android::Device

def background_app(duration = 0)

def background_app(duration = 0)
  execute_script 'mobile:backgroundApp', { seconds: duration }
end

def current_activity

def current_activity
  execute_script 'mobile:getCurrentActivity', {}
end

def current_package

def current_package
  execute_script 'mobile:getCurrentPackage', {}
end

def execute_cdp(cmd, **params)

def execute_cdp(cmd, **params)
  execute :chrome_send_command, {}, { cmd: cmd, params: params }
end

def extended(_mod)

def extended(_mod)
  ::Appium::Core::Device.extend_webdriver_with_forwardable
  ::Appium::Core::Device.add_endpoint_method(:open_notifications) do
    def open_notifications
      execute_script 'mobile:openNotifications', {}
    end
  end
  ::Appium::Core::Device.add_endpoint_method(:current_activity) do
    def current_activity
      execute_script 'mobile:getCurrentActivity', {}
    end
  end
  ::Appium::Core::Device.add_endpoint_method(:current_package) do
    def current_package
      execute_script 'mobile:getCurrentPackage', {}
    end
  end
  ::Appium::Core::Device.add_endpoint_method(:get_system_bars) do
    def get_system_bars
      execute_script 'mobile:getSystemBars', {}
    end
  end
  # as alias to get_system_bars
  ::Appium::Core::Device.add_endpoint_method(:system_bars) do
    def system_bars
      execute_script 'mobile:getSystemBars', {}
    end
  end
  ::Appium::Core::Device.add_endpoint_method(:toggle_location_services) do
    def toggle_location_services
      execute_script 'mobile:toggleGps', {}
    end
  end
  # Android, Override included method in bridge
  ::Appium::Core::Device.add_endpoint_method(:hide_keyboard) do
    def hide_keyboard(_close_key = nil)
      execute_script 'mobile:hideKeyboard', {}
    end
  end
  # Android, Override included method in bridge
  ::Appium::Core::Device.add_endpoint_method(:background_app) do
    def background_app(duration = 0)
      execute_script 'mobile:backgroundApp', { seconds: duration }
    end
  end
  ::Appium::Core::Device.add_endpoint_method(:execute_cdp) do
    # SeleniumWebdriver could already define this method
    return if method_defined? :execute_cdp
    def execute_cdp(cmd, **params)
      execute :chrome_send_command, {}, { cmd: cmd, params: params }
    end
  end
  Screen.add_methods
  Performance.add_methods
  Clipboard.add_methods
  Emulator.add_methods
  Authentication.add_methods
end

def get_system_bars

def get_system_bars
  execute_script 'mobile:getSystemBars', {}
end

def hide_keyboard(_close_key = nil)

def hide_keyboard(_close_key = nil)
  execute_script 'mobile:hideKeyboard', {}
end

def open_notifications

def open_notifications
  execute_script 'mobile:openNotifications', {}
end

def system_bars

def system_bars
  execute_script 'mobile:getSystemBars', {}
end

def toggle_location_services

def toggle_location_services
  execute_script 'mobile:toggleGps', {}
end