forked from Xsugizo/Mutli-flashing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDisable_trukey.py
106 lines (94 loc) · 3.75 KB
/
Disable_trukey.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# import bs4 #BeautifulSoup 3 has been replaced
# # load the file
# with open("/home/logo007/Desktop/IMAGE/workspace/project_test_pipeline/11_r10/android-cts-11_r10-linux_x86-arm/android-cts/results/latest_test_result.html",encoding='UTF-8') as inf:
# txt = inf.read()
# soup = bs4.BeautifulSoup(txt)
# # create new link
# new_link = soup.new_tag("link", rel="stylesheet", href="/home/logo007/Desktop/IMAGE/workspace/project_test_pipeline/11_r10/android-cts-11_r10-linux_x86-arm/android-cts/results/compatibility_result.css")
# # insert it into the document
# soup.head.append(new_link)
# # save the file again
# with open("/home/logo007/Desktop/IMAGE/workspace/project_test_pipeline/11_r10/android-cts-11_r10-linux_x86-arm/android-cts/results/latest_test_result.html", "w",encoding='UTF-8') as outf:
# outf.write(str(soup))
# soup = bs4.BeautifulSoup(open("/home/logo007/Desktop/IMAGE/workspace/project_test_pipeline/11_r10/android-cts-11_r10-linux_x86-arm/android-cts/results/latest_test_result.html",encoding='UTF-8').read())
# stylesheets = soup.findAll("link", {"rel": "stylesheet"})
# for s in stylesheets:
# t = soup.new_tag('style')
# c = bs4.element.NavigableString(open(s["href"]).read())
# t.insert(0,c)
# t['type'] = 'text/css'
# s.replaceWith(t)
# open("/home/logo007/Desktop/IMAGE/workspace/project_test_pipeline/11_r10/android-cts-11_r10-linux_x86-arm/android-cts/results/output.html", "w",encoding='UTF-8').write(str(soup))
import re
import sys
import os
import time
from time import sleep
import subprocess
from subprocess import call
devices = []
output_build_number=[]
CurrPath=os.getcwd()
ParetPath=os.path.dirname(CurrPath)
#device_re = re.compile("device")
adb_devices= subprocess.check_output(["adb", "devices"])
# print(adb_devices)
for i in adb_devices.split("\tdevice"):
for ii in i.split(b"\n"):
if ii !="" and ii not in "List of devices attached" :
devices.append(ii)
coun=str(len(devices))
number = 0
def get_device_num():
devices_num = []
adb_devices= subprocess.check_output(["adb", "devices"])
# print(adb_devices)
for i in adb_devices.split("\tdevice"):
for ii in i.split(b"\n"):
if ii !="" and ii not in "List of devices attached" :
devices_num.append(ii)
coun=str(len(devices_num))
return coun
print("dev_num="+str(coun))
for i in devices:
# adb root, adb disable-verity, adb reboot, adb remount
# adb push /home/logo113/Desktop/IMAGE/Mutli_flashing/turkish/turkish.ini /mnt/vendor/persist/
# adb chmod 644 /mnt/vendor/persist/turkish.ini
# adb reboot
# os.system ('gnome-terminal -- ./'+FlashToolname+" "+ i)
print("device id="+i)
os.system('adb -s '+i+' root')
sleep (10)
# os.system('adb -s '+i+' disable-verity')
# sleep (5)
# os.system('adb -s '+i+' reboot')
# sleep (5)
# while number != coun:
# number = get_device_num()
# if number==coun:
# print('reboot complete')
# os.system('adb -s '+i+' root')
# sleep (10)
# os.system('adb -s '+i+' remount')
# sleep (5)
# # os.system('adb -s '+i+' push '+CurrPath+'/turkish/turkish.ini /mnt/vendor/persist/')
# # sleep (2)
os.system('adb -s '+i+' shell rm /odm/zpersist/turkish.ini')
sleep (10)
os.system('adb -s '+i+' reboot')
number = 0
while number != coun:
number = get_device_num()
if number==coun:
print('reboot complete')
sleep (30)
os.system('adb -s '+i+' reboot')
number = 0
while number != coun:
number = get_device_num()
if number==coun:
print('reboot complete')
sleep (30)
os.system('adb -s '+i+' shell getprop ro.system_ext.build.fingerprint')