Files
Android-pyApi/android_pyapi/android/content_intent.py
T
shuiyu1123 97d8b277d5 fix: 系统性修复类继承冲突 + 补全36+缺失导出
类继承冲突修复 (7个文件, 8组冲突):
- view_ext.py: 16个类继承view.py基础版本 (ViewOutlineProvider, ViewPropertyAnimator, ViewTreeObserver, ViewConfiguration, ViewParent, WindowInsets, Display, DragEvent, GestureDetector, ScaleGestureDetector, SoundEffectConstants, Surface, SurfaceView, TextureView, VelocityTracker, WindowInsetsController)
- hardware_sensor_ext.py: 3个类继承hardware.py (Sensor, SensorEvent, SensorEventListener)
- app_fragment.py: 3个类继承app.py (Fragment, FragmentManager, FragmentTransaction)
- content_intent.py: 3个类继承content.py/app.py (Intent, PendingIntent, IntentFilter)
- widget_ext.py: 29个类继承widget.py (18个单继承+11个多继承, 修复super()链)
- os_power.py: 2个类继承os.py (BatteryManager, PowerManager)
- net_ext.py: 12个类继承net.py (11个单继承+1个多继承)

__all__导出补全 (36个类):
- java.net: InterfaceAddress
- android.database: MatrixCursor, SQLiteStatement
- android.view: GestureDetector, ScaleGestureDetector, SurfaceHolder, Surface, SurfaceView, TextureView, ViewOutlineProvider, WindowManager, Window, LayoutInflater, Menu, MenuItem, ContextMenu, Display, DisplayMetrics
- android.graphics: Region, PathMeasure, NinePatch, Picture, PictureDrawable, Camera, PorterDuff, PorterDuffXfermode, Shader, LinearGradient, RadialGradient, SweepGradient, BitmapShader, ComposeShader, CornerPathEffect, DashPathEffect, PathDashPathEffect, SumPathEffect
- android.widget: LinearLayout, FrameLayout, RelativeLayout, TableLayout, TableRow, BaseAdapter, ArrayAdapter, SimpleAdapter, CursorAdapter, ImageButton, ToggleButton, RadioButton, SeekBar, RatingBar, ViewSwitcher, TextSwitcher, ImageSwitcher, SearchView, NumberPicker, Chronometer, TabHost, TabWidget, ViewAnimator, ZoomControls, DigitalClock, AnalogClock

统计: 221模块, 3666类, 31005方法, 183629行
2026-06-25 01:24:00 +00:00

2087 lines
87 KiB
Python

