diff options
| -rw-r--r-- | api/current.txt | 2 | ||||
| -rw-r--r-- | api/removed.txt | 2 | ||||
| -rw-r--r-- | api/system-current.txt | 2 | ||||
| -rw-r--r-- | api/system-removed.txt | 9 | ||||
| -rw-r--r-- | api/test-current.txt | 2 | ||||
| -rw-r--r-- | api/test-removed.txt | 2 | ||||
| -rw-r--r-- | core/java/android/app/admin/DeviceAdminReceiver.java | 4 | ||||
| -rw-r--r-- | core/java/android/app/admin/DevicePolicyManager.java | 13 | ||||
| -rw-r--r-- | core/java/android/app/admin/IDevicePolicyManager.aidl | 2 | ||||
| -rw-r--r-- | docs/html/preview/behavior-changes.jd | 2 | ||||
| -rw-r--r-- | services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java | 51 |
11 files changed, 18 insertions, 73 deletions
diff --git a/api/current.txt b/api/current.txt index abc9e9a2b163..931726b5ed08 100644 --- a/api/current.txt +++ b/api/current.txt @@ -5829,9 +5829,7 @@ package android.app.admin { method public void clearPackagePersistentPreferredActivities(android.content.ComponentName, java.lang.String); method public void clearProfileOwner(android.content.ComponentName); method public void clearUserRestriction(android.content.ComponentName, java.lang.String); - method public deprecated android.os.UserHandle createAndInitializeUser(android.content.ComponentName, java.lang.String, java.lang.String, android.content.ComponentName, android.os.Bundle); method public android.os.UserHandle createAndManageUser(android.content.ComponentName, java.lang.String, android.content.ComponentName, android.os.PersistableBundle, int); - method public deprecated android.os.UserHandle createUser(android.content.ComponentName, java.lang.String); method public void enableSystemApp(android.content.ComponentName, java.lang.String); method public int enableSystemApp(android.content.ComponentName, android.content.Intent); method public java.lang.String[] getAccountTypesWithManagementDisabled(); diff --git a/api/removed.txt b/api/removed.txt index 0bf659438340..c758fb079448 100644 --- a/api/removed.txt +++ b/api/removed.txt @@ -9,6 +9,8 @@ package android.app { package android.app.admin { public class DevicePolicyManager { + method public deprecated android.os.UserHandle createAndInitializeUser(android.content.ComponentName, java.lang.String, java.lang.String, android.content.ComponentName, android.os.Bundle); + method public deprecated android.os.UserHandle createUser(android.content.ComponentName, java.lang.String); method public deprecated java.lang.String getDeviceInitializerApp(); method public deprecated android.content.ComponentName getDeviceInitializerComponent(); } diff --git a/api/system-current.txt b/api/system-current.txt index b36d7e89cb8d..ec42ef2d0b81 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -5966,9 +5966,7 @@ package android.app.admin { method public void clearPackagePersistentPreferredActivities(android.content.ComponentName, java.lang.String); method public void clearProfileOwner(android.content.ComponentName); method public void clearUserRestriction(android.content.ComponentName, java.lang.String); - method public deprecated android.os.UserHandle createAndInitializeUser(android.content.ComponentName, java.lang.String, java.lang.String, android.content.ComponentName, android.os.Bundle); method public android.os.UserHandle createAndManageUser(android.content.ComponentName, java.lang.String, android.content.ComponentName, android.os.PersistableBundle, int); - method public deprecated android.os.UserHandle createUser(android.content.ComponentName, java.lang.String); method public void enableSystemApp(android.content.ComponentName, java.lang.String); method public int enableSystemApp(android.content.ComponentName, android.content.Intent); method public java.lang.String[] getAccountTypesWithManagementDisabled(); diff --git a/api/system-removed.txt b/api/system-removed.txt index 27de91312fae..49b816ecafa9 100644 --- a/api/system-removed.txt +++ b/api/system-removed.txt @@ -6,6 +6,15 @@ package android.app { } +package android.app.admin { + + public class DevicePolicyManager { + method public deprecated android.os.UserHandle createAndInitializeUser(android.content.ComponentName, java.lang.String, java.lang.String, android.content.ComponentName, android.os.Bundle); + method public deprecated android.os.UserHandle createUser(android.content.ComponentName, java.lang.String); + } + +} + package android.content.pm { public class PackageInfo implements android.os.Parcelable { diff --git a/api/test-current.txt b/api/test-current.txt index 3878fbf25e31..13e6cab38768 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -5831,9 +5831,7 @@ package android.app.admin { method public void clearPackagePersistentPreferredActivities(android.content.ComponentName, java.lang.String); method public void clearProfileOwner(android.content.ComponentName); method public void clearUserRestriction(android.content.ComponentName, java.lang.String); - method public deprecated android.os.UserHandle createAndInitializeUser(android.content.ComponentName, java.lang.String, java.lang.String, android.content.ComponentName, android.os.Bundle); method public android.os.UserHandle createAndManageUser(android.content.ComponentName, java.lang.String, android.content.ComponentName, android.os.PersistableBundle, int); - method public deprecated android.os.UserHandle createUser(android.content.ComponentName, java.lang.String); method public void enableSystemApp(android.content.ComponentName, java.lang.String); method public int enableSystemApp(android.content.ComponentName, android.content.Intent); method public java.lang.String[] getAccountTypesWithManagementDisabled(); diff --git a/api/test-removed.txt b/api/test-removed.txt index 0bf659438340..c758fb079448 100644 --- a/api/test-removed.txt +++ b/api/test-removed.txt @@ -9,6 +9,8 @@ package android.app { package android.app.admin { public class DevicePolicyManager { + method public deprecated android.os.UserHandle createAndInitializeUser(android.content.ComponentName, java.lang.String, java.lang.String, android.content.ComponentName, android.os.Bundle); + method public deprecated android.os.UserHandle createUser(android.content.ComponentName, java.lang.String); method public deprecated java.lang.String getDeviceInitializerApp(); method public deprecated android.content.ComponentName getDeviceInitializerComponent(); } diff --git a/core/java/android/app/admin/DeviceAdminReceiver.java b/core/java/android/app/admin/DeviceAdminReceiver.java index d5ca0e94e2d3..a34e8551ed4b 100644 --- a/core/java/android/app/admin/DeviceAdminReceiver.java +++ b/core/java/android/app/admin/DeviceAdminReceiver.java @@ -383,8 +383,8 @@ public class DeviceAdminReceiver extends BroadcastReceiver { * * <p> If the admin is activated by a device owner, then the intent * may contain private extras that are relevant to user setup. - * {@see DevicePolicyManager#createAndInitializeUser(ComponentName, String, String, - * ComponentName, Intent)} + * {@see DevicePolicyManager#createAndManageUser(ComponentName, String, ComponentName, + * PersistableBundle, int)} * * @param context The running context as per {@link #onReceive}. * @param intent The received intent as per {@link #onReceive}. diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index ae63a2f0704d..83941c92c52d 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -4536,14 +4536,10 @@ public class DevicePolicyManager { * user could not be created. * * @deprecated From {@link android.os.Build.VERSION_CODES#M} + * @removed From {@link android.os.Build.VERSION_CODES#N} */ @Deprecated public UserHandle createUser(@NonNull ComponentName admin, String name) { - try { - return mService.createUser(admin, name); - } catch (RemoteException re) { - Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, re); - } return null; } @@ -4573,16 +4569,11 @@ public class DevicePolicyManager { * user could not be created. * * @deprecated From {@link android.os.Build.VERSION_CODES#M} + * @removed From {@link android.os.Build.VERSION_CODES#N} */ @Deprecated public UserHandle createAndInitializeUser(@NonNull ComponentName admin, String name, String ownerName, @NonNull ComponentName profileOwnerComponent, Bundle adminExtras) { - try { - return mService.createAndInitializeUser(admin, name, ownerName, profileOwnerComponent, - adminExtras); - } catch (RemoteException re) { - Log.w(TAG, REMOTE_EXCEPTION_MESSAGE, re); - } return null; } diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl index e9af8727012a..e78c0ac9714f 100644 --- a/core/java/android/app/admin/IDevicePolicyManager.aidl +++ b/core/java/android/app/admin/IDevicePolicyManager.aidl @@ -185,8 +185,6 @@ interface IDevicePolicyManager { 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); UserHandle createAndManageUser(in ComponentName who, in String name, in ComponentName profileOwner, in PersistableBundle adminExtras, in int flags); boolean removeUser(in ComponentName who, in UserHandle userHandle); boolean switchUser(in ComponentName who, in UserHandle userHandle); diff --git a/docs/html/preview/behavior-changes.jd b/docs/html/preview/behavior-changes.jd index cab416341685..264e7410be07 100644 --- a/docs/html/preview/behavior-changes.jd +++ b/docs/html/preview/behavior-changes.jd @@ -393,7 +393,7 @@ affect camera apps running on the primary user.</li> only affects notifications generated by applications in the managed profile.</li> </ul> </li> - <li>The {@link android.app.admin.DevicePolicyManager#createAndInitializeUser(android.content.ComponentName, java.lang.String, java.lang.String, android.content.ComponentName, android.os.Bundle) createAndInitializeUser()} and {@link android.app.admin.DevicePolicyManager#createUser(android.content.ComponentName, java.lang.String) createUser()} methods have been deprecated.</li> + <li>The {@link android.app.admin.DevicePolicyManager#createAndManageUser(android.content.ComponentName, java.lang.String, android.content.ComponentName, android.os.PersistableBundle, int) createAndManageUser()} method replaces createAndInitializeUser(), which has been removed.</li> <li>The {@link android.app.admin.DevicePolicyManager#setScreenCaptureDisabled(android.content.ComponentName, boolean) setScreenCaptureDisabled()} method now also blocks the assist structure when an app of the given user is in the foreground. </li> <li>{@link android.app.admin.DevicePolicyManager#EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM} diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 33225eba9565..725f6bfb512f 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -6743,57 +6743,6 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } } - @Override - public UserHandle createUser(ComponentName who, String name) { - Preconditions.checkNotNull(who, "ComponentName is null"); - synchronized (this) { - getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_POLICY_DEVICE_OWNER); - - long id = mInjector.binderClearCallingIdentity(); - try { - UserInfo userInfo = mUserManager.createUser(name, 0 /* flags */); - if (userInfo != null) { - return userInfo.getUserHandle(); - } - return null; - } finally { - mInjector.binderRestoreCallingIdentity(id); - } - } - } - - @Override - public UserHandle createAndInitializeUser(ComponentName who, String name, - String ownerName, ComponentName profileOwnerComponent, Bundle adminExtras) { - UserHandle user = createUser(who, name); - if (user == null) { - return null; - } - long id = mInjector.binderClearCallingIdentity(); - try { - String profileOwnerPkg = profileOwnerComponent.getPackageName(); - - final int userHandle = user.getIdentifier(); - try { - // Install the profile owner if not present. - if (!mIPackageManager.isPackageAvailable(profileOwnerPkg, userHandle)) { - mIPackageManager.installExistingPackageAsUser(profileOwnerPkg, userHandle); - } - - // Start user in background. - mInjector.getIActivityManager().startUserInBackground(userHandle); - } catch (RemoteException e) { - Slog.e(LOG_TAG, "Failed to make remote calls for configureUser", e); - } - - setActiveAdmin(profileOwnerComponent, true, userHandle, adminExtras); - setProfileOwner(profileOwnerComponent, ownerName, userHandle); - return user; - } finally { - mInjector.binderRestoreCallingIdentity(id); - } - } - private void sendAdminEnabledBroadcastLocked(int userHandle) { DevicePolicyData policyData = getUserData(userHandle); if (policyData.mAdminBroadcastPending) { |