Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> Android開發 >> 關於android開發 >> android 5.0 創建多用戶 雙開多開應用(2),android5.0

android 5.0 創建多用戶 雙開多開應用(2),android5.0

編輯:關於android開發

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);  
    }  

 

  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved