1# Copyright (C) 2024 The Android Open Source Project 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15import re 16 17""" 18Script used to filter a file for intent actions. 19""" 20def filter_intent_actions(file_path): 21 try: 22 with open(file_path, 'r') as file: 23 content = file.read() 24 25 pattern = r'<action android:name="([^"]+)"' 26 matches = re.findall(pattern, content) 27 28 return matches 29 30 except FileNotFoundError: 31 print(f"Error: File '{file_path}' not found.") 32 except Exception as e: 33 print(f"An error occurred: {e}") 34 35def main(): 36 file_path = '../../AndroidManifest.xml' 37 actions = filter_intent_filter_actions(file_path) 38 39if __name__ == '__main__': 40 main() 41