android 5.0 建立多使用者 雙開多開應用(2),android5.0

來源:互聯網
上載者:User

android 5.0 建立多使用者 雙開多開應用(2),android5.0

上一講 講了如何建立一個user

android 5.0 建立多使用者 雙開多開應用(1)


為什麼要建立User  例如window 系統建立了一個user 會在目前使用者下進行操作,而android 多使用者體系就像window系統

建立了一個user之後在當前user下進行操作,就可以再安裝或者啟動一個應用。

有了一個user 之後在這個user下建立一個工作空間,在工作空間下安裝 啟動apk 就可以雙開了。

具體類操作:

    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 who, int quality, int userHandle);          int getPasswordQuality(in ComponentName who, int userHandle);                void setPasswordMinimumLength(in ComponentName who, int length, int userHandle);          int getPasswordMinimumLength(in ComponentName who, int userHandle);                void setPasswordMinimumUpperCase(in ComponentName who, int length, int userHandle);          int getPasswordMinimumUpperCase(in ComponentName who, int userHandle);                void setPasswordMinimumLowerCase(in ComponentName who, int length, int userHandle);          int getPasswordMinimumLowerCase(in ComponentName who, int userHandle);                void setPasswordMinimumLetters(in ComponentName who, int length, int userHandle);          int getPasswordMinimumLetters(in ComponentName who, int userHandle);                void setPasswordMinimumNumeric(in ComponentName who, int length, int userHandle);          int getPasswordMinimumNumeric(in ComponentName who, int userHandle);                void setPasswordMinimumSymbols(in ComponentName who, int length, int userHandle);          int getPasswordMinimumSymbols(in ComponentName who, int userHandle);                void setPasswordMinimumNonLetter(in ComponentName who, int length, int userHandle);          int getPasswordMinimumNonLetter(in ComponentName who, int userHandle);                void setPasswordHistoryLength(in ComponentName who, int length, int userHandle);          int getPasswordHistoryLength(in ComponentName who, int userHandle);                void setPasswordExpirationTimeout(in ComponentName who, long expiration, int userHandle);          long getPasswordExpirationTimeout(in ComponentName who, int userHandle);                long getPasswordExpiration(in ComponentName who, 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 who, long timeMs, int userHandle);          long getMaximumTimeToLock(in ComponentName who, 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 who, boolean encrypt, int userHandle);          boolean getStorageEncryption(in ComponentName who, int userHandle);          int getStorageEncryptionStatus(int userHandle);                void setCameraDisabled(in ComponentName who, boolean disabled, int userHandle);          boolean getCameraDisabled(in ComponentName who, int userHandle);                void setScreenCaptureDisabled(in ComponentName who, int userHandle, boolean disabled);          boolean getScreenCaptureDisabled(in ComponentName who, int userHandle);                void setKeyguardDisabledFeatures(in ComponentName who, int which, int userHandle);          int getKeyguardDisabledFeatures(in ComponentName who, 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 who, String ownerName, int userHandle);          ComponentName getProfileOwner(int userHandle);          String getProfileOwnerName(int userHandle);             void setProfileEnabled(in ComponentName who);//啟動工作空間             void setProfileName(in ComponentName who, String profileName)          void clearProfileOwner(in ComponentName who);             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 who, 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 who, in String packageName, in Bundle settings);          Bundle getApplicationRestrictions(in ComponentName who, in String packageName);                void setRestrictionsProvider(in ComponentName who, in ComponentName provider);          ComponentName getRestrictionsProvider(int userHandle);                void setUserRestriction(in ComponentName who, in String key, boolean enable);             void addCrossProfileIntentFilter(in ComponentName admin, in IntentFilter filter, int flags);//建立工作空間                void clearCrossProfileIntentFilters(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 who, in String name);          UserHandle createAndInitializeUser(in ComponentName who, in String name, in String profileOwnerName, in ComponentName profileOwnerComponent, in Bundle adminExtras);          boolean removeUser(in ComponentName who, in UserHandle userHandle);          boolean switchUser(in ComponentName who, in UserHandle userHandle);                void enableSystemApp(in ComponentName admin, in String packageName);//設定app的狀態             int enableSystemAppWithIntent(in ComponentName admin, in Intent intent);                void setAccountManagementDisabled(in ComponentName who, in String accountType, in boolean disabled);          String[] getAccountTypesWithManagementDisabled();          String[] getAccountTypesWithManagementDisabledAsUser(int userId);                void setLockTaskPackages(in ComponentName who, in String[] packages);          String[] getLockTaskPackages(in ComponentName who);          boolean isLockTaskPermitted(in String pkg);                void setGlobalSetting(in ComponentName who, in String setting, in String value);          void setSecureSetting(in ComponentName who, 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 who, boolean disabled);          boolean getCrossProfileCallerIdDisabled(in ComponentName who);          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 who, int userHandle, boolean required);          boolean getAutoTimeRequired();                boolean isRemovingAdmin(in ComponentName adminReceiver, int userHandle);      }  

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.