"""
Android content Intent 完整扩展组件 — Intent (完整版), PendingIntent,
IntentSender, IntentFilter (扩展), ShortcutInfo, ShortcutManager 等
包含所有标准 ACTION_*, CATEGORY_*, EXTRA_*, FLAG_*, URI_*, SCHEME_*, MIME_* 常量
方法签名完全对齐 Android SDK
"""
from __future__ import annotations
import json
import time
from typing import Any, Dict, List, Optional, Set, Tuple, Union
from .._core import Stub, AndroidOnlyError
from ..java.lang import RuntimeException
from .app import Intent as _BaseIntent
from .app import PendingIntent as _BasePendingIntent
from .content import IntentFilter as _BaseIntentFilter
IllegalArgumentException = type("IllegalArgumentException", (RuntimeException,), {})
__all__ = [
"Intent", "PendingIntent", "IntentSender",
"IntentService",
"IntentFilter", "MatchingFlags", "ShortcutInfo",
"ShortcutManager",
]
# ═══════════════════════════════════════════════════════════════
# ACTION_* — 标准 Android Intent Action 常量
# ═══════════════════════════════════════════════════════════════
ACTION_MAIN = "android.intent.action.MAIN"
ACTION_VIEW = "android.intent.action.VIEW"
ACTION_ATTACH_DATA = "android.intent.action.ATTACH_DATA"
ACTION_EDIT = "android.intent.action.EDIT"
ACTION_PICK = "android.intent.action.PICK"
ACTION_CHOOSER = "android.intent.action.CHOOSER"
ACTION_GET_CONTENT = "android.intent.action.GET_CONTENT"
ACTION_DIAL = "android.intent.action.DIAL"
ACTION_CALL = "android.intent.action.CALL"
ACTION_CALL_BUTTON = "android.intent.action.CALL_BUTTON"
ACTION_SEND = "android.intent.action.SEND"
ACTION_SENDTO = "android.intent.action.SENDTO"
ACTION_SEND_MULTIPLE = "android.intent.action.SEND_MULTIPLE"
ACTION_ANSWER = "android.intent.action.ANSWER"
ACTION_INSERT = "android.intent.action.INSERT"
ACTION_DELETE = "android.intent.action.DELETE"
ACTION_RUN = "android.intent.action.RUN"
ACTION_SYNC = "android.intent.action.SYNC"
ACTION_PICK_ACTIVITY = "android.intent.action.PICK_ACTIVITY"
ACTION_SEARCH = "android.intent.action.SEARCH"
ACTION_WEB_SEARCH = "android.intent.action.WEB_SEARCH"
ACTION_FACTORY_TEST = "android.intent.action.FACTORY_TEST"
ACTION_TIME_TICK = "android.intent.action.TIME_TICK"
ACTION_TIME_CHANGED = "android.intent.action.TIME_SET"
ACTION_TIMEZONE_CHANGED = "android.intent.action.TIMEZONE_CHANGED"
ACTION_BOOT_COMPLETED = "android.intent.action.BOOT_COMPLETED"
ACTION_PACKAGE_ADDED = "android.intent.action.PACKAGE_ADDED"
ACTION_PACKAGE_REMOVED = "android.intent.action.PACKAGE_REMOVED"
ACTION_PACKAGE_REPLACED = "android.intent.action.PACKAGE_REPLACED"
ACTION_PACKAGE_CHANGED = "android.intent.action.PACKAGE_CHANGED"
ACTION_PACKAGE_RESTARTED = "android.intent.action.PACKAGE_RESTARTED"
ACTION_PACKAGE_DATA_CLEARED = "android.intent.action.PACKAGE_DATA_CLEARED"
ACTION_PACKAGE_FULLY_REMOVED = "android.intent.action.PACKAGE_FULLY_REMOVED"
ACTION_PACKAGE_FIRST_LAUNCH = "android.intent.action.PACKAGE_FIRST_LAUNCH"
ACTION_PACKAGE_NEEDS_VERIFICATION = "android.intent.action.PACKAGE_NEEDS_VERIFICATION"
ACTION_PACKAGE_VERIFIED = "android.intent.action.PACKAGE_VERIFIED"
ACTION_EXTERNAL_APPLICATIONS_AVAILABLE = "android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE"
ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE = "android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE"
ACTION_APPLICATION_PREFERENCES = "android.intent.action.APPLICATION_PREFERENCES"
ACTION_APPLICATION_LOCALE_CHANGED = "android.intent.action.APPLICATION_LOCALE_CHANGED"
ACTION_APPLICATION_GRANT_URI_PERMISSION = "android.intent.action.APPLICATION_GRANT_URI_PERMISSION"
ACTION_CONFIGURATION_CHANGED = "android.intent.action.CONFIGURATION_CHANGED"
ACTION_CAMERA_BUTTON = "android.intent.action.CAMERA_BUTTON"
ACTION_DATE_CHANGED = "android.intent.action.DATE_CHANGED"
ACTION_DOCK_EVENT = "android.intent.action.DOCK_EVENT"
ACTION_DREAMING_STARTED = "android.intent.action.DREAMING_STARTED"
ACTION_DREAMING_STOPPED = "android.intent.action.DREAMING_STOPPED"
ACTION_HEADSET_PLUG = "android.intent.action.HEADSET_PLUG"
ACTION_INPUT_METHOD_CHANGED = "android.intent.action.INPUT_METHOD_CHANGED"
ACTION_LOCALE_CHANGED = "android.intent.action.LOCALE_CHANGED"
ACTION_MANAGED_PROFILE_ADDED = "android.intent.action.MANAGED_PROFILE_ADDED"
ACTION_MANAGED_PROFILE_REMOVED = "android.intent.action.MANAGED_PROFILE_REMOVED"
ACTION_MANAGED_PROFILE_AVAILABLE = "android.intent.action.MANAGED_PROFILE_AVAILABLE"
ACTION_MANAGED_PROFILE_UNAVAILABLE = "android.intent.action.MANAGED_PROFILE_UNAVAILABLE"
ACTION_MANAGED_PROFILE_UNLOCKED = "android.intent.action.MANAGED_PROFILE_UNLOCKED"
ACTION_MEDIA_BUTTON = "android.intent.action.MEDIA_BUTTON"
ACTION_MEDIA_CHECKING = "android.intent.action.MEDIA_CHECKING"
ACTION_MEDIA_EJECT = "android.intent.action.MEDIA_EJECT"
ACTION_MEDIA_MOUNTED = "android.intent.action.MEDIA_MOUNTED"
ACTION_MEDIA_NOFS = "android.intent.action.MEDIA_NOFS"
ACTION_MEDIA_REMOVED = "android.intent.action.MEDIA_REMOVED"
ACTION_MEDIA_SCANNER_FINISHED = "android.intent.action.MEDIA_SCANNER_FINISHED"
ACTION_MEDIA_SCANNER_SCAN_FILE = "android.intent.action.MEDIA_SCANNER_SCAN_FILE"
ACTION_MEDIA_SCANNER_STARTED = "android.intent.action.MEDIA_SCANNER_STARTED"
ACTION_MEDIA_SHARED = "android.intent.action.MEDIA_SHARED"
ACTION_MEDIA_UNMOUNTABLE = "android.intent.action.MEDIA_UNMOUNTABLE"
ACTION_MEDIA_UNMOUNTED = "android.intent.action.MEDIA_UNMOUNTED"
ACTION_MEDIA_BAD_REMOVAL = "android.intent.action.MEDIA_BAD_REMOVAL"
ACTION_NEW_OUTGOING_CALL = "android.intent.action.NEW_OUTGOING_CALL"
ACTION_SCREEN_OFF = "android.intent.action.SCREEN_OFF"
ACTION_SCREEN_ON = "android.intent.action.SCREEN_ON"
ACTION_USER_PRESENT = "android.intent.action.USER_PRESENT"
ACTION_PROVIDER_CHANGED = "android.intent.action.PROVIDER_CHANGED"
ACTION_GTALK_SERVICE_CONNECTED = "android.intent.action.GTALK_CONNECTED"
ACTION_GTALK_SERVICE_DISCONNECTED = "android.intent.action.GTALK_DISCONNECTED"
ACTION_MY_PACKAGE_REPLACED = "android.intent.action.MY_PACKAGE_REPLACED"
ACTION_MY_PACKAGE_SUSPENDED = "android.intent.action.MY_PACKAGE_SUSPENDED"
ACTION_MY_PACKAGE_UNSUSPENDED = "android.intent.action.MY_PACKAGE_UNSUSPENDED"
ACTION_UMS_CONNECTED = "android.intent.action.UMS_CONNECTED"
ACTION_UMS_DISCONNECTED = "android.intent.action.UMS_DISCONNECTED"
ACTION_WALLPAPER_CHANGED = "android.intent.action.WALLPAPER_CHANGED"
ACTION_WIFI_SCAN_AVAILABLE = "android.intent.action.WIFI_SCAN_AVAILABLE"
ACTION_DEVICE_STORAGE_LOW = "android.intent.action.DEVICE_STORAGE_LOW"
ACTION_DEVICE_STORAGE_OK = "android.intent.action.DEVICE_STORAGE_OK"
ACTION_BATTERY_CHANGED = "android.intent.action.BATTERY_CHANGED"
ACTION_BATTERY_LOW = "android.intent.action.BATTERY_LOW"
ACTION_BATTERY_OKAY = "android.intent.action.BATTERY_OKAY"
ACTION_POWER_CONNECTED = "android.intent.action.ACTION_POWER_CONNECTED"
ACTION_POWER_DISCONNECTED = "android.intent.action.ACTION_POWER_DISCONNECTED"
ACTION_SHUTDOWN = "android.intent.action.ACTION_SHUTDOWN"
ACTION_REBOOT = "android.intent.action.REBOOT"
ACTION_AIRPLANE_MODE_CHANGED = "android.intent.action.AIRPLANE_MODE"
ACTION_NETWORK_SET_TIME = "android.intent.action.NETWORK_SET_TIME"
ACTION_NETWORK_SET_TIMEZONE = "android.intent.action.NETWORK_SET_TIMEZONE"
ACTION_SIM_STATE_CHANGED = "android.intent.action.SIM_STATE_CHANGED"
ACTION_SERVICE_STATE = "android.intent.action.SERVICE_STATE"
ACTION_SIGNAL_STRENGTH_CHANGED = "android.intent.action.SIG_STR"
ACTION_DATA_CONNECTION_STATE_CHANGED = "android.intent.action.DATA_CONNECTION_STATE_CHANGED"
ACTION_ANY_DATA_CONNECTION_STATE_CHANGED = "android.intent.action.ANY_DATA_STATE"
ACTION_DATA_ACTIVITY = "android.intent.action.DATA_ACTIVITY"
ACTION_DATA_STALL = "android.intent.action.DATA_STALL"
ACTION_PROXY_CHANGE = "android.intent.action.PROXY_CHANGE"
ACTION_WALLPAPER_SETTINGS = "android.intent.action.WALLPAPER_SETTINGS"
ACTION_HDMI_AUDIO_PLUG = "android.intent.action.HDMI_AUDIO_PLUG"
ACTION_OPEN_DOCUMENT = "android.intent.action.OPEN_DOCUMENT"
ACTION_CREATE_DOCUMENT = "android.intent.action.CREATE_DOCUMENT"
ACTION_OPEN_DOCUMENT_TREE = "android.intent.action.OPEN_DOCUMENT_TREE"
ACTION_VIEW_DOWNLOADS = "android.intent.action.VIEW_DOWNLOADS"
ACTION_DOCUMENT_SETTINGS = "android.intent.action.DOCUMENT_SETTINGS"
ACTION_QUICK_CLOCK = "android.intent.action.QUICK_CLOCK"
ACTION_INTENT_FILTER_NEEDS_VERIFICATION = "android.intent.action.INTENT_FILTER_NEEDS_VERIFICATION"
ACTION_MANAGED_ROAMING_INDICATION = "android.intent.action.MANAGED_ROAMING_INDICATION"
ACTION_VOICE_COMMAND = "android.intent.action.VOICE_COMMAND"
ACTION_ASSIST = "android.intent.action.ASSIST"
ACTION_QUICK_VIEW = "android.intent.action.QUICK_VIEW"
ACTION_CUSTOM_EVENT = "android.intent.action.CUSTOM_EVENT"
ACTION_GET_RESTRICTION_ENTRIES = "android.intent.action.GET_RESTRICTION_ENTRIES"
ACTION_SET_RESTRICTION = "android.intent.action.SET_RESTRICTION"
ACTION_DEFAULT = "android.intent.action.DEFAULT"
ACTION_CREATE_SHORTCUT = "android.intent.action.CREATE_SHORTCUT"
ACTION_INSTALL_SHORTCUT = "android.intent.action.INSTALL_SHORTCUT"
ACTION_UNINSTALL_SHORTCUT = "com.android.launcher.action.UNINSTALL_SHORTCUT"
ACTION_INSTALL_PACKAGE = "android.intent.action.INSTALL_PACKAGE"
ACTION_UNINSTALL_PACKAGE = "android.intent.action.UNINSTALL_PACKAGE"
ACTION_INSTALL_FAILURE = "android.intent.action.INSTALL_FAILURE"
ACTION_UNINSTALL_FAILURE = "android.intent.action.UNINSTALL_FAILURE"
ACTION_VIEW_SECURITY_POLICY = "android.intent.action.VIEW_SECURITY_POLICY"
ACTION_DEVICE_ADMIN_DISABLE_REQUESTED = "android.app.action.DEVICE_ADMIN_DISABLE_REQUESTED"
ACTION_DEVICE_ADMIN_DISABLED = "android.app.action.DEVICE_ADMIN_DISABLED"
ACTION_DEVICE_ADMIN_ENABLED = "android.app.action.DEVICE_ADMIN_ENABLED"
ACTION_LOCK_TASK_ENTERING = "android.intent.action.LOCK_TASK_ENTERING"
ACTION_LOCK_TASK_EXITING = "android.intent.action.LOCK_TASK_EXITING"
ACTION_MASTER_CLEAR = "android.intent.action.MASTER_CLEAR"
ACTION_FACTORY_RESET = "android.intent.action.FACTORY_RESET"
ACTION_GET_ACCOUNTS = "android.accounts.GET_ACCOUNTS"
ACTION_ADD_ACCOUNT = "android.settings.ADD_ACCOUNT_SETTINGS"
ACTION_SETTINGS = "android.settings.SETTINGS"
ACTION_WIFI_SETTINGS = "android.settings.WIFI_SETTINGS"
ACTION_WIFI_IP_SETTINGS = "android.settings.WIFI_IP_SETTINGS"
ACTION_BLUETOOTH_SETTINGS = "android.settings.BLUETOOTH_SETTINGS"
ACTION_NFC_SETTINGS = "android.settings.NFC_SETTINGS"
ACTION_NFCSHARING_SETTINGS = "android.settings.NFCSHARING_SETTINGS"
ACTION_SOUND_SETTINGS = "android.settings.SOUND_SETTINGS"
ACTION_DISPLAY_SETTINGS = "android.settings.DISPLAY_SETTINGS"
ACTION_SECURITY_SETTINGS = "android.settings.SECURITY_SETTINGS"
ACTION_LOCATION_SOURCE_SETTINGS = "android.settings.LOCATION_SOURCE_SETTINGS"
ACTION_NETWORK_OPERATOR_SETTINGS = "android.settings.NETWORK_OPERATOR_SETTINGS"
ACTION_DATA_ROAMING_SETTINGS = "android.settings.DATA_ROAMING_SETTINGS"
ACTION_INTERNAL_STORAGE_SETTINGS = "android.settings.INTERNAL_STORAGE_SETTINGS"
ACTION_MEMORY_CARD_SETTINGS = "android.settings.MEMORY_CARD_SETTINGS"
ACTION_APP_NOTIFICATION_SETTINGS = "android.settings.APP_NOTIFICATION_SETTINGS"
ACTION_APPLICATION_DETAILS_SETTINGS = "android.settings.APPLICATION_DETAILS_SETTINGS"
ACTION_APPLICATION_DEVELOPMENT_SETTINGS = "android.settings.APPLICATION_DEVELOPMENT_SETTINGS"
ACTION_APPLICATION_SETTINGS = "android.settings.APPLICATION_SETTINGS"
ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS = "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS"
ACTION_MANAGE_APPLICATIONS_SETTINGS = "android.settings.MANAGE_APPLICATIONS_SETTINGS"
ACTION_SYNC_SETTINGS = "android.settings.SYNC_SETTINGS"
ACTION_ADD_ACCOUNT_SETTINGS = "android.settings.ADD_ACCOUNT_SETTINGS"
ACTION_AIRPLANE_MODE_SETTINGS = "android.settings.AIRPLANE_MODE_SETTINGS"
ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS"
ACTION_APPLICATION_SETTINGS_SHORT = "android.settings.APPLICATION_SETTINGS"
ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS = "android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS"
ACTION_MANAGE_DEFAULT_APPS_SETTINGS = "android.settings.MANAGE_DEFAULT_APPS_SETTINGS"
ACTION_MANAGE_OVERLAY_PERMISSION = "android.settings.action.MANAGE_OVERLAY_PERMISSION"
ACTION_MANAGE_WRITE_SETTINGS = "android.settings.action.MANAGE_WRITE_SETTINGS"
ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS = "android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"
ACTION_PRIVACY_SETTINGS = "android.settings.PRIVACY_SETTINGS"
ACTION_USAGE_ACCESS_SETTINGS = "android.settings.USAGE_ACCESS_SETTINGS"
ACTION_VR_LISTENER_SETTINGS = "android.settings.VR_LISTENER_SETTINGS"
ACTION_VPN_SETTINGS = "android.settings.VPN_SETTINGS"
ACTION_WIRELESS_SETTINGS = "android.settings.WIRELESS_SETTINGS"
ACTION_WIFI_ADD_NETWORKS = "android.settings.WIFI_ADD_NETWORKS"
ACTION_NOTIFICATION_LISTENER_SETTINGS = "android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"
ACTION_CAPTIONING_SETTINGS = "android.settings.CAPTIONING_SETTINGS"
ACTION_ACCESSIBILITY_SETTINGS = "android.settings.ACCESSIBILITY_SETTINGS"
ACTION_ACCOUNT_SYNC_SETTINGS = "android.settings.ACCOUNT_SYNC_SETTINGS"
ACTION_APP_OPEN_BY_DEFAULT_SETTINGS = "android.settings.APP_OPEN_BY_DEFAULT_SETTINGS"
ACTION_APP_LOCALE_SETTINGS = "android.settings.APP_LOCALE_SETTINGS"
ACTION_APPLICATION_SETTINGS_SYSTEM = "android.settings.APPLICATION_SETTINGS_SYSTEM"
ACTION_BATTERY_SAVER_SETTINGS = "android.settings.BATTERY_SAVER_SETTINGS"
ACTION_BIOMETRIC_ENROLL = "android.settings.BIOMETRIC_ENROLL"
ACTION_BLUETOOTH_SCAN_SETTINGS = "android.settings.BLUETOOTH_SCAN_SETTINGS"
ACTION_CAST_SETTINGS = "android.settings.CAST_SETTINGS"
ACTION_CHANNEL_NOTIFICATION_SETTINGS = "android.settings.CHANNEL_NOTIFICATION_SETTINGS"
ACTION_CONDITION_PROVIDER_SETTINGS = "android.settings.CONDITION_PROVIDER_SETTINGS"
ACTION_DATA_USAGE_SETTINGS = "android.settings.DATA_USAGE_SETTINGS"
ACTION_DATE_SETTINGS = "android.settings.DATE_SETTINGS"
ACTION_DEVICE_INFO_SETTINGS = "android.settings.DEVICE_INFO_SETTINGS"
ACTION_DREAM_SETTINGS = "android.settings.DREAM_SETTINGS"
ACTION_END_KEY_LONG_PRESS = "android.settings.END_KEY_LONG_PRESS"
ACTION_FINGERPRINT_ENROLL = "android.settings.FINGERPRINT_ENROLL"
ACTION_FINGERPRINT_SETTINGS = "android.settings.FINGERPRINT_SETTINGS"
ACTION_HARD_KEY_ASSIST = "android.settings.HARD_KEY_ASSIST"
ACTION_HOME_SETTINGS = "android.settings.HOME_SETTINGS"
ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS_SHORT = "android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS"
ACTION_INPUT_METHOD_SETTINGS = "android.settings.INPUT_METHOD_SETTINGS"
ACTION_INPUT_METHOD_SUBTYPE_SETTINGS = "android.settings.INPUT_METHOD_SUBTYPE_SETTINGS"
ACTION_INTERNAL_STORAGE_SETTINGS_SHORT = "android.settings.INTERNAL_STORAGE_SETTINGS"
ACTION_LOCALE_SETTINGS = "android.settings.LOCALE_SETTINGS"
ACTION_MANAGE_APPLICATIONS_SETTINGS_SHORT = "android.settings.MANAGE_APPLICATIONS_SETTINGS"
ACTION_MANAGE_SUPERVISOR_RESTRICTION = "android.settings.MANAGE_SUPERVISOR_RESTRICTION"
ACTION_MOBILE_DATA_SETTINGS = "android.settings.MOBILE_DATA_SETTINGS"
ACTION_PRINT_SETTINGS = "android.settings.PRINT_SETTINGS"
ACTION_PROCESS_WIFI_CREDENTIAL = "android.settings.PROCESS_WIFI_CREDENTIAL"
ACTION_QUICK_ACCESS_WALLET_SETTINGS = "android.settings.QUICK_ACCESS_WALLET_SETTINGS"
ACTION_QUICK_LAUNCH_SETTINGS = "android.settings.QUICK_LAUNCH_SETTINGS"
ACTION_SEARCH_SETTINGS = "android.settings.SEARCH_SETTINGS"
ACTION_STORAGE_VOLUME_ACCESS_SETTINGS = "android.settings.STORAGE_VOLUME_ACCESS_SETTINGS"
ACTION_SYSTEM_UPDATE_SETTINGS = "android.settings.SYSTEM_UPDATE_SETTINGS"
ACTION_TEST_SETTINGS = "android.settings.TEST_SETTINGS"
ACTION_TTS_SETTINGS = "android.settings.TTS_SETTINGS"
ACTION_USER_DICTIONARY_SETTINGS = "android.settings.USER_DICTIONARY_SETTINGS"
ACTION_VOICE_CONTROL_AIRPLANE_MODE = "android.settings.VOICE_CONTROL_AIRPLANE_MODE"
ACTION_VOICE_CONTROL_BATTERY_SAVER = "android.settings.VOICE_CONTROL_BATTERY_SAVER"
ACTION_VOICE_CONTROL_DO_NOT_DISTURB = "android.settings.VOICE_CONTROL_DO_NOT_DISTURB"
ACTION_VOICE_INPUT_SETTINGS = "android.settings.VOICE_INPUT_SETTINGS"
ACTION_WEBVIEW_SETTINGS = "android.settings.WEBVIEW_SETTINGS"
ACTION_WIFI_AP_SETTINGS = "android.settings.WIFI_AP_SETTINGS"
ACTION_WIFI_AP_SETTINGS_SHORT = "android.settings.WIFI_AP_SETTINGS"
ACTION_WIFI_SCAN_SETTINGS = "android.settings.WIFI_SCAN_SETTINGS"
ACTION_WIFI_SETUP = "android.settings.WIFI_SETUP"
ACTION_WIRELESS_SETTINGS_SHORT = "android.settings.WIRELESS_SETTINGS"
ACTION_ENTER_CAR_MODE = "android.intent.action.ENTER_CAR_MODE"
ACTION_EXIT_CAR_MODE = "android.intent.action.EXIT_CAR_MODE"
ACTION_CAR_MODE_SETTINGS = "android.settings.CAR_MODE_SETTINGS"
ACTION_CAR_DOCK_CONNECT = "android.intent.action.CAR_DOCK"
ACTION_DESK_DOCK_CONNECT = "android.intent.action.DESK_DOCK"
ACTION_LE_DESK_DOCK_CONNECT = "android.intent.action.LE_DESK_DOCK"
ACTION_HEADSET_PLUG_SHORT = "android.intent.action.HEADSET_PLUG"
ACTION_USB_ANLG_HEADSET_PLUG = "android.intent.action.USB_ANLG_HEADSET_PLUG"
ACTION_USB_DGTL_HEADSET_PLUG = "android.intent.action.USB_DGTL_HEADSET_PLUG"
ACTION_HTC_CONNECTOR_PLUG = "android.intent.action.HTC_CONNECTOR_PLUG"
ACTION_HTC_CONNECTOR_PLUG_SHORT = "android.intent.action.HTC_CONNECTOR_PLUG"
ACTION_NFC_DISCOVERED = "android.nfc.action.NDEF_DISCOVERED"
ACTION_TAG_FOUND = "android.nfc.action.TAG_FOUND"
ACTION_TECH_DISCOVERED = "android.nfc.action.TECH_DISCOVERED"
ACTION_TAB_CHANGED = "android.intent.action.TAB_CHANGED"
ACTION_TETHER_STATE_CHANGED = "android.net.wifi.WIFI_AP_STATE_CHANGED"
ACTION_TRANSACTION_DETECTED = "android.nfc.action.TRANSACTION_DETECTED"
ACTION_PHONE_STATE_CHANGED = "android.intent.action.PHONE_STATE"
ACTION_ACCOUNT_REMOVED = "android.accounts.action.ACCOUNT_REMOVED"
ACTION_ACCOUNT_VISIBLE = "android.accounts.action.ACCOUNT_VISIBLE"
ACTION_VOICEMAIL_SMS_RECEIVED = "android.intent.action.VOICEMAIL_SMS_RECEIVED"
ACTION_USER_ADDED = "android.intent.action.USER_ADDED"
ACTION_USER_REMOVED = "android.intent.action.USER_REMOVED"
ACTION_USER_SWITCHED = "android.intent.action.USER_SWITCHED"
ACTION_USER_STARTED = "android.intent.action.USER_STARTED"
ACTION_USER_STOPPED = "android.intent.action.USER_STOPPED"
ACTION_USER_BACKGROUND = "android.intent.action.USER_BACKGROUND"
ACTION_USER_FOREGROUND = "android.intent.action.USER_FOREGROUND"
ACTION_USER_INITIALIZE = "android.intent.action.USER_INITIALIZE"
ACTION_USER_UNLOCKED = "android.intent.action.USER_UNLOCKED"
ACTION_OVERLAY_CHANGED = "android.intent.action.OVERLAY_CHANGED"
ACTION_SYSTEM_TUTORIAL = "android.intent.action.SYSTEM_TUTORIAL"
ACTION_APP_ERROR = "android.intent.action.APP_ERROR"
ACTION_BUG_REPORT = "android.intent.action.BUG_REPORT"
ACTION_CLOSE_SYSTEM_DIALOGS = "android.intent.action.CLOSE_SYSTEM_DIALOGS"
ACTION_PREFERRED_ACTIVITY_CHANGED = "android.intent.action.PREFERRED_ACTIVITY_CHANGED"
ACTION_REBOOT_SHORT = "android.intent.action.REBOOT"
ACTION_SCREEN_ON_LATE = "android.intent.action.SCREEN_ON_LATE"
ACTION_SUBSCRIBER_FEATURES_CHANGED = "android.intent.action.SUBSCRIBER_FEATURES_CHANGED"
ACTION_SYSTEM_OVERLAY = "android.intent.action.SYSTEM_OVERLAY"
ACTION_UID_REMOVED = "android.intent.action.UID_REMOVED"
ACTION_CONTENT_CHANGED = "android.intent.action.CONTENT_CHANGED"
ACTION_DOWNLOAD_COMPLETE = "android.intent.action.DOWNLOAD_COMPLETE"
ACTION_DOWNLOAD_NOTIFICATION_CLICKED = "android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED"
ACTION_NOTIFICATION_CLICK = "android.intent.action.NOTIFICATION_CLICK"
ACTION_DELETE_SHORT = "android.intent.action.DELETE"
ACTION_INSERT_SHORT = "android.intent.action.INSERT"
ACTION_REBOOT_2 = "android.intent.action.REBOOT"
ACTION_PICK_ACTIVITY_SHORT = "android.intent.action.PICK_ACTIVITY"
ACTION_GET_CONTENT_SHORT = "android.intent.action.GET_CONTENT"
ACTION_SEND_SHORT = "android.intent.action.SEND"
ACTION_ANSWER_SHORT = "android.intent.action.ANSWER"
ACTION_INSERT_OR_EDIT = "android.intent.action.INSERT_OR_EDIT"
ACTION_PASTE = "android.intent.action.PASTE"
ACTION_CLOSE = "android.intent.action.CLOSE"
ACTION_SAVE = "android.intent.action.SAVE"
ACTION_UNDO = "android.intent.action.UNDO"
ACTION_REDO = "android.intent.action.REDO"
ACTION_CUT = "android.intent.action.CUT"
ACTION_COPY = "android.intent.action.COPY"
ACTION_PRINT = "android.intent.action.PRINT"
ACTION_PLAY = "android.intent.action.PLAY"
ACTION_PAUSE = "android.intent.action.PAUSE"
ACTION_STOP = "android.intent.action.STOP"
ACTION_NEXT = "android.intent.action.NEXT"
ACTION_PREVIOUS = "android.intent.action.PREVIOUS"
ACTION_FAST_FORWARD = "android.intent.action.FAST_FORWARD"
ACTION_REWIND = "android.intent.action.REWIND"
ACTION_PLAY_PAUSE = "android.intent.action.PLAY_PAUSE"
ACTION_MUTE = "android.intent.action.MUTE"
ACTION_VOLUME_UP = "android.intent.action.VOLUME_UP"
ACTION_VOLUME_DOWN = "android.intent.action.VOLUME_DOWN"
ACTION_INFO = "android.intent.action.INFO"
ACTION_REPLY = "android.intent.action.REPLY"
ACTION_FORWARD = "android.intent.action.FORWARD"
ACTION_COMPOSE = "android.intent.action.COMPOSE"
ACTION_REFRESH = "android.intent.action.REFRESH"
ACTION_SEARCH_LONG_PRESS = "android.intent.action.SEARCH_LONG_PRESS"
ACTION_MUSIC_PLAYER = "android.intent.action.MUSIC_PLAYER"
ACTION_ALARM_CHANGED = "android.intent.action.ALARM_CHANGED"
ACTION_NEXT_ALARM_SET = "android.intent.action.NEXT_ALARM_SET"
ACTION_ALL_APPS = "android.intent.action.ALL_APPS"
ACTION_BOOKMARK = "android.intent.action.BOOKMARK"
ACTION_CHROME_ICON = "android.intent.action.CHROME_ICON"
ACTION_ERROR = "android.intent.action.ERROR"
ACTION_GADGET = "android.intent.action.GADGET"
ACTION_GOOGLE = "android.intent.action.GOOGLE"
ACTION_HOTWORD = "android.intent.action.HOTWORD"
ACTION_ICON = "android.intent.action.ICON"
ACTION_LAUNCH = "android.intent.action.LAUNCH"
ACTION_MANAGE_PACKAGE_STORAGE = "android.intent.action.MANAGE_PACKAGE_STORAGE"
ACTION_MEDIA_PLAY_FROM_SEARCH = "android.intent.action.MEDIA_PLAY_FROM_SEARCH"
ACTION_MEDIA_PAUSED = "android.intent.action.MEDIA_PAUSED"
ACTION_MEDIA_PLAYING = "android.intent.action.MEDIA_PLAYING"
ACTION_MEDIA_UNPAUSED = "android.intent.action.MEDIA_UNPAUSED"
ACTION_NAVIGATE = "android.intent.action.NAVIGATE"
ACTION_NEW_APPLICATION = "android.intent.action.NEW_APPLICATION"
ACTION_NO_DOWNLOAD = "android.intent.action.NO_DOWNLOAD"
ACTION_NO_INSTALL = "android.intent.action.NO_INSTALL"
ACTION_PACKAGE_INSTALL = "android.intent.action.PACKAGE_INSTALL"
ACTION_RADIO = "android.intent.action.RADIO"
ACTION_RECORD = "android.intent.action.RECORD"
ACTION_REMEMBER = "android.intent.action.REMEMBER"
ACTION_RINGER_MODE_CHANGED = "android.media.RINGER_MODE_CHANGED"
ACTION_SEND_REPORT = "android.intent.action.SEND_REPORT"
ACTION_SET_WALLPAPER = "android.intent.action.SET_WALLPAPER"
ACTION_SHOW_ALARM = "android.intent.action.SHOW_ALARM"
ACTION_SHORTCUT = "android.intent.action.SHORTCUT"
ACTION_START = "android.intent.action.START"
ACTION_STATISTICS = "android.intent.action.STATISTICS"
ACTION_STOP_APPLICATION = "android.intent.action.STOP_APPLICATION"
ACTION_STOP_SERVICE = "android.intent.action.STOP_SERVICE"
ACTION_SYSTEM_DEVICE = "android.intent.action.SYSTEM_DEVICE"
ACTION_SYSTEM_UPDATE = "android.intent.action.SYSTEM_UPDATE"
ACTION_THEME = "android.intent.action.THEME"
ACTION_UNINSTALL = "android.intent.action.UNINSTALL"
ACTION_UNUSED = "android.intent.action.UNUSED"
ACTION_UPDATE = "android.intent.action.UPDATE"
ACTION_UPGRADE = "android.intent.action.UPGRADE"
ACTION_VERIFY = "android.intent.action.VERIFY"
ACTION_VIEW_APK = "android.intent.action.VIEW_APK"
ACTION_VIEW_CONTACTS = "android.intent.action.VIEW_CONTACTS"
ACTION_VIEW_URL = "android.intent.action.VIEW_URL"
ACTION_VOICE_RECOGNIZE = "android.intent.action.VOICE_RECOGNIZE"
ACTION_WEB_SEARCH_SHORT = "android.intent.action.WEB_SEARCH"
# ═══════════════════════════════════════════════════════════════
# CATEGORY_* — 标准 Intent Category 常量
# ═══════════════════════════════════════════════════════════════
CATEGORY_DEFAULT = "android.intent.category.DEFAULT"
CATEGORY_BROWSABLE = "android.intent.category.BROWSABLE"
CATEGORY_TAB = "android.intent.category.TAB"
CATEGORY_ALTERNATIVE = "android.intent.category.ALTERNATIVE"
CATEGORY_SELECTED_ALTERNATIVE = "android.intent.category.SELECTED_ALTERNATIVE"
CATEGORY_LAUNCHER = "android.intent.category.LAUNCHER"
CATEGORY_INFO = "android.intent.category.INFO"
CATEGORY_HOME = "android.intent.category.HOME"
CATEGORY_PREFERENCE = "android.intent.category.PREFERENCE"
CATEGORY_TEST = "android.intent.category.TEST"
CATEGORY_CAR_DOCK = "android.intent.category.CAR_DOCK"
CATEGORY_DESK_DOCK = "android.intent.category.DESK_DOCK"
CATEGORY_LE_DESK_DOCK = "android.intent.category.LE_DESK_DOCK"
CATEGORY_HE_DESK_DOCK = "android.intent.category.HE_DESK_DOCK"
CATEGORY_CAR_MODE = "android.intent.category.CAR_MODE"
CATEGORY_APP_MARKET = "android.intent.category.APP_MARKET"
CATEGORY_APP_BROWSER = "android.intent.category.APP_BROWSER"
CATEGORY_APP_CALCULATOR = "android.intent.category.APP_CALCULATOR"
CATEGORY_APP_CALENDAR = "android.intent.category.APP_CALENDAR"
CATEGORY_APP_CONTACTS = "android.intent.category.APP_CONTACTS"
CATEGORY_APP_EMAIL = "android.intent.category.APP_EMAIL"
CATEGORY_APP_GALLERY = "android.intent.category.APP_GALLERY"
CATEGORY_APP_MAPS = "android.intent.category.APP_MAPS"
CATEGORY_APP_MESSAGING = "android.intent.category.APP_MESSAGING"
CATEGORY_APP_MUSIC = "android.intent.category.APP_MUSIC"
CATEGORY_APP_FILES = "android.intent.category.APP_FILES"
CATEGORY_APP_CLOCK = "android.intent.category.APP_CLOCK"
CATEGORY_APP_SETTINGS = "android.intent.category.APP_SETTINGS"
CATEGORY_APP_WEATHER = "android.intent.category.APP_WEATHER"
CATEGORY_APP_VIDEO = "android.intent.category.APP_VIDEO"
CATEGORY_APP_CHAT = "android.intent.category.APP_CHAT"
CATEGORY_APP_GAME = "android.intent.category.APP_GAME"
CATEGORY_APP_FINANCE = "android.intent.category.APP_FINANCE"
CATEGORY_APP_NEWS = "android.intent.category.APP_NEWS"
CATEGORY_APP_SOCIAL = "android.intent.category.APP_SOCIAL"
CATEGORY_APP_PHOTOGRAPHY = "android.intent.category.APP_PHOTOGRAPHY"
CATEGORY_APP_PRODUCTIVITY = "android.intent.category.APP_PRODUCTIVITY"
CATEGORY_APP_TRAVEL = "android.intent.category.APP_TRAVEL"
CATEGORY_APP_WALLPAPER = "android.intent.category.APP_WALLPAPER"
CATEGORY_APP_RECENTS = "android.intent.category.APP_RECENTS"
CATEGORY_OPENABLE = "android.intent.category.OPENABLE"
CATEGORY_TYPED_OPENABLE = "android.intent.category.TYPED_OPENABLE"
CATEGORY_MONKEY = "android.intent.category.MONKEY"
CATEGORY_DEVELOPMENT_PREFERENCE = "android.intent.category.DEVELOPMENT_PREFERENCE"
CATEGORY_EMBED = "android.intent.category.EMBED"
CATEGORY_FRAMEWORK_INSTRUMENTATION_TEST = "android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST"
CATEGORY_MASTER_CLEAR = "android.intent.category.MASTER_CLEAR"
CATEGORY_UNIT_TEST = "android.intent.category.UNIT_TEST"
CATEGORY_SAMPLE_CODE = "android.intent.category.SAMPLE_CODE"
CATEGORY_ACCESSIBILITY = "android.intent.category.ACCESSIBILITY"
CATEGORY_VOICE = "android.intent.category.VOICE"
CATEGORY_NOTIFICATION_PREFERENCES = "android.intent.category.NOTIFICATION_PREFERENCES"
CATEGORY_SEARCH_RESULT = "android.intent.category.SEARCH_RESULT"
CATEGORY_LEANBACK_LAUNCHER = "android.intent.category.LEANBACK_LAUNCHER"
CATEGORY_LEANBACK_SETTINGS = "android.intent.category.LEANBACK_SETTINGS"
CATEGORY_LEANBACK_VIDEO = "android.intent.category.LEANBACK_VIDEO"
CATEGORY_LEANBACK_DOCUMENT = "android.intent.category.LEANBACK_DOCUMENT"
CATEGORY_LEANBACK_HOME = "android.intent.category.LEANBACK_HOME"
CATEGORY_LEANBACK_SEARCH = "android.intent.category.LEANBACK_SEARCH"
CATEGORY_SECONDARY_HOME = "android.intent.category.SECONDARY_HOME"
CATEGORY_PREFERENCE_SHORT = "android.intent.category.PREFERENCE"
CATEGORY_TEST_SHORT = "android.intent.category.TEST"
CATEGORY_DESK_DOCK_SHORT = "android.intent.category.DESK_DOCK"
CATEGORY_CAR_DOCK_SHORT = "android.intent.category.CAR_DOCK"
CATEGORY_LE_DESK_DOCK_SHORT = "android.intent.category.LE_DESK_DOCK"
# ═══════════════════════════════════════════════════════════════
# EXTRA_* — 标准 Intent Extra 常量
# ═══════════════════════════════════════════════════════════════
EXTRA_ALARM_COUNT = "android.intent.extra.ALARM_COUNT"
EXTRA_BUG_REPORT = "android.intent.extra.BUG_REPORT"
EXTRA_DATA_REMOVED = "android.intent.extra.DATA_REMOVED"
EXTRA_DOCK_STATE = "android.intent.extra.DOCK_STATE"
EXTRA_DOCK_STATE_HE_DESK = 4
EXTRA_DOCK_STATE_LE_DESK = 3
EXTRA_DOCK_STATE_CAR = 2
EXTRA_DOCK_STATE_DESK = 1
EXTRA_DOCK_STATE_UNDOCKED = 0
EXTRA_DONT_KILL_APP = "android.intent.extra.DONT_KILL_APP"
EXTRA_EMAIL = "android.intent.extra.EMAIL"
EXTRA_INITIAL_INTENTS = "android.intent.extra.INITIAL_INTENTS"
EXTRA_INTENT = "android.intent.extra.INTENT"
EXTRA_KEY_EVENT = "android.intent.extra.KEY_EVENT"
EXTRA_LOCAL_ONLY = "android.intent.extra.LOCAL_ONLY"
EXTRA_MIME_TYPES = "android.intent.extra.MIME_TYPES"
EXTRA_NOT_INITIALIZED = "android.intent.extra.NOT_INITIALIZED"
EXTRA_PACKAGES = "android.intent.extra.PACKAGES"
EXTRA_PHONE_NUMBER = "android.intent.extra.PHONE_NUMBER"
EXTRA_REFERRER = "android.intent.extra.REFERRER"
EXTRA_REFERRER_NAME = "android.intent.extra.REFERRER_NAME"
EXTRA_REMOTE_INTENT_TOKEN = "android.intent.extra.remote_intent_token"
EXTRA_REPLACING = "android.intent.extra.REPLACING"
EXTRA_SHORTCUT_ICON = "android.intent.extra.shortcut.ICON"
EXTRA_SHORTCUT_ICON_RESOURCE = "android.intent.extra.shortcut.ICON_RESOURCE"
EXTRA_SHORTCUT_INTENT = "android.intent.extra.shortcut.INTENT"
EXTRA_SHORTCUT_NAME = "android.intent.extra.shortcut.NAME"
EXTRA_SHUTDOWN_USERSPACE_ONLY = "android.intent.extra.SHUTDOWN_USERSPACE_ONLY"
EXTRA_STREAM = "android.intent.extra.STREAM"
EXTRA_SUBJECT = "android.intent.extra.SUBJECT"
EXTRA_TEMPLATE = "android.intent.extra.TEMPLATE"
EXTRA_TEXT = "android.intent.extra.TEXT"
EXTRA_TITLE = "android.intent.extra.TITLE"
EXTRA_UID = "android.intent.extra.UID"
EXTRA_USER = "android.intent.extra.USER"
EXTRA_USER_ID = "android.intent.extra.USER_ID"
EXTRA_USER_HANDLE = "android.intent.extra.USER_HANDLE"
EXTRA_ALLOW_MULTIPLE = "android.intent.extra.ALLOW_MULTIPLE"
EXTRA_HTML_TEXT = "android.intent.extra.HTML_TEXT"
EXTRA_CC = "android.intent.extra.CC"
EXTRA_BCC = "android.intent.extra.BCC"
EXTRA_FROM_STORAGE = "android.intent.extra.FROM_STORAGE"
EXTRA_INSTALLER_PACKAGE_NAME = "android.intent.extra.INSTALLER_PACKAGE_NAME"
EXTRA_NOTIFICATION_ID = "android.intent.extra.NOTIFICATION_ID"
EXTRA_NOTIFICATION_TAG = "android.intent.extra.NOTIFICATION_TAG"
EXTRA_CHANNEL_ID = "android.intent.extra.CHANNEL_ID"
EXTRA_CHANNEL_GROUP_ID = "android.intent.extra.CHANNEL_GROUP_ID"
EXTRA_CONVERSATION_ID = "android.intent.extra.CONVERSATION_ID"
EXTRA_IS_GROUP_CONVERSATION = "android.intent.extra.IS_GROUP_CONVERSATION"
EXTRA_MESSAGES = "android.intent.extra.MESSAGES"
EXTRA_PEOPLE = "android.intent.extra.PEOPLE"
EXTRA_SELF_DISPLAY_NAME = "android.intent.extra.SELF_DISPLAY_NAME"
EXTRA_TIME = "android.intent.extra.TIME"
EXTRA_SIZE = "android.intent.extra.SIZE"
EXTRA_COUNTRY = "android.intent.extra.COUNTRY"
EXTRA_LOCATION = "android.intent.extra.LOCATION"
EXTRA_LATITUDE = "android.intent.extra.LATITUDE"
EXTRA_LONGITUDE = "android.intent.extra.LONGITUDE"
EXTRA_ALTITUDE = "android.intent.extra.ALTITUDE"
EXTRA_BEARING = "android.intent.extra.BEARING"
EXTRA_SPEED = "android.intent.extra.SPEED"
EXTRA_ACCURACY = "android.intent.extra.ACCURACY"
EXTRA_POI_NAME = "android.intent.extra.POI_NAME"
EXTRA_PHONE_NUMBER_SHORT = "android.intent.extra.PHONE_NUMBER"
EXTRA_RINGER_MODE = "android.intent.extra.RINGER_MODE"
EXTRA_VIBRATE_SETTING = "android.intent.extra.VIBRATE_SETTING"
EXTRA_VOLUME_STREAM_TYPE = "android.intent.extra.VOLUME_STREAM_TYPE"
EXTRA_VOLUME_STREAM_VALUE = "android.intent.extra.VOLUME_STREAM_VALUE"
EXTRA_VOLUME_STREAM_VOLUME = "android.intent.extra.VOLUME_STREAM_VOLUME"
EXTRA_FORCE_MASTER_VOLUME_MUTE = "android.intent.extra.FORCE_MASTER_VOLUME_MUTE"
EXTRA_PREVIOUS_VOLUME_STREAM_VALUE = "android.intent.extra.PREVIOUS_VOLUME_STREAM_VALUE"
EXTRA_VIBRATE_TYPE = "android.intent.extra.VIBRATE_TYPE"
EXTRA_SCREEN_OFF_TIMEOUT = "android.intent.extra.SCREEN_OFF_TIMEOUT"
EXTRA_TASK_ID = "android.intent.extra.TASK_ID"
EXTRA_WINDOW_MINIMUM_SIZE_MAJOR = "android.intent.extra.WINDOW_MINIMUM_SIZE_MAJOR"
EXTRA_WINDOW_MINIMUM_SIZE_MINOR = "android.intent.extra.WINDOW_MINIMUM_SIZE_MINOR"
EXTRA_CHANGED_COMPONENT_NAME = "android.intent.extra.changed_component_name"
EXTRA_CHANGED_COMPONENT_NAME_LIST = "android.intent.extra.changed_component_name_list"
EXTRA_CHANGED_UID = "android.intent.extra.changed_uid"
EXTRA_DATA_REMOVED_SHORT = "android.intent.extra.DATA_REMOVED"
EXTRA_DOCK_STATE_SHORT = "android.intent.extra.DOCK_STATE"
EXTRA_REPLACING_SHORT = "android.intent.extra.REPLACING"
EXTRA_SERVICE_INFO = "android.intent.extra.SERVICE_INFO"
EXTRA_SERVICE_COMPONENT = "android.intent.extra.SERVICE_COMPONENT"
EXTRA_REQUEST_QUALITY = "android.intent.extra.REQUEST_QUALITY"
EXTRA_ORIGINATING_URI = "android.intent.extra.ORIGINATING_URI"
EXTRA_REFERRER_SHORT = "android.intent.extra.REFERRER"
EXTRA_ORIGINATING_UID = "android.intent.extra.ORIGINATING_UID"
EXTRA_CALLING_PACKAGE = "android.intent.extra.CALLING_PACKAGE"
EXTRA_CALLING_UID = "android.intent.extra.CALLING_UID"
EXTRA_CALLING_ACTIVITY = "android.intent.extra.CALLING_ACTIVITY"
EXTRA_LAUNCHER_INTENT = "android.intent.extra.LAUNCHER_INTENT"
EXTRA_WALLPAPER_OFFSET = "android.intent.extra.WALLPAPER_OFFSET"
EXTRA_WALLPAPER_ID = "android.intent.extra.WALLPAPER_ID"
EXTRA_CHOOSER_TARGETS = "android.intent.extra.CHOOSER_TARGETS"
EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER = "android.intent.extra.CHOOSER_REFINEMENT_INTENT_SENDER"
EXTRA_RESULT_RECEIVER = "android.intent.extra.RESULT_RECEIVER"
EXTRA_ALARM_GROUP_ID = "android.intent.extra.ALARM_GROUP_ID"
EXTRA_DELAY = "android.intent.extra.DELAY"
EXTRA_HEADER = "android.intent.extra.HEADER"
EXTRA_PROTOCOL = "android.intent.extra.PROTOCOL"
EXTRA_FETCH_MODE = "android.intent.extra.FETCH_MODE"
EXTRA_ID = "android.intent.extra.ID"
EXTRA_NAME = "android.intent.extra.NAME"
EXTRA_QUERY = "android.intent.extra.QUERY"
EXTRA_DESCRIPTION = "android.intent.extra.DESCRIPTION"
EXTRA_ICON = "android.intent.extra.ICON"
EXTRA_COLOR = "android.intent.extra.COLOR"
EXTRA_ORIENTATION = "android.intent.extra.ORIENTATION"
EXTRA_PRIORITY = "android.intent.extra.PRIORITY"
EXTRA_STATE = "android.intent.extra.STATE"
EXTRA_STATUS = "android.intent.extra.STATUS"
EXTRA_TAG = "android.intent.extra.TAG"
EXTRA_TARGET = "android.intent.extra.TARGET"
EXTRA_TOKEN = "android.intent.extra.TOKEN"
EXTRA_VERSION = "android.intent.extra.VERSION"
EXTRA_URL = "android.intent.extra.URL"
EXTRA_REQUEST_ID = "android.intent.extra.REQUEST_ID"
EXTRA_RESPONSE_CODE = "android.intent.extra.RESPONSE_CODE"
EXTRA_RESPONSE_MESSAGE = "android.intent.extra.RESPONSE_MESSAGE"
EXTRA_AUTHENTICATOR_RESPONSE = "android.accounts.extra.AUTHENTICATOR_RESPONSE"
EXTRA_AUTHENTICATOR_ACCOUNT = "android.accounts.extra.AUTHENTICATOR_ACCOUNT"
EXTRA_AUTHENTICATOR_INTENT = "android.accounts.extra.AUTHENTICATOR_INTENT"
EXTRA_ACCOUNT_TYPE = "android.accounts.extra.ACCOUNT_TYPE"
EXTRA_ACCOUNT_LABEL = "android.accounts.extra.ACCOUNT_LABEL"
EXTRA_ACCOUNT_AUTH_TOKEN_LABEL = "android.accounts.extra.AUTH_TOKEN_LABEL"
EXTRA_PASSWORD = "android.accounts.extra.PASSWORD"
EXTRA_AUTH_TOKEN_TYPE = "android.accounts.extra.AUTH_TOKEN_TYPE"
EXTRA_CONFIRM_CREDENTIALS = "android.accounts.extra.CONFIRM_CREDENTIALS"
EXTRA_UPDATE_CURRENT_ACCOUNT = "android.accounts.extra.UPDATE_CURRENT_ACCOUNT"
EXTRA_ALLOW_ACCOUNT_REAUTH = "android.accounts.extra.ALLOW_ACCOUNT_REAUTH"
EXTRA_UNKNOWN_USER = "android.accounts.extra.UNKNOWN_USER"
# ═══════════════════════════════════════════════════════════════
# FLAG_* — Intent Flag 常量(Android SDK 实际数值)
# ═══════════════════════════════════════════════════════════════
FLAG_GRANT_READ_URI_PERMISSION = 0x00000001
FLAG_GRANT_WRITE_URI_PERMISSION = 0x00000002
FLAG_FROM_BACKGROUND = 0x00000004
FLAG_DEBUG_LOG_RESOLUTION = 0x00000008
FLAG_EXCLUDE_STOPPED_PACKAGES = 0x00000010
FLAG_INCLUDE_STOPPED_PACKAGES = 0x00000020
FLAG_GRANT_PERSISTABLE_URI_PERMISSION = 0x00000040
FLAG_GRANT_PREFIX_URI_PERMISSION = 0x00000080
FLAG_ACTIVITY_MATCH_EXTERNAL = 0x00001000
FLAG_ACTIVITY_NO_HISTORY = 0x40000000
FLAG_ACTIVITY_SINGLE_TOP = 0x20000000
FLAG_ACTIVITY_NEW_TASK = 0x10000000
FLAG_ACTIVITY_MULTIPLE_TASK = 0x08000000
FLAG_ACTIVITY_CLEAR_TOP = 0x04000000
FLAG_ACTIVITY_FORWARD_RESULT = 0x02000000
FLAG_ACTIVITY_PREVIOUS_IS_TOP = 0x01000000
FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS = 0x00800000
FLAG_ACTIVITY_BROUGHT_TO_FRONT = 0x00400000
FLAG_ACTIVITY_RESET_TASK_IF_NEEDED = 0x00200000
FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY = 0x00100000
FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET = 0x00080000
FLAG_ACTIVITY_NEW_DOCUMENT = 0x00080000
FLAG_ACTIVITY_CLEAR_TASK = 0x00008000
FLAG_ACTIVITY_TASK_ON_HOME = 0x00004000
FLAG_ACTIVITY_RETAIN_IN_RECENTS = 0x00002000
FLAG_ACTIVITY_LAUNCH_ADJACENT = 0x00001000
FLAG_ACTIVITY_REORDER_TO_FRONT = 0x00020000
FLAG_ACTIVITY_NO_USER_ACTION = 0x00010000
FLAG_ACTIVITY_NO_ANIMATION = 0x00010000
FLAG_RECEIVER_REGISTERED_ONLY = 0x40000000
FLAG_RECEIVER_REPLACE_PENDING = 0x20000000
FLAG_RECEIVER_FOREGROUND = 0x10000000
FLAG_RECEIVER_NO_ABORT = 0x08000000
FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT = 0x04000000
FLAG_RECEIVER_BOOT_UPGRADE = 0x02000000
FLAG_RECEIVER_INCLUDE_BACKGROUND = 0x01000000
FLAG_RECEIVER_EXCLUDE_BACKGROUND = 0x00800000
FLAG_RECEIVER_FROM_SHELL = 0x00400000
FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS = 0x00200000
FLAG_RECEIVER_OFFLOAD = 0x00100000
FLAG_SYSTEM_BROADCAST = 0x00000040
# ═══════════════════════════════════════════════════════════════
# URI_*, SCHEME_*, MIME_* 常量
# ═══════════════════════════════════════════════════════════════
URI_INTENT_SCHEME = "intent"
SCHEME_FILE = "file"
SCHEME_CONTENT = "content"
SCHEME_ANDROID_RESOURCE = "android.resource"
SCHEME_PACKAGE = "package"
SCHEME_HTTP = "http"
SCHEME_HTTPS = "https"
SCHEME_TEL = "tel"
SCHEME_SMSTO = "smsto"
SCHEME_MAILTO = "mailto"
SCHEME_GEO = "geo"
SCHEME_MARKET = "market"
SCHEME_ABOUT = "about"
MIME_TYPE_TEXT_PLAIN = "text/plain"
MIME_TYPE_TEXT_HTML = "text/html"
MIME_TYPE_TEXT_CALENDAR = "text/calendar"
MIME_TYPE_TEXT_XML = "text/xml"
MIME_TYPE_IMAGE_JPEG = "image/jpeg"
MIME_TYPE_IMAGE_PNG = "image/png"
MIME_TYPE_IMAGE_GIF = "image/gif"
MIME_TYPE_IMAGE_WEBP = "image/webp"
MIME_TYPE_IMAGE_ALL = "image/*"
MIME_TYPE_AUDIO_MPEG = "audio/mpeg"
MIME_TYPE_AUDIO_MP4 = "audio/mp4"
MIME_TYPE_AUDIO_ALL = "audio/*"
MIME_TYPE_VIDEO_MP4 = "video/mp4"
MIME_TYPE_VIDEO_ALL = "video/*"
MIME_TYPE_APPLICATION_PDF = "application/pdf"
MIME_TYPE_APPLICATION_ZIP = "application/zip"
MIME_TYPE_APPLICATION_JSON = "application/json"
MIME_TYPE_APPLICATION_XML = "application/xml"
MIME_TYPE_APPLICATION_OCTET_STREAM = "application/octet-stream"
MIME_TYPE_MULTIPART_MIXED = "multipart/mixed"
MIME_TYPE_MULTIPART_FORM_DATA = "multipart/form-data"
MIME_TYPE_ALL = "*/*"
# ═══════════════════════════════════════════════════════════════
# Intent — 完整扩展
# ═══════════════════════════════════════════════════════════════
class Intent(_BaseIntent):
"""Android Intent — 完整扩展 (桌面存根,继承 app.Intent 的所有方法)"""
# ── ShortcutIconResource inner class ──
class ShortcutIconResource(Stub):
"""ShortcutIconResource — 快捷方式图标资源"""
def __init__(self, packageName: str = "", resourceName: str = ""):
super().__init__()
self.packageName = packageName
self.resourceName = resourceName
@staticmethod
def fromContext(context: Any, iconId: int) -> "Intent.ShortcutIconResource":
return Intent.ShortcutIconResource(
packageName=getattr(context, "getPackageName", lambda: "unknown")(),
resourceName=str(iconId),
)
def toString(self) -> str:
return f"ShortcutIconResource(packageName={self.packageName}, resourceName={self.resourceName})"
# ── FilterComparison inner class ──
class FilterComparison(Stub):
"""FilterComparison — Intent 过滤器比较"""
def __init__(self, intent: "Intent"):
super().__init__()
self._intent = intent
def getIntent(self) -> "Intent":
return self._intent
def equals(self, other: Any) -> bool:
if not isinstance(other, Intent.FilterComparison):
return False
return self._intent.filterEquals(other._intent)
def hashCode(self) -> int:
return self._intent.filterHashCode()
def toString(self) -> str:
return f"FilterComparison({self._intent})"
# ── Intent 主构造 ──
def __init__(self, action: str = "", uri: Optional[str] = None,
package: str = "", component: Optional[Any] = None):
super().__init__()
self._action = action
self._data: Optional[str] = uri
self._type: Optional[str] = None
self._package = package
self._component = component
self._flags: int = 0
self._categories: Set[str] = set()
self._extras: Dict[str, Any] = {}
self._scheme: str = ""
self._authority: str = ""
self._path: str = ""
self._clip_data: Optional[Any] = None
self._identifier: Optional[str] = None
self._selector: Optional["Intent"] = None
self._source_bounds: Optional[Tuple[int, int, int, int]] = None
# ── Action ──
def getAction(self) -> str:
return self._action
def setAction(self, action: str) -> "Intent":
self._action = action
return self
# ── Data / URI ──
def getData(self) -> Optional[str]:
return self._data
def setData(self, data) -> "Intent":
self._data = data
self._type = None
# 从 Uri 提取 scheme
if data is not None:
if hasattr(data, 'getScheme'):
self._scheme = data.getScheme() or ""
elif isinstance(data, str):
from urllib.parse import urlparse
self._scheme = urlparse(data).scheme
return self
def getDataString(self) -> Optional[str]:
if self._data is None:
return None
if isinstance(self._data, str):
return self._data
return str(self._data)
def getScheme(self) -> str:
if self._scheme:
return self._scheme
# 从 data 动态提取
if self._data is not None:
if hasattr(self._data, 'getScheme'):
return self._data.getScheme() or ""
elif isinstance(self._data, str):
from urllib.parse import urlparse
return urlparse(self._data).scheme
return ""
# ── Type ──
def getType(self) -> Optional[str]:
return self._type
def setType(self, type_: str) -> "Intent":
self._type = type_
self._data = None
return self
def setDataAndType(self, data: str, type_: str) -> "Intent":
self._data = data
self._type = type_
return self
def resolveType(self, resolver: Any = None) -> Optional[str]:
return self._type
# ── Scheme ──
def getSchemeSpecificPart(self) -> str:
if self._data and ":" in self._data:
return self._data.split(":", 1)[1]
return ""
# ── Package ──
def getPackage(self) -> str:
return self._package
def setPackage(self, package: str) -> "Intent":
self._package = package or ""
return self
# ── Component ──
def getComponent(self) -> Optional[Any]:
return self._component
def setComponent(self, component: Any) -> "Intent":
self._component = component
return self
def getClassName(self) -> str:
if self._component:
return getattr(self._component, "getClassName", lambda: str(self._component))()
return ""
# ── Flags ──
def getFlags(self) -> int:
return self._flags
def setFlags(self, flags: int) -> "Intent":
self._flags = flags
return self
def addFlags(self, flags: int) -> "Intent":
self._flags |= flags
return self
def removeFlags(self, flags: int) -> None:
self._flags &= ~flags
# ── Categories ──
def hasCategory(self, category: str) -> bool:
return category in self._categories
def getCategories(self) -> Set[str]:
return self._categories.copy()
def addCategory(self, category: str) -> "Intent":
self._categories.add(category)
return self
def removeCategory(self, category: str) -> None:
self._categories.discard(category)
# ── Extras ──
def getExtras(self) -> Dict[str, Any]:
return dict(self._extras)
def hasExtra(self, name: str) -> bool:
return name in self._extras
def getStringExtra(self, name: str) -> Optional[str]:
val = self._extras.get(name)
return str(val) if val is not None else None
def getIntExtra(self, name: str, default: int = 0) -> int:
val = self._extras.get(name)
return int(val) if val is not None else default
def getLongExtra(self, name: str, default: int = 0) -> int:
val = self._extras.get(name)
return int(val) if val is not None else default
def getFloatExtra(self, name: str, default: float = 0.0) -> float:
val = self._extras.get(name)
return float(val) if val is not None else default
def getDoubleExtra(self, name: str, default: float = 0.0) -> float:
val = self._extras.get(name)
return float(val) if val is not None else default
def getBooleanExtra(self, name: str, default: bool = False) -> bool:
val = self._extras.get(name)
return bool(val) if val is not None else default
def getCharExtra(self, name: str, default: str = "") -> str:
val = self._extras.get(name)
return str(val) if val is not None else default
def getShortExtra(self, name: str, default: int = 0) -> int:
val = self._extras.get(name)
return int(val) if val is not None else default
def getByteExtra(self, name: str, default: int = 0) -> int:
val = self._extras.get(name)
return int(val) if val is not None else default
def getSerializableExtra(self, name: str) -> Optional[Any]:
return self._extras.get(name)
def getIntegerArrayListExtra(self, name: str) -> Optional[List[int]]:
val = self._extras.get(name)
if isinstance(val, list) and all(isinstance(v, int) for v in val):
return val
return None
def getStringArrayListExtra(self, name: str) -> Optional[List[str]]:
val = self._extras.get(name)
if isinstance(val, list) and all(isinstance(v, str) for v in val):
return val
return None
def getCharSequenceArrayListExtra(self, name: str) -> Optional[List[str]]:
val = self._extras.get(name)
if isinstance(val, list):
return [str(v) for v in val]
return None
def getBundleExtra(self, name: str) -> Optional[Dict[str, Any]]:
val = self._extras.get(name)
return val if isinstance(val, dict) else None
def putExtra(self, name: str, value: Any) -> "Intent":
self._extras[name] = value
return self
def putExtras(self, extras: Dict[str, Any]) -> "Intent":
self._extras.update(extras)
return self
def removeExtra(self, name: str) -> None:
self._extras.pop(name, None)
def replaceExtras(self, extras: Dict[str, Any]) -> "Intent":
self._extras = dict(extras)
return self
def putIntegerArrayListExtra(self, name: str, values: List[int]) -> "Intent":
self._extras[name] = list(values)
return self
def putStringArrayListExtra(self, name: str, values: List[str]) -> "Intent":
self._extras[name] = list(values)
return self
def putCharSequenceArrayListExtra(self, name: str, values: List[str]) -> "Intent":
self._extras[name] = [str(v) for v in values]
return self
# ── Selector ──
def getSelector(self) -> Optional["Intent"]:
return self._selector
def setSelector(self, selector: "Intent") -> None:
self._selector = selector
# ── ClipData ──
def getClipData(self) -> Optional[Any]:
return self._clip_data
def setClipData(self, clip: Optional[Any]) -> None:
self._clip_data = clip
# ── Identifier ──
def getIdentifier(self) -> Optional[str]:
return self._identifier
def setIdentifier(self, identifier: str) -> None:
self._identifier = identifier
# ── SourceBounds ──
def getSourceBounds(self) -> Optional[Tuple[int, int, int, int]]:
return self._source_bounds
def setSourceBounds(self, bounds: Optional[Tuple[int, int, int, int]]) -> None:
self._source_bounds = bounds
# ── FillIn ──
def fillIn(self, other: "Intent", flags: int = 0) -> int:
"""将 other 的内容合并到当前 Intent"""
changes = 0
if not self._action and other._action:
self._action = other._action
changes |= 1
if not self._data and other._data:
self._data = other._data
changes |= 2
if not self._type and other._type:
self._type = other._type
changes |= 4
if not self._package and other._package:
self._package = other._package
changes |= 8
if not self._component and other._component:
self._component = other._component
changes |= 16
if not self._scheme and other._scheme:
self._scheme = other._scheme
changes |= 32
for cat in other._categories:
if cat not in self._categories:
self._categories.add(cat)
changes |= 64
self._flags |= other._flags
for k, v in other._extras.items():
if k not in self._extras:
self._extras[k] = v
changes |= 128
return changes
# ── FilterEquals (Intent resolution matching) ──
def filterEquals(self, other: Any) -> bool:
"""判断两个 Intent 在 filter 匹配意义上是否相等"""
if not isinstance(other, Intent):
return False
return (self._action == other._action
and self._data == other._data
and self._type == other._type
and self._package == other._package
and self._component == other._component
and self._categories == other._categories)
def filterHashCode(self) -> int:
"""计算 filter 哈希码"""
h = hash(self._action) if self._action else 0
h = h * 31 + (hash(self._data) if self._data else 0)
h = h * 31 + (hash(self._type) if self._type else 0)
h = h * 31 + (hash(self._package) if self._package else 0)
h = h * 31 + (hash(str(self._component)) if self._component else 0)
for cat in sorted(self._categories):
h = h * 31 + hash(cat)
return h & 0x7FFFFFFF
# ── DescribeContents / WriteToParcel ──
def describeContents(self) -> int:
return 0
def writeToParcel(self, dest: Any, flags: int = 0) -> None:
"""写入 Parcel (桌面存根)"""
pass
def readFromParcel(self, source: Any) -> None:
"""从 Parcel 读取 (桌面存根)"""
pass
# ── Create chooser ──
@staticmethod
def createChooser(target: "Intent", title: Optional[str] = None,
sender: Optional[Any] = None) -> "Intent":
intent = Intent(ACTION_CHOOSER)
intent.putExtra(EXTRA_INTENT, target)
if title:
intent.putExtra(EXTRA_TITLE, title)
if sender:
intent.putExtra(EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER, sender)
return intent
@staticmethod
def getIntentOld(action: str) -> "Intent":
return Intent(action)
@staticmethod
def getIntent(uri: str) -> "Intent":
return Intent(uri=uri)
@staticmethod
def parseUri(uri: str, flags: int = 0) -> "Intent":
return Intent(uri=uri)
def toURI(self) -> str:
return f"{self._scheme}:{self._data or ''}#Intent;action={self._action};end"
def toUri(self, flags: int = 0) -> str:
return self.toURI()
def toString(self) -> str:
parts = [f"Intent {{ act={self._action}"]
if self._data:
parts.append(f" dat={self._data}")
if self._type:
parts.append(f" typ={self._type}")
if self._package:
parts.append(f" pkg={self._package}")
if self._component:
parts.append(f" cmp={self._component}")
if self._flags:
parts.append(f" flg=0x{self._flags:08x}")
if self._categories:
parts.append(f" cat={self._categories}")
parts.append(" }")
return "".join(parts)
def equals(self, other: Any) -> bool:
if not isinstance(other, Intent):
return False
return (self._action == other._action
and self._data == other._data
and self._type == other._type
and self._package == other._package)
def hashCode(self) -> int:
h = hash(self._action) if self._action else 0
h = h * 31 + (hash(self._data) if self._data else 0)
h = h * 31 + (hash(self._type) if self._type else 0)
h = h * 31 + (hash(self._package) if self._package else 0)
return h & 0x7FFFFFFF
def clone(self) -> "Intent":
cloned = Intent(self._action, self._data, self._package, self._component)
cloned._type = self._type
cloned._flags = self._flags
cloned._categories = set(self._categories)
cloned._extras = dict(self._extras)
cloned._scheme = self._scheme
cloned._selector = self._selector
cloned._clip_data = self._clip_data
cloned._identifier = self._identifier
cloned._source_bounds = self._source_bounds
return cloned
def toInsecureString(self) -> str:
return self.toString()
def toSecureString(self) -> str:
return self.toString()
def isDocument(self) -> bool:
return bool(self._flags & FLAG_ACTIVITY_NEW_DOCUMENT)
def isExcludingStopped(self) -> bool:
return bool(self._flags & FLAG_EXCLUDE_STOPPED_PACKAGES)
def isWebIntent(self) -> bool:
return self._scheme in (SCHEME_HTTP, SCHEME_HTTPS)
def getBooleanArrayExtra(self, name: str) -> Optional[List[bool]]:
val = self._extras.get(name)
if isinstance(val, list):
return [bool(v) for v in val]
return None
def getIntArrayExtra(self, name: str) -> Optional[List[int]]:
val = self._extras.get(name)
if isinstance(val, list):
return [int(v) for v in val]
return None
def getLongArrayExtra(self, name: str) -> Optional[List[int]]:
val = self._extras.get(name)
if isinstance(val, list):
return [int(v) for v in val]
return None
def getFloatArrayExtra(self, name: str) -> Optional[List[float]]:
val = self._extras.get(name)
if isinstance(val, list):
return [float(v) for v in val]
return None
def getDoubleArrayExtra(self, name: str) -> Optional[List[float]]:
val = self._extras.get(name)
if isinstance(val, list):
return [float(v) for v in val]
return None
def getStringArrayExtra(self, name: str) -> Optional[List[str]]:
val = self._extras.get(name)
if isinstance(val, list):
return [str(v) for v in val]
return None
def getCharSequenceArrayExtra(self, name: str) -> Optional[List[str]]:
val = self._extras.get(name)
if isinstance(val, list):
return [str(v) for v in val]
return None
def getBundleArrayExtra(self, name: str) -> Optional[List[Dict[str, Any]]]:
val = self._extras.get(name)
if isinstance(val, list) and all(isinstance(v, dict) for v in val):
return val
return None
def hasExtraSecret(self, name: str) -> bool:
return name in self._extras
def putExtraSecret(self, name: str, value: Any) -> "Intent":
self._extras[name] = value
return self
def toShortString(self) -> str:
return self.toString()[:80]
def toShortUri(self) -> str:
return self.toUri()[:80]
# ═══════════════════════════════════════════════════════════════
# IntentReceiver
# ═══════════════════════════════════════════════════════════════
class IntentReceiver(Stub):
"""IntentReceiver — Intent 接收器 (桌面存根)"""
def __init__(self):
super().__init__()
self._result_code = 0
self._result_data: Optional[str] = None
self._result_extras: Optional[Dict[str, Any]] = None
self._abort = False
def onReceive(self, context: Any, intent: Intent) -> None:
"""接收 Intent (桌面存根)"""
pass
def getResultCode(self) -> int:
return self._result_code
def setResultCode(self, code: int) -> None:
self._result_code = code
def getResultData(self) -> Optional[str]:
return self._result_data
def setResultData(self, data: str) -> None:
self._result_data = data
def getResultExtras(self) -> Optional[Dict[str, Any]]:
return self._result_extras
def setResultExtras(self, extras: Dict[str, Any]) -> None:
self._result_extras = dict(extras)
def abortBroadcast(self) -> None:
self._abort = True
def isAborted(self) -> bool:
return self._abort
def clearAbortBroadcast(self) -> None:
self._abort = False
def toString(self) -> str:
return f"IntentReceiver(resultCode={self._result_code})"
# ═══════════════════════════════════════════════════════════════
# PendingIntent
# ═══════════════════════════════════════════════════════════════
class PendingIntent(_BasePendingIntent):
"""PendingIntent — 延迟 Intent (继承 app.PendingIntent 的所有方法)"""
FLAG_ONE_SHOT = 1 << 30
FLAG_NO_CREATE = 1 << 29
FLAG_CANCEL_CURRENT = 1 << 28
FLAG_UPDATE_CURRENT = 1 << 27
FLAG_IMMUTABLE = 1 << 26
FLAG_MUTABLE = 1 << 25
def __init__(self, intent: Optional[Intent] = None, requestCode: int = 0,
flags: int = 0):
super().__init__(intent, requestCode, flags)
self._intent = intent
self._request_code = requestCode
self._flags = flags
self._canceled = False
@staticmethod
def getActivity(context: Any, requestCode: int, intent: Intent,
flags: int) -> "PendingIntent":
return PendingIntent(intent, requestCode, flags)
@staticmethod
def getActivities(context: Any, requestCode: int,
intents: List[Intent], flags: int) -> "PendingIntent":
return PendingIntent(intents[0] if intents else None, requestCode, flags)
@staticmethod
def getBroadcast(context: Any, requestCode: int, intent: Intent,
flags: int) -> "PendingIntent":
return PendingIntent(intent, requestCode, flags)
@staticmethod
def getService(context: Any, requestCode: int, intent: Intent,
flags: int) -> "PendingIntent":
return PendingIntent(intent, requestCode, flags)
@staticmethod
def getForegroundService(context: Any, requestCode: int, intent: Intent,
flags: int) -> "PendingIntent":
return PendingIntent(intent, requestCode, flags)
def getIntent(self) -> Optional[Intent]:
return self._intent
def getCreatorPackage(self) -> str:
return ""
def getCreatorUid(self) -> int:
return -1
def getTargetPackage(self) -> str:
return self._intent.getPackage() if self._intent else ""
def getRequestCode(self) -> int:
return self._request_code
def isActivity(self) -> bool:
return True
def isForegroundService(self) -> bool:
return False
def isBroadcast(self) -> bool:
return False
def isService(self) -> bool:
return not self.isActivity() and not self.isBroadcast()
def send(self, code: int = 0, onFinished: Any = None,
handler: Any = None, requiredPermission: Optional[str] = None,
options: Optional[Dict[str, Any]] = None) -> None:
"""发送 PendingIntent (桌面存根)"""
pass
def cancel(self) -> None:
self._canceled = True
def equals(self, other: Any) -> bool:
if not isinstance(other, PendingIntent):
return False
return (self._intent == other._intent
and self._request_code == other._request_code)
def hashCode(self) -> int:
h = hash(self._intent) if self._intent else 0
return (h * 31 + self._request_code) & 0x7FFFFFFF
def toString(self) -> str:
return f"PendingIntent(requestCode={self._request_code}, flags=0x{self._flags:08x})"
def getCreatorToken(self) -> Optional[Any]:
return None
def getTag(self, tagType: str) -> str:
return ""
def writeToParcel(self, dest: Any, flags: int = 0) -> None:
pass
def describeContents(self) -> int:
return 0
# ═══════════════════════════════════════════════════════════════
# IntentSender
# ═══════════════════════════════════════════════════════════════
class IntentSender(Stub):
"""IntentSender — Intent 发送器"""
class SendIntentException(Exception):
"""SendIntentException — Intent 发送异常"""
pass
def __init__(self, intent: Optional[Intent] = None):
super().__init__()
self._intent = intent
@staticmethod
def getActivity(context: Any, requestCode: int, intent: Intent,
flags: int = 0) -> "IntentSender":
return IntentSender(intent)
def getTargetPackage(self) -> str:
return self._intent.getPackage() if self._intent else ""
def getCreatorUid(self) -> int:
return -1
def sendIntent(self, context: Any, code: int, onFinished: Any = None,
handler: Any = None, requiredPermission: str = "") -> None:
"""发送 Intent (桌面存根)"""
pass
def equals(self, other: Any) -> bool:
if not isinstance(other, IntentSender):
return False
return self._intent == other._intent
def hashCode(self) -> int:
return hash(self._intent) & 0x7FFFFFFF if self._intent else 0
def toString(self) -> str:
return f"IntentSender({self._intent})"
def describeContents(self) -> int:
return 0
def writeToParcel(self, dest: Any, flags: int = 0) -> None:
pass
# ═══════════════════════════════════════════════════════════════
# IntentService
# ═══════════════════════════════════════════════════════════════
class IntentService(Stub):
"""IntentService — Intent 服务 (桌面存根)"""
def __init__(self, name: str = "IntentService"):
super().__init__()
self._name = name
self._started = False
self._redelivery = False
def onCreate(self) -> None:
"""服务创建"""
self._started = True
def onStartCommand(self, intent: Optional[Intent], flags: int, startId: int) -> int:
"""接收启动命令"""
return 1 # START_REDELIVER_INTENT
def onBind(self, intent: Intent) -> Optional[Any]:
return None
def onDestroy(self) -> None:
self._started = False
def setIntentRedelivery(self, enabled: bool) -> None:
self._redelivery = enabled
def stopSelf(self) -> None:
self._started = False
def stopSelfResult(self, startId: int) -> bool:
self._started = False
return True
def toString(self) -> str:
return f"IntentService(name={self._name}, started={self._started})"
# ═══════════════════════════════════════════════════════════════
# IntentFilter
# ═══════════════════════════════════════════════════════════════
class IntentFilter(_BaseIntentFilter):
"""IntentFilter — Intent 过滤器 (桌面存根,继承 content.IntentFilter 的所有方法)"""
class AuthorityEntry(Stub):
"""AuthorityEntry — 权限条目"""
def __init__(self, host: str, port: int = -1):
super().__init__()
self._host = host
self._port = port
def getHost(self) -> str:
return self._host
def getPort(self) -> int:
return self._port
def match(self, data: Optional[str]) -> int:
return IntentFilter.MATCH_CATEGORY_HOST if self._host else IntentFilter.NO_MATCH_DATA
def toString(self) -> str:
return f"AuthorityEntry(host={self._host}, port={self._port})"
class MalformedMimeTypeException(Exception):
"""MalformedMimeTypeException — MIME 类型格式错误"""
pass
class PriorityGroup:
"""PriorityGroup — 优先级分组"""
PRIORITY_GROUP_UNDEFINED = 0
PRIORITY_GROUP_BACKGROUND = 0x1000
PRIORITY_GROUP_FOREGROUND = 0x2000
PRIORITY_GROUP_SYSTEM = 0x3000
MATCH_CATEGORY_EMPTY = 0x00000000
MATCH_CATEGORY_SCHEME = 0x00040000
MATCH_CATEGORY_AUTHORITY = 0x00080000
MATCH_CATEGORY_HOST = 0x00100000
MATCH_CATEGORY_PORT = 0x00200000
MATCH_CATEGORY_PATH = 0x00400000
MATCH_CATEGORY_TYPE = 0x00800000
MATCH_ADJUSTMENT_NORMAL = 0x00008000
MATCH_ADJUSTMENT_MASK = 0x0000FFFF
NO_MATCH_ACTION = -3
NO_MATCH_CATEGORY = -4
NO_MATCH_DATA = -2
NO_MATCH_TYPE = -1
MATCH_CATEGORY_MASK = 0xFFFF0000
SYSTEM_HIGH_PRIORITY = 10000
SYSTEM_LOW_PRIORITY = -10000
def __init__(self, action: str = "", dataType: str = "",
dataScheme: str = "", dataAuthority: str = "",
dataPath: str = ""):
super().__init__()
self._actions: List[str] = [action] if action else []
self._categories: List[str] = []
self._data_types: List[str] = [dataType] if dataType else []
self._data_schemes: List[str] = [dataScheme] if dataScheme else []
self._data_authorities: List[IntentFilter.AuthorityEntry] = []
if dataAuthority:
self._data_authorities.append(
IntentFilter.AuthorityEntry(dataAuthority))
self._data_paths: List[str] = [dataPath] if dataPath else []
self._priority: int = 0
self._has_partial_types = False
self._mime_group: Optional[str] = None
self._scheme_specific_parts: List[str] = []
self._data_scheme_specific_parts: List[str] = []
def addAction(self, action: str) -> None:
if action not in self._actions:
self._actions.append(action)
def addCategory(self, category: str) -> None:
if category not in self._categories:
self._categories.append(category)
def addDataType(self, type_: str) -> None:
self._data_types.append(type_)
def addDataScheme(self, scheme: str) -> None:
if scheme not in self._data_schemes:
self._data_schemes.append(scheme)
def addDataAuthority(self, host: str, port: int = -1) -> None:
self._data_authorities.append(
IntentFilter.AuthorityEntry(host, port))
def addDataPath(self, path: str) -> None:
self._data_paths.append(path)
def addDataSchemeSpecificPart(self, ssp: str) -> None:
self._scheme_specific_parts.append(ssp)
def hasAction(self, action: str) -> bool:
return action in self._actions
def hasCategory(self, category: str) -> bool:
return category in self._categories
def hasDataType(self, type_: str) -> bool:
return type_ in self._data_types
def hasDataScheme(self, scheme: str) -> bool:
return scheme in self._data_schemes
def getAction(self, index: int) -> str:
return self._actions[index] if 0 <= index < len(self._actions) else ""
def getCategory(self, index: int) -> str:
return self._categories[index] if 0 <= index < len(self._categories) else ""
def getDataType(self, index: int) -> str:
return self._data_types[index] if 0 <= index < len(self._data_types) else ""
def getDataScheme(self, index: int) -> str:
return self._data_schemes[index] if 0 <= index < len(self._data_schemes) else ""
def getDataAuthority(self, index: int) -> Optional[AuthorityEntry]:
if 0 <= index < len(self._data_authorities):
return self._data_authorities[index]
return None
def countActions(self) -> int:
return len(self._actions)
def countCategories(self) -> int:
return len(self._categories)
def countDataTypes(self) -> int:
return len(self._data_types)
def countDataSchemes(self) -> int:
return len(self._data_schemes)
def countDataAuthorities(self) -> int:
return len(self._data_authorities)
def countDataPaths(self) -> int:
return len(self._data_paths)
def setPriority(self, priority: int) -> None:
self._priority = priority
def getPriority(self) -> int:
return self._priority
def match(self, action: str, type_: Optional[str], scheme: str,
data: Optional[str], categories: Set[str], tag: str = "") -> int:
"""匹配 Intent (桌面存根)"""
if self._actions and action not in self._actions:
return IntentFilter.NO_MATCH_ACTION
# 简化匹配逻辑
return IntentFilter.MATCH_CATEGORY_EMPTY
def matchAction(self, action: str) -> bool:
return action in self._actions
def matchCategories(self, categories: Set[str]) -> Optional[str]:
for cat in categories:
if cat not in self._categories:
return cat
return None
def matchData(self, type_: str, scheme: str, data: str) -> int:
"""匹配数据 (桌面存根)"""
return IntentFilter.MATCH_CATEGORY_EMPTY
def matchDataAuthority(self, data: Optional[str]) -> int:
for auth in self._data_authorities:
if auth.match(data) >= 0:
return IntentFilter.MATCH_CATEGORY_AUTHORITY
return IntentFilter.NO_MATCH_DATA
def describeContents(self) -> int:
return 0
def writeToParcel(self, dest: Any, flags: int = 0) -> None:
pass
def toString(self) -> str:
return (f"IntentFilter(actions={self._actions}, "
f"categories={self._categories}, "
f"types={self._data_types}, "
f"priority={self._priority})")
def equals(self, other: Any) -> bool:
if not isinstance(other, IntentFilter):
return False
return (self._actions == other._actions
and self._categories == other._categories)
def hashCode(self) -> int:
h = 0
for a in self._actions:
h = h * 31 + hash(a)
for c in self._categories:
h = h * 31 + hash(c)
return h & 0x7FFFFFFF
# ═══════════════════════════════════════════════════════════════
# MatchingFlags
# ═══════════════════════════════════════════════════════════════
class MatchingFlags(Stub):
"""MatchingFlags — Intent 匹配标志"""
MATCH_ALL = 0x00000000
MATCH_DEFAULT_ONLY = 0x00010000
MATCH_SYSTEM_ONLY = 0x00020000
MATCH_DEBUG_TRIANGULATION = 0x00000010
MATCH_INSTANT = 0x00000020
MATCH_VISIBLE_TO_INSTANT_APP_ONLY = 0x00000040
MATCH_DIRECT_BOOT_AUTO = 0x00000100
MATCH_DIRECT_BOOT_AWARE = 0x00000200
MATCH_DIRECT_BOOT_UNAWARE = 0x00000400
MATCH_SYSTEM = 0x00010000
MATCH_KNOWN_PACKAGES = 0x00080000
MATCH_VERIFIED = 0x00100000
MATCH_APEX = 0x01000000
def __init__(self, flags: int = MATCH_ALL):
super().__init__()
self._flags = flags
def getFlags(self) -> int:
return self._flags
def setFlags(self, flags: int) -> None:
self._flags = flags
def toString(self) -> str:
return f"MatchingFlags(0x{self._flags:08x})"
# ═══════════════════════════════════════════════════════════════
# ShortcutInfo
# ═══════════════════════════════════════════════════════════════
class ShortcutInfo(Stub):
"""ShortcutInfo — 快捷方式信息"""
DISABLED_REASON_UNDEFINED = 0
DISABLED_REASON_NOT_DISABLED = 1
DISABLED_REASON_BY_APP = 2
DISABLED_REASON_BY_USER = 3
DISABLED_REASON_UNKNOWN = 4
DISABLED_REASON_BACKUP_NOT_SUPPORTED = 5
DISABLED_REASON_BLOCKED = 6
DISABLED_REASON_EXCLUDED = 7
DISABLED_REASON_APP_CHANGED = 8
DISABLED_REASON_RESTORE_APP_REMOVED = 9
DISABLED_REASON_RESTORE_BACKUP_NOT_AVAILABLE = 10
DISABLED_REASON_RESTORE_VERSION_LOWER = 11
DISABLED_REASON_RESTORE_SIGNATURE_MISMATCH = 12
DISABLED_REASON_RESTORE_UID_MISMATCH = 13
DISABLED_REASON_RESTORE_STALE = 14
DISABLED_REASON_RESTORE_OTHER = 15
SHORTCUT_TYPE_CLASSIC = 0
SHORTCUT_TYPE_DYNAMIC = 1
SHORTCUT_TYPE_PINNED = 2
class Builder(Stub):
"""ShortcutInfo.Builder — ShortcutInfo 构建器"""
def __init__(self, context: Any, id_: str):
super().__init__()
self._id = id_
self._context = context
self._short_label = ""
self._long_label = ""
self._disabled_message = ""
self._intent: Optional[Intent] = None
self._intents: List[Intent] = []
self._icon: Optional[Any] = None
self._rank = 0
self._activity: Optional[Any] = None
self._categories: Set[str] = set()
self._is_enabled = True
self._is_declared = False
self._shortcut_type = ShortcutInfo.SHORTCUT_TYPE_CLASSIC
self._icon_resource: Optional[Intent.ShortcutIconResource] = None
self._long_lived = False
self._person: Optional[Any] = None
self._package_name = ""
def setShortLabel(self, label: str) -> "ShortcutInfo.Builder":
self._short_label = label
return self
def setLongLabel(self, label: str) -> "ShortcutInfo.Builder":
self._long_label = label
return self
def setDisabledMessage(self, msg: str) -> "ShortcutInfo.Builder":
self._disabled_message = msg
return self
def setIntent(self, intent: Intent) -> "ShortcutInfo.Builder":
self._intent = intent
return self
def setIntents(self, intents: List[Intent]) -> "ShortcutInfo.Builder":
self._intents = list(intents)
return self
def setIcon(self, icon: Any) -> "ShortcutInfo.Builder":
self._icon = icon
return self
def setRank(self, rank: int) -> "ShortcutInfo.Builder":
self._rank = rank
return self
def setActivity(self, activity: Any) -> "ShortcutInfo.Builder":
self._activity = activity
return self
def setCategories(self, categories: Set[str]) -> "ShortcutInfo.Builder":
self._categories = set(categories)
return self
def setLongLived(self, longLived: bool) -> "ShortcutInfo.Builder":
self._long_lived = longLived
return self
def setShortcutType(self, shortcutType: int) -> "ShortcutInfo.Builder":
self._shortcut_type = shortcutType
return self
def setIconResource(self, resource: Intent.ShortcutIconResource) -> "ShortcutInfo.Builder":
self._icon_resource = resource
return self
def setPackageName(self, packageName: str) -> "ShortcutInfo.Builder":
self._package_name = packageName
return self
def build(self) -> "ShortcutInfo":
info = ShortcutInfo(self._id)
info._short_label = self._short_label
info._long_label = self._long_label
info._disabled_message = self._disabled_message
info._intent = self._intent
info._intents = list(self._intents)
info._icon = self._icon
info._rank = self._rank
info._activity = self._activity
info._categories = set(self._categories)
info._is_enabled = self._is_enabled
info._shortcut_type = self._shortcut_type
info._icon_resource = self._icon_resource
info._long_lived = self._long_lived
info._person = self._person
info._package_name = self._package_name
return info
def __init__(self, id_: str = ""):
super().__init__()
self._id = id_
self._package_name = ""
self._short_label = ""
self._long_label = ""
self._disabled_message = ""
self._intent: Optional[Intent] = None
self._intents: List[Intent] = []
self._icon: Optional[Any] = None
self._rank = 0
self._activity: Optional[Any] = None
self._categories: Set[str] = set()
self._is_enabled = True
self._is_declared = False
self._shortcut_type = ShortcutInfo.SHORTCUT_TYPE_CLASSIC
self._icon_resource: Optional[Intent.ShortcutIconResource] = None
self._last_changed_timestamp = 0
self._long_lived = False
self._person: Optional[Any] = None
self._package_name = ""
def getId(self) -> str:
return self._id
def getPackage(self) -> str:
return self._package_name
def getShortLabel(self) -> str:
return self._short_label
def getLongLabel(self) -> str:
return self._long_label
def getDisabledMessage(self) -> str:
return self._disabled_message
def getIntent(self) -> Optional[Intent]:
return self._intent
def getIntents(self) -> List[Intent]:
return list(self._intents)
def getIcon(self) -> Optional[Any]:
return self._icon
def getRank(self) -> int:
return self._rank
def getActivity(self) -> Optional[Any]:
return self._activity
def getCategories(self) -> Set[str]:
return set(self._categories)
def isEnabled(self) -> bool:
return self._is_enabled
def isDeclared(self) -> bool:
return self._is_declared
def getShortcutType(self) -> int:
return self._shortcut_type
def getLastChangedTimestamp(self) -> int:
return self._last_changed_timestamp
def isLongLived(self) -> bool:
return self._long_lived
def hasIconResource(self) -> bool:
return self._icon_resource is not None
def getIconResource(self) -> Optional[Intent.ShortcutIconResource]:
return self._icon_resource
def setRank(self, rank: int) -> None:
self._rank = rank
def setCategories(self, categories: Set[str]) -> None:
self._categories = set(categories)
def addCategory(self, category: str) -> None:
self._categories.add(category)
def toString(self) -> str:
return (f"ShortcutInfo(id={self._id}, "
f"shortLabel={self._short_label}, "
f"rank={self._rank})")
def equals(self, other: Any) -> bool:
if not isinstance(other, ShortcutInfo):
return False
return self._id == other._id
def hashCode(self) -> int:
return hash(self._id) & 0x7FFFFFFF
# ═══════════════════════════════════════════════════════════════
# ShortcutManager
# ═══════════════════════════════════════════════════════════════
class ShortcutManager(Stub):
"""ShortcutManager — 快捷方式管理器 (扩展)"""
FLAG_MATCH_CACHED = 0x00000001
FLAG_MATCH_DYNAMIC = 0x00000002
FLAG_MATCH_MANIFEST = 0x00000004
FLAG_MATCH_PINNED = 0x00000008
FLAG_GET_ALL = (FLAG_MATCH_DYNAMIC | FLAG_MATCH_MANIFEST | FLAG_MATCH_PINNED)
RESULT_OK = 0
RESULT_FAILURE = -1
RESULT_DISABLED = -2
RESULT_DUPLICATE = -3
RESULT_MAX_SHORTCUTS_REACHED = -4
RESULT_PINNED_MAX_SHORTCUTS_REACHED = -5
RESULT_CALLER_NOT_ALLOWED = -6
RESULT_PACKAGE_NOT_FOUND = -7
RESULT_STORAGE_FULL = -8
def __init__(self, context: Optional[Any] = None):
super().__init__()
self._context = context
self._dynamic_shortcuts: Dict[str, ShortcutInfo] = {}
self._pinned_shortcuts: Dict[str, ShortcutInfo] = {}
self._manifest_shortcuts: Dict[str, ShortcutInfo] = {}
self._cached_shortcuts: Dict[str, ShortcutInfo] = {}
self._max_shortcut_count_per_activity = 5
self._icon_max_width = -1
self._icon_max_height = -1
self._rate_limit_attempts = 0
self._shortcuts_changed_listeners: List[Any] = []
def setDynamicShortcuts(self, shortcutInfos: List[ShortcutInfo]) -> bool:
self._dynamic_shortcuts.clear()
for info in shortcutInfos:
self._dynamic_shortcuts[info.getId()] = info
return True
def getDynamicShortcuts(self) -> List[ShortcutInfo]:
return list(self._dynamic_shortcuts.values())
def getManifestShortcuts(self) -> List[ShortcutInfo]:
return list(self._manifest_shortcuts.values())
def getPinnedShortcuts(self) -> List[ShortcutInfo]:
return list(self._pinned_shortcuts.values())
def getCachedShortcuts(self) -> List[ShortcutInfo]:
return list(self._cached_shortcuts.values())
def addDynamicShortcuts(self, shortcutInfos: List[ShortcutInfo]) -> bool:
for info in shortcutInfos:
self._dynamic_shortcuts[info.getId()] = info
return True
def removeDynamicShortcuts(self, shortcutIds: List[str]) -> None:
for sid in shortcutIds:
self._dynamic_shortcuts.pop(sid, None)
def removeAllDynamicShortcuts(self) -> None:
self._dynamic_shortcuts.clear()
def disableShortcuts(self, shortcutIds: List[str],
disabledMessage: str = "") -> None:
for sid in shortcutIds:
if sid in self._dynamic_shortcuts:
self._dynamic_shortcuts[sid]._is_enabled = False
if sid in self._pinned_shortcuts:
self._pinned_shortcuts[sid]._is_enabled = False
def enableShortcuts(self, shortcutIds: List[str]) -> None:
for sid in shortcutIds:
if sid in self._dynamic_shortcuts:
self._dynamic_shortcuts[sid]._is_enabled = True
if sid in self._pinned_shortcuts:
self._pinned_shortcuts[sid]._is_enabled = True
def getShortcuts(self, matchFlags: int = FLAG_GET_ALL) -> List[ShortcutInfo]:
result: List[ShortcutInfo] = []
if matchFlags & ShortcutManager.FLAG_MATCH_DYNAMIC:
result.extend(self._dynamic_shortcuts.values())
if matchFlags & ShortcutManager.FLAG_MATCH_PINNED:
result.extend(self._pinned_shortcuts.values())
if matchFlags & ShortcutManager.FLAG_MATCH_MANIFEST:
result.extend(self._manifest_shortcuts.values())
if matchFlags & ShortcutManager.FLAG_MATCH_CACHED:
result.extend(self._cached_shortcuts.values())
return result
def updateShortcuts(self, shortcutInfos: List[ShortcutInfo]) -> bool:
for info in shortcutInfos:
sid = info.getId()
if sid in self._dynamic_shortcuts:
self._dynamic_shortcuts[sid] = info
if sid in self._pinned_shortcuts:
self._pinned_shortcuts[sid] = info
return True
def isRateLimitingActive(self) -> bool:
return self._rate_limit_attempts > 5
def getIconMaxWidth(self) -> int:
return self._icon_max_width
def getIconMaxHeight(self) -> int:
return self._icon_max_height
def pushDynamicShortcut(self, shortcut: ShortcutInfo) -> None:
self._dynamic_shortcuts[shortcut.getId()] = shortcut
def removeLongLivedShortcuts(self, shortcutIds: List[str]) -> None:
for sid in shortcutIds:
self._dynamic_shortcuts.pop(sid, None)
self._pinned_shortcuts.pop(sid, None)
def onApplicationActive(self, packageName: str, userId: int) -> None:
"""应用激活回调 (桌面存根)"""
pass
def registerShortcutsChangedListener(
self, listener: Any, handler: Any = None) -> None:
self._shortcuts_changed_listeners.append(listener)
def unregisterShortcutsChangedListener(self, listener: Any) -> None:
if listener in self._shortcuts_changed_listeners:
self._shortcuts_changed_listeners.remove(listener)
def reportShortcutUsed(self, shortcutId: str) -> None:
"""报告快捷方式被使用"""
pass
def setShareTargets(self, packageName: str, shareTargets: List[Any]) -> None:
"""设置分享目标 (桌面存根)"""
pass
def getShareTargets(self, packageName: str) -> List[Any]:
"""获取分享目标 (桌面存根)"""
return []
def getMaxShortcutCountPerActivity(self) -> int:
return self._max_shortcut_count_per_activity
def toString(self) -> str:
return (f"ShortcutManager(dynamic={len(self._dynamic_shortcuts)}, "
f"pinned={len(self._pinned_shortcuts)})")