Search code examples
androidshelladbresolutiondisplay

Android display offset/change position


Is it possible to offset the entire display content / change its position using adb shell?

As i recently noticed it is possible to change the resolution .

adb shell wm size <Res>.

So , i was wondering if it's possible to introduce an offset or change the display position.


Solution

  • Here is the wm command usage:

    usage: wm [subcommand] [options]
           wm size [reset|WxH|WdpxHdp]
           wm density [reset|DENSITY]
           wm overscan [reset|LEFT,TOP,RIGHT,BOTTOM]
           wm scaling [off|auto]
           wm screen-capture [userId] [true|false]
    
    wm size: return or override display size.
             width and height in pixels unless suffixed with 'dp'.
    
    wm density: override display density.
    
    wm overscan: set overscan area for display.
    
    wm scaling: set display scaling mode.
    
    wm screen-capture: enable/disable screen capture.
    
    wm dismiss-keyguard: dismiss the keyguard, prompting the user for auth if necessary.
    

    So the command you're looking for is wm overscan to offset the display:

    adb shell wm overscan a,b,c,d

    Before Android 4.3:

    adb shell am display-size

    ref: https://plus.google.com/+AdamWPowell/posts/cz5TxuoNDfG and https://plus.google.com/+AndroidDevelopers/posts/QhWQArNDfS3