@@ -97,14 +97,15 @@ def run(self):
9797
9898class DeviceInfoWorker (QThread ):
9999 info_ready = pyqtSignal (str )
100+ SECTION_SEPARATOR = "=" * 36
100101
101102 def __init__ (self , platform_tools_path ):
102103 super ().__init__ ()
103104 self .platform_tools_path = platform_tools_path
104105 self .adb_path = ToolPaths .instance ().adb
105106
106107 def run (self ):
107- commands = self ._get_device_commands ()
108+ command_sections = self ._get_device_commands ()
108109 results = []
109110
110111 # Windows specific: Create a new process group and hide the console window.
@@ -115,50 +116,74 @@ def run(self):
115116 subprocess .CREATE_NO_WINDOW
116117 )
117118
118- for label , command in commands .items ():
119- try :
120- result = subprocess .run (
121- command ,
122- stdout = subprocess .PIPE ,
123- stderr = subprocess .PIPE ,
124- text = True ,
125- shell = True ,
126- timeout = 10 ,
127- creationflags = creationflags
128- )
129-
130- if result .returncode == 0 :
131- output = result .stdout .strip ()
132- formatted_output = self ._format_output (label , output )
133- results .append (f"{ label } : { formatted_output } " )
134- else :
135- results .append (f"{ label } : Error - { result .stderr .strip ()} " )
136-
137- except subprocess .TimeoutExpired :
138- results .append (f"{ label } : Timeout" )
139- except Exception as e :
140- results .append (f"{ label } : Error - { str (e )} " )
141-
142- self .info_ready .emit ("\n " .join (results ))
119+ for section_name , commands in command_sections :
120+ results .append (self .SECTION_SEPARATOR )
121+ results .append (section_name .upper ())
122+ results .append (self .SECTION_SEPARATOR )
123+
124+ for label , command in commands :
125+ try :
126+ result = subprocess .run (
127+ command ,
128+ stdout = subprocess .PIPE ,
129+ stderr = subprocess .PIPE ,
130+ text = True ,
131+ shell = True ,
132+ timeout = 10 ,
133+ creationflags = creationflags
134+ )
135+
136+ if result .returncode == 0 :
137+ output = result .stdout .strip ()
138+ formatted_output = self ._format_output (label , output )
139+ results .append (f"{ label } : { formatted_output } " )
140+ else :
141+ results .append (f"{ label } : Error - { result .stderr .strip ()} " )
142+
143+ except subprocess .TimeoutExpired :
144+ results .append (f"{ label } : Timeout" )
145+ except Exception as e :
146+ results .append (f"{ label } : Error - { str (e )} " )
147+
148+ results .append ("" )
149+
150+ self .info_ready .emit ("\n " .join (results ).strip ())
143151
144152 def _get_device_commands (self ):
145153 from util .devicemanager import DeviceManager
146154 serial_flag = DeviceManager .instance ().serial_flag ()
147155 adb_cmd = f'"{ self .adb_path } " { serial_flag } '
148- return {
149- "Fingerprint" : f"{ adb_cmd } shell getprop ro.build.fingerprint" ,
150- "Board" : f"{ adb_cmd } shell getprop ro.product.board" ,
151- "Build ID" : f"{ adb_cmd } shell getprop ro.build.id" ,
152- "Android Version" : f"{ adb_cmd } shell getprop ro.build.version.release" ,
153- "Manufacturer" : f"{ adb_cmd } shell getprop ro.product.manufacturer" ,
154- "Model" : f"{ adb_cmd } shell getprop ro.product.model" ,
155- "Product Name" : f"{ adb_cmd } shell getprop ro.product.name" ,
156- "Architecture" : f"{ adb_cmd } shell getprop ro.product.cpu.abi" ,
157- "Resolution" : f"{ adb_cmd } shell wm size" ,
158- "Total RAM" : f"{ adb_cmd } shell cat /proc/meminfo" ,
159- "Total Storage" : f"{ adb_cmd } shell df" ,
160- "Root Method" : f"{ adb_cmd } shell su -v"
161- }
156+ return [
157+ ("Hardware Info" , [
158+ ("Board" , f"{ adb_cmd } shell getprop ro.product.board" ),
159+ ("Chipset" , f"{ adb_cmd } shell getprop ro.hardware" ),
160+ ("Architecture" , f"{ adb_cmd } shell getprop ro.product.cpu.abi" ),
161+ ("Serial Number" , f"{ adb_cmd } shell getprop ro.serialno" ),
162+ ("Resolution" , f"{ adb_cmd } shell wm size" ),
163+ ("Total RAM" , f"{ adb_cmd } shell cat /proc/meminfo" ),
164+ ("Total Storage" , f"{ adb_cmd } shell df" ),
165+ ]),
166+ ("Android Info" , [
167+ ("Android Version" , f"{ adb_cmd } shell getprop ro.build.version.release" ),
168+ ("SDK Version" , f"{ adb_cmd } shell getprop ro.build.version.sdk" ),
169+ ("Minimum SDK" , f"{ adb_cmd } shell getprop ro.build.version.min_supported_target_sdk" ),
170+ ("Build ID" , f"{ adb_cmd } shell getprop ro.build.id" ),
171+ ("Build Type" , f"{ adb_cmd } shell getprop ro.build.type" ),
172+ ("Build Date" , f"{ adb_cmd } shell getprop ro.build.date" ),
173+ ("Security Patch" , f"{ adb_cmd } shell getprop ro.build.version.security_patch" ),
174+ ("Treble Support" , f"{ adb_cmd } shell getprop ro.treble.enabled" ),
175+ ("A/B Support" , f"{ adb_cmd } shell getprop ro.build.ab_update" ),
176+ ("Dynamic Partitions" , f"{ adb_cmd } shell getprop ro.boot.dynamic_partitions" ),
177+ ("Fingerprint" , f"{ adb_cmd } shell getprop ro.build.fingerprint" ),
178+ ]),
179+ ("Device Specs" , [
180+ ("Manufacturer" , f"{ adb_cmd } shell getprop ro.product.manufacturer" ),
181+ ("Model" , f"{ adb_cmd } shell getprop ro.product.model" ),
182+ ("Product Name" , f"{ adb_cmd } shell getprop ro.product.name" ),
183+ ("Carrier" , f"{ adb_cmd } shell getprop ro.carrier" ),
184+ ("Root Method" , f"{ adb_cmd } shell su -v" ),
185+ ]),
186+ ]
162187
163188 def _format_output (self , label , output ):
164189 # Human-readable sizes
0 commit comments