Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Commit 34d7adc

Browse files
MohammadAGfahhem
authored andcommitted
Added enable/disable verity support (#76)
1 parent 17ccb3c commit 34d7adc

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

adb/adb_commands.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,14 @@ def Root(self):
218218
"""Restart adbd as root on the device."""
219219
return self.protocol_handler.Command(self.handle, service=b'root')
220220

221+
def EnableVerity(self):
222+
"""Re-enable dm-verity checking on userdebug builds"""
223+
return self.protocol_handler.Command(self.handle, service=b'enable-verity')
224+
225+
def DisableVerity(self):
226+
"""Disable dm-verity checking on userdebug builds"""
227+
return self.protocol_handler.Command(self.handle, service=b'disable-verity')
228+
221229
def Shell(self, command, timeout_ms=None):
222230
"""Run command on the device, returning the output."""
223231
return self.protocol_handler.Command(

adb/adb_debug.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ def main():
141141
common_cli.MakeSubparser(
142142
subparsers, parents, adb_commands.AdbCommands.Remount)
143143
common_cli.MakeSubparser(subparsers, parents, adb_commands.AdbCommands.Root)
144+
common_cli.MakeSubparser(subparsers, parents, adb_commands.AdbCommands.EnableVerity)
145+
common_cli.MakeSubparser(subparsers, parents, adb_commands.AdbCommands.DisableVerity)
144146
common_cli.MakeSubparser(subparsers, parents, Shell)
145147

146148
if len(sys.argv) == 1:

test/adb_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,15 @@ def testRoot(self):
151151
adb_commands = self._Connect(usb)
152152
adb_commands.Root()
153153

154+
def testEnableVerity(self):
155+
usb = self._ExpectCommand(b'enable-verity', b'', b'')
156+
adb_commands = self._Connect(usb)
157+
adb_commands.EnableVerity()
158+
159+
def testDisableVerity(self):
160+
usb = self._ExpectCommand(b'disable-verity', b'', b'')
161+
adb_commands = self._Connect(usb)
162+
adb_commands.DisableVerity()
154163

155164
class FilesyncAdbTest(BaseAdbTest):
156165

0 commit comments

Comments
 (0)