Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
109.62k stars 10.53k forks source link

[Suggestion] Put user-friendly name of device in window name #601

Open Plandercozeron opened 5 years ago

Plandercozeron commented 5 years ago

For testing purpose shell getprop ro.product.model returns models as SM-G960F (Galaxy S9) for samsung devices. Things like Motorola return readable user-friendly names, i.e. Motorola E4 Plus. But sometimes they don't: XT1635-02 (Motorola Z Play). I remember all models which i work with by heart. But eye catches easily when you have window named Samsung Galaxy S6 Edge+ (SM-G928F) shell settings get secure bluetooth_name returns almost on every device (Galaxy S4 mini is still GT-9195. But it's initially called like that so doesn't matter) its name if it wasn't changed by user. How reasonable is getting the name from settings? It's kind of slow. Or maybe i'm doing that wrong. Because if you make loop which gets info about all connected devices

#!/bin/bash
for serial in $(adb devices | awk 'NR>1{print $1}');
    do
        echo  $(adb -s $serial shell settings get secure bluetooth_name | sed "s/\\r//g")
    done

it would work significantly slower than

#!/bin/bash
for serial in $(adb devices | awk 'NR>1{print $1}');
    do
        echo  $(adb -s $serial shell getprop ro.product.model | sed "s/\\r//g")
    done
rom1v commented 5 years ago

In https://github.com/Genymobile/scrcpy/pull/573#issuecomment-498548993, the "bluetooth name" could be a variable (like %b) in the custom pattern (not implemented yet).

It's kind of slow.

It's just because you execute settings, so you have the same behavior as input: https://github.com/Genymobile/scrcpy/issues/231#issuecomment-414111753. In scrcpy, it would be retrieved directly by the server via a method call.

Plandercozeron commented 5 years ago

Right. Thanks for explanation. Also

shell settings get global wifi_p2p_device_name

returns device type (Phone, Tablet) on Android 6+

on 0215394544313237:    [Phone]  Galaxy S6 edge+
on 4200c004ecd5b361:    [Phone]  Galaxy J5 Prime
on 4ccd2337:                     Galaxy S4
on 5200b0beb46215cb:    [Phone]  Galaxy J7 Neo
on 7a58571a:            [Phone]  Galaxy A5
on abafba0b:            [Tablet] Galaxy Tab A

But returns null on Blackberry and Motorola. Probably on other non-samsung devices too. So not an option

UPD: Went through #573. That would be a nice option to use patterns. Way more flexible. And you can consider list of parameters which could be put in window title through patterns (such as IP address or Android version)