michael@0: #!/usr/bin/env python michael@0: # michael@0: # Copyright (c) 2012 The Chromium Authors. All rights reserved. michael@0: # Use of this source code is governed by a BSD-style license that can be michael@0: # found in the LICENSE file. michael@0: michael@0: """Enables dalvik vm asserts in the android device.""" michael@0: michael@0: from pylib import android_commands michael@0: import optparse michael@0: import sys michael@0: michael@0: michael@0: def main(argv): michael@0: option_parser = optparse.OptionParser() michael@0: option_parser.add_option('--enable_asserts', dest='set_asserts', michael@0: action='store_true', default=None, michael@0: help='Sets the dalvik.vm.enableassertions property to "all"') michael@0: option_parser.add_option('--disable_asserts', dest='set_asserts', michael@0: action='store_false', default=None, michael@0: help='Removes the dalvik.vm.enableassertions property') michael@0: options, _ = option_parser.parse_args(argv) michael@0: michael@0: commands = android_commands.AndroidCommands() michael@0: if options.set_asserts != None: michael@0: if commands.SetJavaAssertsEnabled(options.set_asserts): michael@0: commands.Reboot(full_reboot=False) michael@0: michael@0: michael@0: if __name__ == '__main__': michael@0: main(sys.argv)