共用方式為


DevicePolicyManager.SetPermittedInputMethods Method

Definition

Called by a profile or device owner or holder of the android.Manifest.permission#MANAGE_DEVICE_POLICY_INPUT_METHODS permission to set the permitted input methods services for this user.

[Android.Runtime.Register("setPermittedInputMethods", "(Landroid/content/ComponentName;Ljava/util/List;)Z", "GetSetPermittedInputMethods_Landroid_content_ComponentName_Ljava_util_List_Handler")]
[Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_INPUT_METHODS")]
public virtual bool SetPermittedInputMethods (Android.Content.ComponentName? admin, System.Collections.Generic.IList<string>? packageNames);
[<Android.Runtime.Register("setPermittedInputMethods", "(Landroid/content/ComponentName;Ljava/util/List;)Z", "GetSetPermittedInputMethods_Landroid_content_ComponentName_Ljava_util_List_Handler")>]
[<Android.Runtime.RequiresPermission("android.permission.MANAGE_DEVICE_POLICY_INPUT_METHODS")>]
abstract member SetPermittedInputMethods : Android.Content.ComponentName * System.Collections.Generic.IList<string> -> bool
override this.SetPermittedInputMethods : Android.Content.ComponentName * System.Collections.Generic.IList<string> -> bool

Parameters

admin
ComponentName

Which DeviceAdminReceiver this request is associated with. Null if the caller is not a device admin

packageNames
IList<String>

List of input method package names.

Returns

true if the operation succeeded, or false if the list didn't contain every enabled non-system input method service.

Attributes

Remarks

Called by a profile or device owner or holder of the android.Manifest.permission#MANAGE_DEVICE_POLICY_INPUT_METHODS permission to set the permitted input methods services for this user. By default, the user can use any input method.

This method can be called on the DevicePolicyManager instance, returned by #getParentProfileInstance(ComponentName), where the caller must be a profile owner of an organization-owned device.

If called on the parent instance: <ul> <li>The permitted input methods will be applied on the personal profile</li> <li>Can only permit all input methods (calling this method with a null package list) or only permit system input methods (calling this method with an empty package list). This is to prevent the caller from learning which packages are installed on the personal side</li> </ul>

When zero or more packages have been added, input method that are not in the list and not part of the system can not be enabled by the user. This method will fail if it is called for a admin that is not for the foreground user or a profile of the foreground user. Any non-system input method service that's currently enabled must be included in the list.

Calling with a null value for the list disables the restriction so that all input methods can be used, calling with an empty list disables all but the system's own input methods.

System input methods are always available to the user - this method can't modify this.

Java documentation for android.app.admin.DevicePolicyManager.setPermittedInputMethods(android.content.ComponentName, java.util.List<java.lang.String>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to