Struct droid_wrap::android::content::ContextWrapper
source · pub struct ContextWrapper { /* private fields */ }Expand description
- Context 的代理实现,它只是将其所有调用委托给另一个 Context。可以创建子类来修改行为,而无需更改原始 Context。
Implementations§
source§impl ContextWrapper
impl ContextWrapper
sourcepub fn get_class_loader(&self) -> ClassLoader
pub fn get_class_loader(&self) -> ClassLoader
返回可用于查询此包中的类的类加载器。
sourcepub fn send_broadcast(&self, intent: &Intent)
pub fn send_broadcast(&self, intent: &Intent)
将给定的意图广播给所有感兴趣的 BroadcastReceiver。此调用是异步的;它会立即返回,您将在接收器运行时继续执行。接收器不会传播任何结果,接收器也无法中止广播。如果您想允许接收器传播结果或中止广播,则必须使用 sendOrderedBroadcast(Intent, String) 发送有序广播。有关 Intent 广播的更多信息,请参阅 BroadcastReceiver。
intent 要广播的 Intent;与此 Intent 匹配的所有接收器都将收到广播。
Methods from Deref<Target = Context>§
pub const POWER_SERVICE: &'static str = "power"
pub const POWER_STATS_SERVICE: &'static str = "powerstats"
pub const RECOVERY_SERVICE: &'static str = "recovery"
pub const SYSTEM_UPDATE_SERVICE: &'static str = "system_update"
pub const WINDOW_SERVICE: &'static str = "window"
pub const LAYOUT_INFLATER_SERVICE: &'static str = "layout_inflater"
pub const ACCOUNT_SERVICE: &'static str = "account"
pub const ACTIVITY_SERVICE: &'static str = "activity"
pub const ACTIVITY_TASK_SERVICE: &'static str = "activity_task"
pub const URI_GRANTS_SERVICE: &'static str = "uri_grants"
pub const ALARM_SERVICE: &'static str = "alarm"
pub const NOTIFICATION_SERVICE: &'static str = "notification"
pub const ACCESSIBILITY_SERVICE: &'static str = "accessibility"
pub const CAPTIONING_SERVICE: &'static str = "captioning"
pub const KEYGUARD_SERVICE: &'static str = "keyguard"
pub const LOCATION_SERVICE: &'static str = "location"
pub const COUNTRY_DETECTOR: &'static str = "country_detector"
pub const SEARCH_SERVICE: &'static str = "search"
pub const SENSOR_SERVICE: &'static str = "sensor"
pub const SENSOR_PRIVACY_SERVICE: &'static str = "sensor_privacy"
pub const STORAGE_SERVICE: &'static str = "storage"
pub const STORAGE_STATS_SERVICE: &'static str = "storagestats"
pub const WALLPAPER_SERVICE: &'static str = "wallpaper"
pub const VIBRATOR_MANAGER_SERVICE: &'static str = "vibrator_manager"
pub const VIBRATOR_SERVICE: &'static str = "vibrator"
pub const STATUS_BAR_SERVICE: &'static str = "statusbar"
pub const CONNECTIVITY_SERVICE: &'static str = "connectivity"
pub const PAC_PROXY_SERVICE: &'static str = "pac_proxy"
pub const VCN_MANAGEMENT_SERVICE: &'static str = "vcn_management"
pub const NETD_SERVICE: &'static str = "netd"
pub const NETWORK_STACK_SERVICE: &'static str = "network_stack"
pub const TETHERING_SERVICE: &'static str = "tethering"
pub const IPSEC_SERVICE: &'static str = "ipsec"
pub const VPN_MANAGEMENT_SERVICE: &'static str = "vpn_management"
pub const CONNECTIVITY_DIAGNOSTICS_SERVICE: &'static str = "connectivity_diagnostics"
pub const TEST_NETWORK_SERVICE: &'static str = "test_network"
pub const UPDATE_LOCK_SERVICE: &'static str = "updatelock"
pub const NETWORKMANAGEMENT_SERVICE: &'static str = "network_management"
pub const SLICE_SERVICE: &'static str = "slice"
pub const NETWORK_STATS_SERVICE: &'static str = "netstats"
pub const WIFI_SERVICE: &'static str = "wifi"
pub const WIFI_NL80211_SERVICE: &'static str = "wifinl80211"
pub const WIFI_P2P_SERVICE: &'static str = "wifip2p"
pub const WIFI_AWARE_SERVICE: &'static str = "wifiaware"
pub const WIFI_SCANNING_SERVICE: &'static str = "wifiscanner"
pub const WIFI_RTT_SERVICE: &'static str = "rttmanager"
pub const WIFI_RTT_RANGING_SERVICE: &'static str = "wifirtt"
pub const LOWPAN_SERVICE: &'static str = "lowpan"
pub const ETHERNET_SERVICE: &'static str = "ethernet"
pub const NSD_SERVICE: &'static str = "servicediscovery"
pub const AUDIO_SERVICE: &'static str = "audio"
pub const AUDIO_DEVICE_VOLUME_SERVICE: &'static str = "audio_device_volume"
pub const MEDIA_TRANSCODING_SERVICE: &'static str = "media_transcoding"
pub const AUTH_SERVICE: &'static str = "auth"
pub const FINGERPRINT_SERVICE: &'static str = "fingerprint"
pub const FACE_SERVICE: &'static str = "face"
pub const IRIS_SERVICE: &'static str = "iris"
pub const BIOMETRIC_SERVICE: &'static str = "biometric"
pub const MEDIA_COMMUNICATION_SERVICE: &'static str = "media_communication"
pub const MEDIA_ROUTER_SERVICE: &'static str = "media_router"
pub const MEDIA_SESSION_SERVICE: &'static str = "media_session"
pub const TELEPHONY_SERVICE: &'static str = "phone"
pub const TELEPHONY_SUBSCRIPTION_SERVICE: &'static str = "telephony_subscription_service"
pub const TELECOM_SERVICE: &'static str = "telecom"
pub const CARRIER_CONFIG_SERVICE: &'static str = "carrier_config"
pub const EUICC_SERVICE: &'static str = "euicc"
pub const EUICC_CARD_SERVICE: &'static str = "euicc_card"
pub const MMS_SERVICE: &'static str = "mms"
pub const CLIPBOARD_SERVICE: &'static str = "clipboard"
pub const TEXT_CLASSIFICATION_SERVICE: &'static str = "textclassification"
pub const SELECTION_TOOLBAR_SERVICE: &'static str = "selection_toolbar"
pub const FONT_SERVICE: &'static str = "font"
pub const ATTENTION_SERVICE: &'static str = "attention"
pub const ROTATION_RESOLVER_SERVICE: &'static str = "resolver"
pub const INPUT_METHOD_SERVICE: &'static str = "input_method"
pub const TEXT_SERVICES_MANAGER_SERVICE: &'static str = "textservices"
pub const APPWIDGET_SERVICE: &'static str = "appwidget"
pub const VOICE_INTERACTION_MANAGER_SERVICE: &'static str = "voiceinteraction"
pub const AUTOFILL_MANAGER_SERVICE: &'static str = "autofill"
pub const TEXT_TO_SPEECH_MANAGER_SERVICE: &'static str = "texttospeech"
pub const CONTENT_CAPTURE_MANAGER_SERVICE: &'static str = "content_capture"
pub const TRANSLATION_MANAGER_SERVICE: &'static str = "translation"
pub const UI_TRANSLATION_SERVICE: &'static str = "ui_translation"
pub const CONTENT_SUGGESTIONS_SERVICE: &'static str = "content_suggestions"
pub const APP_PREDICTION_SERVICE: &'static str = "app_prediction"
pub const SEARCH_UI_SERVICE: &'static str = "search_ui"
pub const SMARTSPACE_SERVICE: &'static str = "smartspace"
pub const CLOUDSEARCH_SERVICE: &'static str = "cloudsearch"
pub const SOUND_TRIGGER_SERVICE: &'static str = "soundtrigger"
pub const SOUND_TRIGGER_MIDDLEWARE_SERVICE: &'static str = "soundtrigger_middleware"
pub const WALLPAPER_EFFECTS_GENERATION_SERVICE: &'static str = "wallpaper_effects_generation"
pub const MUSIC_RECOGNITION_SERVICE: &'static str = "music_recognition"
pub const PERMISSION_SERVICE: &'static str = "permission"
pub const LEGACY_PERMISSION_SERVICE: &'static str = "legacy_permission"
pub const PERMISSION_CONTROLLER_SERVICE: &'static str = "permission_controller"
pub const PERMISSION_CHECKER_SERVICE: &'static str = "permission_checker"
pub const PERMISSION_ENFORCER_SERVICE: &'static str = "permission_enforcer"
pub const APP_HIBERNATION_SERVICE: &'static str = "app_hibernation"
pub const BACKUP_SERVICE: &'static str = "backup"
pub const ROLLBACK_SERVICE: &'static str = "rollback"
pub const REBOOT_READINESS_SERVICE: &'static str = "reboot_readiness"
pub const DROPBOX_SERVICE: &'static str = "dropbox"
pub const BACKGROUND_INSTALL_CONTROL_SERVICE: &'static str = "background_install_control"
pub const BINARY_TRANSPARENCY_SERVICE: &'static str = "transparency"
pub const DEVICE_IDLE_CONTROLLER: &'static str = "deviceidle"
pub const POWER_WHITELIST_MANAGER: &'static str = "power_whitelist"
pub const POWER_EXEMPTION_SERVICE: &'static str = "power_exemption"
pub const DEVICE_POLICY_SERVICE: &'static str = "device_policy"
pub const UI_MODE_SERVICE: &'static str = "uimode"
pub const DOWNLOAD_SERVICE: &'static str = "download"
pub const BATTERY_SERVICE: &'static str = "batterymanager"
pub const NFC_SERVICE: &'static str = "nfc"
pub const BLUETOOTH_SERVICE: &'static str = "bluetooth"
pub const SIP_SERVICE: &'static str = "sip"
pub const USB_SERVICE: &'static str = "usb"
pub const ADB_SERVICE: &'static str = "adb"
pub const SERIAL_SERVICE: &'static str = "serial"
pub const HDMI_CONTROL_SERVICE: &'static str = "hdmi_control"
pub const INPUT_SERVICE: &'static str = "input"
pub const DISPLAY_SERVICE: &'static str = "display"
pub const COLOR_DISPLAY_SERVICE: &'static str = "color_display"
pub const USER_SERVICE: &'static str = "user"
pub const LAUNCHER_APPS_SERVICE: &'static str = "launcherapps"
pub const RESTRICTIONS_SERVICE: &'static str = "restrictions"
pub const APP_OPS_SERVICE: &'static str = "appops"
pub const ROLE_SERVICE: &'static str = "role"
pub const CAMERA_SERVICE: &'static str = "camera"
pub const PRINT_SERVICE: &'static str = "print"
pub const COMPANION_DEVICE_SERVICE: &'static str = "companiondevice"
pub const VIRTUAL_DEVICE_SERVICE: &'static str = "virtualdevice"
pub const CONSUMER_IR_SERVICE: &'static str = "consumer_ir"
pub const TRUST_SERVICE: &'static str = "trust"
pub const TV_INTERACTIVE_APP_SERVICE: &'static str = "tv_interactive_app"
pub const TV_INPUT_SERVICE: &'static str = "tv_input"
pub const TV_TUNER_RESOURCE_MGR_SERVICE: &'static str = "tv_tuner_resource_mgr"
pub const NETWORK_SCORE_SERVICE: &'static str = "network_score"
pub const USAGE_STATS_SERVICE: &'static str = "usagestats"
pub const JOB_SCHEDULER_SERVICE: &'static str = "jobscheduler"
pub const RESOURCE_ECONOMY_SERVICE: &'static str = "tare"
pub const PERSISTENT_DATA_BLOCK_SERVICE: &'static str = "persistent_data_block"
pub const OEM_LOCK_SERVICE: &'static str = "oem_lock"
pub const MEDIA_PROJECTION_SERVICE: &'static str = "media_projection"
pub const MIDI_SERVICE: &'static str = "midi"
pub const RADIO_SERVICE: &'static str = "broadcastradio"
pub const HARDWARE_PROPERTIES_SERVICE: &'static str = "hardware_properties"
pub const THERMAL_SERVICE: &'static str = "thermalservice"
pub const PERFORMANCE_HINT_SERVICE: &'static str = "performance_hint"
pub const SHORTCUT_SERVICE: &'static str = "shortcut"
pub const CONTEXTHUB_SERVICE: &'static str = "contexthub"
pub const SYSTEM_HEALTH_SERVICE: &'static str = "systemhealth"
pub const GATEKEEPER_SERVICE: &'static str = "android.service.gatekeeper.IGateKeeperService"
pub const DEVICE_IDENTIFIERS_SERVICE: &'static str = "device_identifiers"
pub const INCIDENT_SERVICE: &'static str = "incident"
pub const INCIDENT_COMPANION_SERVICE: &'static str = "incidentcompanion"
pub const STATS_MANAGER_SERVICE: &'static str = "statsmanager"
pub const STATS_COMPANION_SERVICE: &'static str = "statscompanion"
pub const STATS_BOOTSTRAP_ATOM_SERVICE: &'static str = "statsbootstrap"
pub const STATS_MANAGER: &'static str = "stats"
pub const PLATFORM_COMPAT_SERVICE: &'static str = "platform_compat"
pub const PLATFORM_COMPAT_NATIVE_SERVICE: &'static str = "platform_compat_native"
pub const BUGREPORT_SERVICE: &'static str = "bugreport"
pub const OVERLAY_SERVICE: &'static str = "overlay"
pub const RESOURCES_SERVICE: &'static str = "resources"
pub const IDMAP_SERVICE: &'static str = "idmap"
pub const VR_SERVICE: &'static str = "vrmanager"
pub const CROSS_PROFILE_APPS_SERVICE: &'static str = "crossprofileapps"
pub const SECURE_ELEMENT_SERVICE: &'static str = "secure_element"
pub const TIME_DETECTOR_SERVICE: &'static str = "time_detector"
pub const TIME_ZONE_DETECTOR_SERVICE: &'static str = "time_zone_detector"
pub const TIME_MANAGER_SERVICE: &'static str = "time_manager"
pub const APP_BINDING_SERVICE: &'static str = "app_binding"
pub const TELEPHONY_IMS_SERVICE: &'static str = "telephony_ims"
pub const SYSTEM_CONFIG_SERVICE: &'static str = "system_config"
pub const TELEPHONY_RCS_MESSAGE_SERVICE: &'static str = "ircsmessage"
pub const DYNAMIC_SYSTEM_SERVICE: &'static str = "dynamic_system"
pub const BLOB_STORE_SERVICE: &'static str = "blob_store"
pub const TELEPHONY_REGISTRY_SERVICE: &'static str = "telephony_registry"
pub const BATTERY_STATS_SERVICE: &'static str = "batterystats"
pub const APP_SEARCH_SERVICE: &'static str = "app_search"
pub const APP_INTEGRITY_SERVICE: &'static str = "app_integrity"
pub const DATA_LOADER_MANAGER_SERVICE: &'static str = "dataloader_manager"
pub const INCREMENTAL_SERVICE: &'static str = "incremental"
pub const ATTESTATION_VERIFICATION_SERVICE: &'static str = "attestation_verification"
pub const FILE_INTEGRITY_SERVICE: &'static str = "file_integrity"
pub const REMOTE_PROVISIONING_SERVICE: &'static str = "remote_provisioning"
pub const LIGHTS_SERVICE: &'static str = "lights"
pub const UWB_SERVICE: &'static str = "uwb"
pub const DREAM_SERVICE: &'static str = "dream"
pub const SMS_SERVICE: &'static str = "sms"
pub const PEOPLE_SERVICE: &'static str = "people"
pub const DEVICE_STATE_SERVICE: &'static str = "device_state"
pub const MEDIA_METRICS_SERVICE: &'static str = "media_metrics"
pub const SPEECH_RECOGNITION_SERVICE: &'static str = "speech_recognition"
pub const GAME_SERVICE: &'static str = "game"
pub const DOMAIN_VERIFICATION_SERVICE: &'static str = "domain_verification"
pub const DISPLAY_HASH_SERVICE: &'static str = "display_hash"
pub const LOCALE_SERVICE: &'static str = "locale"
pub const SAFETY_CENTER_SERVICE: &'static str = "safety_center"
pub const NEARBY_SERVICE: &'static str = "nearby"
pub const AMBIENT_CONTEXT_SERVICE: &'static str = "ambient_context"
pub const WEARABLE_SENSING_SERVICE: &'static str = "wearable_sensing"
pub const HEALTHCONNECT_SERVICE: &'static str = "healthconnect"
pub const CREDENTIAL_SERVICE: &'static str = "credential"
pub const DEVICE_LOCK_SERVICE: &'static str = "device_lock"
pub const VIRTUALIZATION_SERVICE: &'static str = "virtualization"
pub const GRAMMATICAL_INFLECTION_SERVICE: &'static str = "grammatical_inflection"
pub const SATELLITE_SERVICE: &'static str = "satellite"
pub const SHARED_CONNECTIVITY_SERVICE: &'static str = "shared_connectivity"
sourcepub fn get_class_loader(&self) -> ClassLoader
pub fn get_class_loader(&self) -> ClassLoader
- 返回可用于查询此包中的类的类加载器。
sourcepub fn send_broadcast(&self, intent: &Intent)
pub fn send_broadcast(&self, intent: &Intent)
- 将给定的意图广播给所有感兴趣的 BroadcastReceiver。此调用是异步的;它会立即返回,您将在接收器运行时继续执行。接收器不会传播任何结果,接收器也无法中止广播。如果您想允许接收器传播结果或中止广播,则必须使用 sendOrderedBroadcast(Intent, String) 发送有序广播。有关 Intent 广播的更多信息,请参阅 BroadcastReceiver。
intent要广播的 Intent;与此 Intent 匹配的所有接收器都将收到广播。
sourcepub fn start_activity(&self, intent: &Intent)
pub fn start_activity(&self, intent: &Intent)
- 与 startActivity(Intent, Bundle) 相同,但未指定任何选项。
intent要启动的活动的描述。- 抛出:ActivityNotFoundException – `
sourcepub fn get_package_name(&self) -> String
pub fn get_package_name(&self) -> String
- 返回此应用程序包的名称。
sourcepub fn get_base_package_name(&self) -> String
pub fn get_base_package_name(&self) -> String
- 返回此上下文所派生自的基础上下文的名称。这与 getOpPackageName() 相同,除非系统组件加载到其他应用进程中,在这种情况下 getOpPackageName() 将是该进程中主软件包的名称(以便应用操作 uid 验证可以使用该名称)。
sourcepub fn get_op_package_name(&self) -> String
pub fn get_op_package_name(&self) -> String
- 返回应用于此上下文中的 android.app.AppOpsManager 调用的包名称,以便 app ops manager 的 uid 验证可以使用该名称。这通常不适用于第三方应用程序开发人员。
sourcepub fn get_attribution_tag(&self) -> Option<String>
pub fn get_attribution_tag(&self) -> Option<String>
- 归因可用于复杂的应用中,以在逻辑上区分应用的各个部分。例如,博客应用可能还内置有即时通讯应用。在这种情况下,每个子功能可以使用两个单独的标签。
- 返回:此上下文所针对的归因标签,如果这是默认标签,则返回 null。
sourcepub fn get_package_resource_path(&self) -> String
pub fn get_package_resource_path(&self) -> String
- 返回此上下文的主要 Android 包的完整路径。Android 包是一个 ZIP 文件,其中包含应用程序的主要资源。注意:这通常对应用程序没有用,因为它们不应直接访问文件系统。
- 返回:String 资源路径。
sourcepub fn get_package_code_path(&self) -> String
pub fn get_package_code_path(&self) -> String
- 返回此上下文的主要 Android 包的完整路径。Android 包是一个 ZIP 文件,其中包含应用程序的主要代码和资产。
- 注意:这通常对应用程序没有用,因为它们不应直接访问文件系统。
- 返回:String 代码和资产的路径。
sourcepub fn get_system_service(&self, name: String) -> Option<Object>
pub fn get_system_service(&self, name: String) -> Option<Object>
- 按名称返回系统级服务的句柄。返回对象的类因请求的名称而异。当前可用的名称为:
- WINDOW_SERVICE (“window”)
- 您可以在顶级窗口管理器中放置自定义窗口。返回的对象是 WindowManager。只能从可视上下文(例如 Activity 或使用 createWindowContext(int, Bundle) 创建的上下文)中获取,这些上下文会根据屏幕区域的配置和可视边界进行调整。
- LAYOUT_INFLATER_SERVICE (“layout_inflater”)
- android.view.LayoutInflater 用于在此上下文中填充布局资源。只能从可视上下文(例如 Activity 或使用 createWindowContext(int, Bundle) 创建的上下文)获取,这些上下文会根据屏幕区域的配置和可视边界进行调整。
- ACTIVITY_SERVICE (“activity”)
- 用于与系统全局活动状态交互的 ActivityManager。
- WALLPAPER_SERVICE (“wallpaper”)
- android.service.wallpaper.WallpaperService 用于在此上下文中访问壁纸。只能从可视上下文(例如 Activity 或使用 createWindowContext(int, Bundle) 创建的上下文)获取,这些上下文会根据屏幕区域的配置和可视边界进行调整。
- POWER_SERVICE (“power”)
- 一个用于控制电源管理的android.os.PowerManager。
- ALARM_SERVICE (“alarm”)
- 一个 Android 应用程序 AlarmManager,用于在您选择的时间接收意图。
- NOTIFICATION_SERVICE (“notification”)
- android.app.NotificationManager,用于通知用户后台事件。
- KEYGUARD_SERVICE (“keyguard”)
- 一个用于控制键盘锁的 android.app.KeyguardManager。
- LOCATION_SERVICE (“location”)
- android.location.LocationManager 用于控制位置(例如 GPS)更新。
- SEARCH_SERVICE (“search”)
- 一个用于处理搜索的android.app.SearchManager。
- VIBRATOR_MANAGER_SERVICE (“vibrator_manager”)
- android.os.VibratorManager,用于访问设备振动器、与各个振动器交互以及在多个振动器上播放同步效果。
- VIBRATOR_SERVICE (“vibrator”)
- 一个android.os.Vibrator,用于与振动器硬件进行交互。
- CONNECTIVITY_SERVICE (“connectivity”)
- 用于处理网络连接管理的 ConnectivityManager。
- IPSEC_SERVICE (“ipsec”)
- IpSecManager 用于管理套接字和网络上的 IPSec。
- WIFI_SERVICE (“wifi”)
- 用于管理 Wi-Fi 连接的 WifiManager。在 Android 7 之前的版本中,应仅从应用上下文中获取它,而不能从任何其他派生上下文中获取它,以避免调用过程中出现内存泄漏。
- WIFI_AWARE_SERVICE (“wifiaware”)
- WifiAwareManager 用于管理 Wi-Fi Aware 发现和连接。
- WIFI_P2P_SERVICE (“wifip2p”)
- WifiP2pManager 用于管理 Wi-Fi Direct 连接。
- INPUT_METHOD_SERVICE (“input_method”)
- 用于管理输入方法的 InputMethodManager。
- UI_MODE_SERVICE (“uimode”)
- 一个用于控制 UI 模式的 android.app.UiModeManager。
- DOWNLOAD_SERVICE (“download”)
- 用于请求 HTTP 下载的 android.app.DownloadManager
- BATTERY_SERVICE (“batterymanager”)
- 用于管理电池状态的 android.os.BatteryManager
- JOB_SCHEDULER_SERVICE (“taskmanager”)
- 一个用于管理计划任务的android.app.job.JobScheduler
- NETWORK_STATS_SERVICE (“netstats”)
- 用于查询网络使用情况统计数据的 NetworkStatsManager。
- HARDWARE_PROPERTIES_SERVICE (“hardware_properties”)
- 用于访问硬件属性的 android.os.HardwarePropertiesManager。
- DOMAIN_VERIFICATION_SERVICE (“domain_verification”)
- android.content.pm.verify.domain.DomainVerificationManager,用于访问 Web 域批准状态。
- DISPLAY_HASH_SERVICE (“display_hash”)
- android.view.displayhash.DisplayHashManager 用于管理显示哈希。
- 注意:通过此 API 获取的系统服务可能与获取它们的上下文密切相关。一般来说,不要在各种不同的上下文(活动、应用程序、服务、提供商等)之间共享服务对象。
- 注意:PackageManager.isInstantApp() 返回 true 的免安装应用无法访问以下系统服务:DEVICE_POLICY_SERVICE、FINGERPRINT_SERVICE、KEYGUARD_SERVICE、SHORTCUT_SERVICE、USB_SERVICE、WALLPAPER_SERVICE、WIFI_P2P_SERVICE、WIFI_SERVICE、WIFI_AWARE_SERVICE。对于这些服务,此方法将返回 null。通常,如果您以免安装应用的形式运行,则应始终检查此方法的结果是否为 null。
- 注意:在实现此方法时,请记住可以在较新的 Android 版本中添加新服务,因此如果您只是在寻找上面提到的明确名称,请确保在您无法识别该名称时返回 null — 如果您抛出 RuntimeException 异常,您的应用可能会在新的 Android 版本上中断。
- 返回:如果名称不存在则返回 null。
name所需服务的名称。
Methods from Deref<Target = GlobalRef>§
Methods from Deref<Target = JObject<'static>>§
Trait Implementations§
source§impl Debug for ContextWrapper
impl Debug for ContextWrapper
source§impl Deref for ContextWrapper
impl Deref for ContextWrapper
source§impl From<&GlobalRef> for ContextWrapper
impl From<&GlobalRef> for ContextWrapper
source§impl Into<GlobalRef> for &ContextWrapper
impl Into<GlobalRef> for &ContextWrapper
source§impl JObjNew for ContextWrapper
impl JObjNew for ContextWrapper
source§impl JType for ContextWrapper
impl JType for ContextWrapper
Auto Trait Implementations§
impl Freeze for ContextWrapper
impl RefUnwindSafe for ContextWrapper
impl Send for ContextWrapper
impl Sync for ContextWrapper
impl Unpin for ContextWrapper
impl UnwindSafe for ContextWrapper
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more