The last one tells you how to create a user
Android 5.0 Create multi-user open multi-open applications (1)
Why create a user such as Window system creates a user that operates under the current user, and the Android multiuser system is like a window system
After you create a user and then operate under the current user, you can install or launch an app.
With a user after creating a workspace under this user, install the boot apk in the workspace to double-open.
Specific class operations:
Package android.app.admin; Import Android.content.ComponentName; Import android.content.Intent; Import Android.content.IntentFilter; Import Android.net.ProxyInfo; Import Android.os.Bundle; Import Android.os.PersistableBundle; Import Android.os.RemoteCallback; Import Android.os.UserHandle; Import java.util.List; /** * Internal IPC interface to the device policy service. * {@hide} */interface Idevicepolicymanager {void setpasswordquality (in componentname, int quality , int userhandle); int getpasswordquality (in componentname, int userhandle); void Setpasswordminimumlength (in componentname who, int length, int userhandle); int Getpasswordminimumlength (in componentname, int userhandle); void Setpasswordminimumuppercase (in componentname who, int length, int userhandle); int Getpasswordminimumuppercase (in componentname, int uSerhandle); void Setpasswordminimumlowercase (in componentname who, int length, int userhandle); int Getpasswordminimumlowercase (in componentname, int userhandle); void Setpasswordminimumletters (in componentname who, int length, int userhandle); int Getpasswordminimumletters (in componentname, int userhandle); void Setpasswordminimumnumeric (in componentname who, int length, int userhandle); int Getpasswordminimumnumeric (in componentname, int userhandle); void Setpasswordminimumsymbols (in componentname who, int length, int userhandle); int Getpasswordminimumsymbols (in componentname, int userhandle); void Setpasswordminimumnonletter (in componentname who, int length, int userhandle); int Getpasswordminimumnonletter (in componentname, int userhandle); void Setpasswordhistorylength (in componentname who, int length, int userhandle);int Getpasswordhistorylength (in componentname, int userhandle); void Setpasswordexpirationtimeout (in componentname, long expiration, int userhandle); Long Getpasswordexpirationtimeout (in componentname, int userhandle); Long Getpasswordexpiration (in componentname, int userhandle); Boolean isactivepasswordsufficient (int userhandle); int getcurrentfailedpasswordattempts (int userhandle); int getprofilewithminimumfailedpasswordsforwipe (int userhandle); void Setmaximumfailedpasswordsforwipe (in componentname admin, int num, int userhandle); int Getmaximumfailedpasswordsforwipe (in componentname admin, int userhandle); Boolean ResetPassword (String password, int flags, int userhandle); void Setmaximumtimetolock (in componentname, long timems, int userhandle); Long Getmaximumtimetolock (in componentname, int userhandle); void LOcknow (); void Wipedata (int flags, int userhandle); ComponentName setglobalproxy (in ComponentName Admin, String Proxyspec, string exclusionlist, int userhandle); ComponentName getglobalproxyadmin (int userhandle); void Setrecommendedglobalproxy (in ComponentName admin, in Proxyinfo proxyinfo); int Setstorageencryption (in ComponentName, boolean encrypt, int userhandle); Boolean getstorageencryption (in componentname, int userhandle); int getstorageencryptionstatus (int userhandle); void Setcameradisabled (in ComponentName, boolean disabled, int userhandle); Boolean getcameradisabled (in componentname, int userhandle); void Setscreencapturedisabled (in componentname, int userhandle, boolean disabled); Boolean getscreencapturedisabled (in componentname, int userhandle); void Setkeyguarddisabledfeatures (in componentname, int whiCH, int userhandle); int Getkeyguarddisabledfeatures (in componentname, int userhandle); void Setactiveadmin (In ComponentName policyreceiver, boolean refreshing, int userhandle); Boolean isadminactive (in componentname policyreceiver, int userhandle); list<componentname> getactiveadmins (int userhandle); Boolean packagehasactiveadmins (String packagename, int userhandle); void Getremovewarning (in ComponentName policyreceiver, in remotecallback result, int userhandle); void Removeactiveadmin (in componentname policyreceiver, int userhandle); Boolean Hasgrantedpolicy (in componentname policyreceiver, int usespolicy, int userhandle); void setactivepasswordstate (int quality, int length, int letters, int uppercase, int lowercase, int numbers, int symbols, int nonletter, int userhandle); void reportfailedpasswordattempt (int userhandle); void ReportsuccessfulpasswordAttempt (int userhandle); Boolean Setdeviceowner (String PackageName, string ownername); Boolean Isdeviceowner (String packagename); String Getdeviceowner (); String Getdeviceownername (); void Cleardeviceowner (String packagename); Boolean Setprofileowner (in ComponentName, String ownername, int userhandle); ComponentName getprofileowner (int userhandle); String getprofileownername (int userhandle); void setprofileenabled (in componentname);//Start workspace void Setprofilename (in componentname, String profiles Name) void Clearprofileowner (in componentname); Boolean hasusersetupcompleted (); Boolean Installcacert (in ComponentName admin, in byte[] certbuffer); void Uninstallcacert (in ComponentName admin, in String alias); void Enforcecanmanagecacerts (in componentname admin); Boolean Installkeypair (in ComponentName, in byte[] privkeybuffer, in byte[] Certbuffer, String alias); void Addpersistentpreferredactivity (in ComponentName admin, in intentfilter filter, in componentname activity); void Clearpackagepersistentpreferredactivities (in ComponentName admin, String PackageName); void Setapplicationrestrictions (in ComponentName, in String PackageName, in Bundle settings); Bundle getapplicationrestrictions (in ComponentName, in String PackageName); void Setrestrictionsprovider (in ComponentName, in componentname provider); ComponentName getrestrictionsprovider (int userhandle); void Setuserrestriction (in ComponentName, the in String key, Boolean enable); void Addcrossprofileintentfilter (in ComponentName admin, in intentfilter filter, int flags);//create workspace void C Learcrossprofileintentfilters (in ComponentName admin); Boolean setpermittedaccessibilityservices (in ComponEntname admin,in List packagelist); List getpermittedaccessibilityservices (in ComponentName admin); List getpermittedaccessibilityservicesforuser (int userId); Boolean setpermittedinputmethods (in ComponentName admin,in List packagelist); List getpermittedinputmethods (in ComponentName admin); List Getpermittedinputmethodsforcurrentuser (); Boolean Setapplicationhidden (in ComponentName admin, in String PackageName, Boolean hidden); Boolean Isapplicationhidden (in ComponentName admin, in String packagename); Userhandle CreateUser (in ComponentName, in String name); Userhandle Createandinitializeuser (in ComponentName, in string name, in string Profileownername, in ComponentName Prof Ileownercomponent, in Bundle Adminextras); Boolean Removeuser (in ComponentName, Userhandle userhandle); Boolean Switchuser (in ComponentName, Userhandle userhandle); void Enablesystemapp (in ComponentName admin, in String packagename);//Set the app's status int enablesystemappwithintent (in ComponentName admin, in Intent Intent); void Setaccountmanagementdisabled (in ComponentName, in String AccountType, in Boolean disabled); String[] getaccounttypeswithmanagementdisabled (); String[] Getaccounttypeswithmanagementdisabledasuser (int userId); void Setlocktaskpackages (in ComponentName, in string[] packages); String[] Getlocktaskpackages (in componentname); Boolean islocktaskpermitted (in String pkg); void Setglobalsetting (in ComponentName, in string setting, in string value); void Setsecuresetting (in ComponentName, in string setting, in string value); void setmastervolumemuted (in ComponentName Admin, Boolean on); Boolean ismastervolumemuted (in ComponentName admin); void Notifylocktaskmodechanged (Boolean IsenaBled, String pkg, int userId); void setuninstallblocked (in ComponentName admin, in String PackageName, Boolean uninstallblocked); Boolean isuninstallblocked (in ComponentName admin, in String packagename); void Setcrossprofilecalleriddisabled (in ComponentName, Boolean disabled); Boolean getcrossprofilecalleriddisabled (in componentname); Boolean getcrossprofilecalleriddisabledforuser (int userId); void Settrustagentconfiguration (in ComponentName admin, in ComponentName agent, in Persistablebundle args , int userId); List<persistablebundle> gettrustagentconfiguration (in ComponentName admin, in ComponentName agent, int userId); Boolean Addcrossprofilewidgetprovider (in ComponentName admin, String PackageName); Boolean Removecrossprofilewidgetprovider (in ComponentName admin, String PackageName); List<string> GetcrossprofilewidgeTproviders (in ComponentName admin); void Setautotimerequired (in componentname, int userhandle, boolean required); Boolean getautotimerequired (); Boolean isremovingadmin (in componentname adminreceiver, int userhandle); }
Android 5.0 Create multi-user open multi-open applications (2)