編輯:關於android開發
上一講 講了如何創建一個user
為什麼要創建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); }
Android應用坐標系統全面詳解 1 背景 去年有很多人私信告訴我讓說說自定義控件,其實通觀網絡上的很多博客都在講各種自定義控件,但是大多數都是授之以魚,卻很少有較為
簡單回調機制的基本建立,簡單回調機制建立簡單回調機制的建立主要分為下面幾步: 1.寫一個回調類,寫出需要的構造方法 2.定義一個接口,裡面寫一個抽象方法,方法體(Stri
Android的Kotlin秘方(I):OnGlobalLayoutListener,春節後,又重新“開張”。各位高手請繼續支持。謝謝! &nbs
Android Developer:Heap Viewer演示 這個演示展示了Heap Viewer工具的基本用法。Heap Viewer實時報告你的應用程序已經分配了