Remove deprecated APIs DPM.createUser, createAndInitializeUser
They were deprecated in M and slated for removal in N. Bug: 26974903 Change-Id: I7ae4d60bcf226c1e1de42852b378ad1ff71a914b
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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}.
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user