1#!/usr/bin/env python3 2# Copyright (C) 2024 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16import argparse 17import sys 18 19from datetime import datetime 20if sys.version_info[0] != 3: 21 print("Must use python 3") 22 sys.exit(1) 23 24COPYRIGHT_STR = """ Copyright (C) %s The Android Open Source Project 25Licensed under the Apache License, Version 2.0 (the "License"); 26you may not use this file except in compliance with the License. 27You may obtain a copy of the License at 28 http://www.apache.org/licenses/LICENSE-2.0 29Unless required by applicable law or agreed to in writing, software 30distributed under the License is distributed on an "AS IS" BASIS, 31WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 32See the License for the specific language governing permissions and 33limitations under the License.""" % (datetime.today().strftime("%Y")) 34 35""" 36Script used to verify whether there are new intents that should be handled by CarSettings. 37""" 38import auto_add_intents 39import sys 40 41def main(): 42 parser = argparse.ArgumentParser(description='Auto adding Intents.') 43 required_args = parser.add_argument_group('required arguments') 44 required_args.add_argument('-i', '--inputFile', nargs='+', help='Input file path (absolute or relative to cwd)', required=True) 45 required_args.add_argument('-o', '--outputFile', help='Output file path (absolute or relative to cwd)', required=True) 46 required_args.add_argument('-p', '--filterPattern', default='', help='Input file path (absolute or relative to cwd)', required=True) 47 optional_args = parser.add_argument_group('optional arguments') 48 optional_args.add_argument('-e', '--excludeHiddenIntents', action=argparse.BooleanOptionalAction, help='whether to exclude hidden apis.') 49 args = parser.parse_args() 50 51 new_strings = auto_add_intents.filter_new_strings(args) 52 if (len(new_strings) != 0): 53 print("WARNING: The following new Intents should be supported!") 54 for new_string in new_strings: 55 print(new_string) 56 sys.exit(77) 57 else: 58 sys.exit(0) 59 60if __name__ == '__main__': 61 main() 62