Skip to content

autosize do not work on SDK 19 #2

@Chrisplus

Description

@Chrisplus

Thanks for the awesome project.

I test run.sh on a google glass running SDK 19. But 'autosize' do not work. I find the following codes always return empty strings.

args=
if [ "$1" = "autosize" ]; then
  set +o pipefail
  size=$(adb shell dumpsys window | grep -Eo 'init=\d+x\d+' | head -1 | cut -d= -f 2)
  if [ "$size" = "" ]; then
    w=$(adb shell dumpsys window | grep -Eo 'DisplayWidth=\d+' | head -1 | cut -d= -f 2)
    h=$(adb shell dumpsys window | grep -Eo 'DisplayHeight=\d+' | head -1 | cut -d= -f 2)
    size="${w}x${h}"
  fi
  args="-P $size@$size/0"
  set -o pipefail
  shift
fi

I try to fix it by changing the code to

args=
if [ "$1" = "autosize" ]; then
  set +o pipefail
  size=$(adb shell dumpsys window | grep -Eo 'init=\d+x\d+' | head -1 | cut -d= -f 2)
  if [ "$size" = "" ]; then
    size=$(adb shell wm size| cut -d: -f2 |tr -d " \n\t\r")
  fi
  args="-P $size@$size/0"
  set -o pipefail
  shift
fi

I'm not sure if wm size can return the exact same thing with dumsys window, if not, please correct me.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions