Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4ad50e75 authored by Kholoud Mohamed's avatar Kholoud Mohamed
Browse files

Add new provisionManagedDevice API in DPM

Added a new SystemAPI to provision a DO,
this will be called by Managed Provisioning
and CTS tests.

Test: atest android.devicepolicy.cts.DevicePolicyManagerTest
Test: atest com.android.server.devicepolicy.DevicePolicyManagerTest
Bug: 175392542
Change-Id: Id96defe57277495f96d435886d95c946f6c46691
parent 91464139
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
@@ -377,6 +377,7 @@ package android.app {
package android.app.admin {

  public class DevicePolicyManager {
    method public int checkProvisioningPreCondition(@Nullable String, @NonNull String);
    method @Nullable public android.os.UserHandle createAndProvisionManagedProfile(@NonNull android.app.admin.ManagedProfileProvisioningParams) throws android.app.admin.ProvisioningException;
    method public void forceUpdateUserSetupComplete();
    method public long getLastBugReportRequestTime();
@@ -386,9 +387,27 @@ package android.app.admin {
    method public boolean isCurrentInputMethodSetByOwner();
    method public boolean isFactoryResetProtectionPolicySupported();
    method @NonNull public static String operationToString(int);
    method @RequiresPermission("android.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS") public void provisionFullyManagedDevice(@NonNull android.app.admin.FullyManagedDeviceProvisioningParams) throws android.app.admin.ProvisioningException;
    method @RequiresPermission("android.permission.MANAGE_DEVICE_ADMINS") public void setNextOperationSafety(int, boolean);
    field public static final String ACTION_DATA_SHARING_RESTRICTION_APPLIED = "android.app.action.DATA_SHARING_RESTRICTION_APPLIED";
    field public static final String ACTION_MANAGED_PROFILE_CREATED = "android.app.action.MANAGED_PROFILE_CREATED";
    field public static final String ACTION_PROVISIONED_MANAGED_DEVICE = "android.app.action.PROVISIONED_MANAGED_DEVICE";
    field public static final int CODE_ACCOUNTS_NOT_EMPTY = 6; // 0x6
    field public static final int CODE_CANNOT_ADD_MANAGED_PROFILE = 11; // 0xb
    field public static final int CODE_DEVICE_ADMIN_NOT_SUPPORTED = 13; // 0xd
    field public static final int CODE_HAS_DEVICE_OWNER = 1; // 0x1
    field public static final int CODE_HAS_PAIRED = 8; // 0x8
    field public static final int CODE_MANAGED_USERS_NOT_SUPPORTED = 9; // 0x9
    field public static final int CODE_NONSYSTEM_USER_EXISTS = 5; // 0x5
    field public static final int CODE_NOT_SYSTEM_USER = 7; // 0x7
    field public static final int CODE_NOT_SYSTEM_USER_SPLIT = 12; // 0xc
    field public static final int CODE_OK = 0; // 0x0
    field public static final int CODE_PROVISIONING_NOT_ALLOWED_FOR_NON_DEVELOPER_USERS = 15; // 0xf
    field public static final int CODE_SPLIT_SYSTEM_USER_DEVICE_SYSTEM_USER = 14; // 0xe
    field public static final int CODE_SYSTEM_USER = 10; // 0xa
    field public static final int CODE_USER_HAS_PROFILE_OWNER = 2; // 0x2
    field public static final int CODE_USER_NOT_RUNNING = 3; // 0x3
    field public static final int CODE_USER_SETUP_COMPLETED = 4; // 0x4
    field public static final int OPERATION_CLEAR_APPLICATION_USER_DATA = 23; // 0x17
    field public static final int OPERATION_CREATE_AND_MANAGE_USER = 5; // 0x5
    field public static final int OPERATION_INSTALL_CA_CERT = 24; // 0x18
@@ -432,10 +451,33 @@ package android.app.admin {
    field public static final int PROVISIONING_RESULT_ADMIN_PACKAGE_INSTALLATION_FAILED = 3; // 0x3
    field public static final int PROVISIONING_RESULT_PRE_CONDITION_FAILED = 1; // 0x1
    field public static final int PROVISIONING_RESULT_PROFILE_CREATION_FAILED = 2; // 0x2
    field public static final int PROVISIONING_RESULT_REMOVE_NON_REQUIRED_APPS_FAILED = 6; // 0x6
    field public static final int PROVISIONING_RESULT_SETTING_PROFILE_OWNER_FAILED = 4; // 0x4
    field public static final int PROVISIONING_RESULT_SET_DEVICE_OWNER_FAILED = 7; // 0x7
    field public static final int PROVISIONING_RESULT_STARTING_PROFILE_FAILED = 5; // 0x5
  }

  public final class FullyManagedDeviceProvisioningParams implements android.os.Parcelable {
    method public int describeContents();
    method @NonNull public android.content.ComponentName getDeviceAdminComponentName();
    method public long getLocalTime();
    method @Nullable public java.util.Locale getLocale();
    method @NonNull public String getOwnerName();
    method @Nullable public String getTimeZone();
    method public boolean isLeaveAllSystemAppsEnabled();
    method public void writeToParcel(@NonNull android.os.Parcel, @Nullable int);
    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.FullyManagedDeviceProvisioningParams> CREATOR;
  }

  public static final class FullyManagedDeviceProvisioningParams.Builder {
    ctor public FullyManagedDeviceProvisioningParams.Builder(@NonNull android.content.ComponentName, @NonNull String);
    method @NonNull public android.app.admin.FullyManagedDeviceProvisioningParams build();
    method @NonNull public android.app.admin.FullyManagedDeviceProvisioningParams.Builder setLeaveAllSystemAppsEnabled(boolean);
    method @NonNull public android.app.admin.FullyManagedDeviceProvisioningParams.Builder setLocalTime(long);
    method @NonNull public android.app.admin.FullyManagedDeviceProvisioningParams.Builder setLocale(@Nullable java.util.Locale);
    method @NonNull public android.app.admin.FullyManagedDeviceProvisioningParams.Builder setTimeZone(@Nullable String);
  }

  public final class ManagedProfileProvisioningParams implements android.os.Parcelable {
    method public int describeContents();
    method @Nullable public android.accounts.Account getAccountToMigrate();
+99 −7
Original line number Diff line number Diff line
@@ -148,6 +148,7 @@ import java.util.concurrent.Executor;
 */
@SystemService(Context.DEVICE_POLICY_SERVICE)
@RequiresFeature(PackageManager.FEATURE_DEVICE_ADMIN)
@SuppressLint("UseIcu")
public class DevicePolicyManager {
    private static String TAG = "DevicePolicyManager";
@@ -1992,6 +1993,7 @@ public class DevicePolicyManager {
     *
     * @hide
     */
    @TestApi
    public static final int CODE_OK = 0;
    /**
@@ -2003,6 +2005,7 @@ public class DevicePolicyManager {
     *
     * @hide
     */
    @TestApi
    public static final int CODE_HAS_DEVICE_OWNER = 1;
    /**
@@ -2014,6 +2017,7 @@ public class DevicePolicyManager {
     *
     * @hide
     */
    @TestApi
    public static final int CODE_USER_HAS_PROFILE_OWNER = 2;
    /**
@@ -2024,6 +2028,7 @@ public class DevicePolicyManager {
     *
     * @hide
     */
    @TestApi
    public static final int CODE_USER_NOT_RUNNING = 3;
    /**
@@ -2035,6 +2040,7 @@ public class DevicePolicyManager {
     *
     * @hide
     */
    @TestApi
    public static final int CODE_USER_SETUP_COMPLETED = 4;
    /**
@@ -2042,6 +2048,7 @@ public class DevicePolicyManager {
     *
     * @hide
     */
    @TestApi
    public static final int CODE_NONSYSTEM_USER_EXISTS = 5;
    /**
@@ -2049,6 +2056,7 @@ public class DevicePolicyManager {
     *
     * @hide
     */
    @TestApi
    public static final int CODE_ACCOUNTS_NOT_EMPTY = 6;
    /**
@@ -2059,6 +2067,7 @@ public class DevicePolicyManager {
     *
     * @hide
     */
    @TestApi
    public static final int CODE_NOT_SYSTEM_USER = 7;
    /**
@@ -2070,6 +2079,7 @@ public class DevicePolicyManager {
     *
     * @hide
     */
    @TestApi
    public static final int CODE_HAS_PAIRED = 8;
    /**
@@ -2081,6 +2091,7 @@ public class DevicePolicyManager {
     * @see {@link PackageManager#FEATURE_MANAGED_USERS}
     * @hide
     */
    @TestApi
    public static final int CODE_MANAGED_USERS_NOT_SUPPORTED = 9;
    /**
@@ -2092,6 +2103,7 @@ public class DevicePolicyManager {
     *
     * @hide
     */
    @TestApi
    public static final int CODE_SYSTEM_USER = 10;
    /**
@@ -2102,6 +2114,7 @@ public class DevicePolicyManager {
     *
     * @hide
     */
    @TestApi
    public static final int CODE_CANNOT_ADD_MANAGED_PROFILE = 11;
    /**
@@ -2114,6 +2127,7 @@ public class DevicePolicyManager {
     *
     * @hide
     */
    @TestApi
    public static final int CODE_NOT_SYSTEM_USER_SPLIT = 12;
    /**
@@ -2121,11 +2135,12 @@ public class DevicePolicyManager {
     *
     * <p>Returned for {@link #ACTION_PROVISION_MANAGED_DEVICE},
     * {@link #ACTION_PROVISION_MANAGED_PROFILE}, {@link #ACTION_PROVISION_MANAGED_USER} and
     * {@link #ACTION_PROVISION_MANAGED_SHAREABLE_DEVICE} on devices which do no support device
     * {@link #ACTION_PROVISION_MANAGED_SHAREABLE_DEVICE} on devices which do not support device
     * admins.
     *
     * @hide
     */
    @TestApi
    public static final int CODE_DEVICE_ADMIN_NOT_SUPPORTED = 13;
    /**
@@ -2137,8 +2152,20 @@ public class DevicePolicyManager {
     *
     * @hide
     */
    @TestApi
    public static final int CODE_SPLIT_SYSTEM_USER_DEVICE_SYSTEM_USER = 14;
    /**
     * Result code for {@link #checkProvisioningPreCondition}.
     *
     * <p>Returned for {@link #ACTION_PROVISION_MANAGED_DEVICE} and
     * {@link #ACTION_PROVISION_MANAGED_PROFILE} on devices which do not support provisioning.
     *
     * @hide
     */
    @TestApi
    public static final int CODE_PROVISIONING_NOT_ALLOWED_FOR_NON_DEVELOPER_USERS = 15;
    /**
     * Result codes for {@link #checkProvisioningPreCondition} indicating all the provisioning pre
     * conditions.
@@ -2151,12 +2178,14 @@ public class DevicePolicyManager {
            CODE_USER_SETUP_COMPLETED, CODE_NOT_SYSTEM_USER, CODE_HAS_PAIRED,
            CODE_MANAGED_USERS_NOT_SUPPORTED, CODE_SYSTEM_USER, CODE_CANNOT_ADD_MANAGED_PROFILE,
            CODE_NOT_SYSTEM_USER_SPLIT, CODE_DEVICE_ADMIN_NOT_SUPPORTED,
            CODE_SPLIT_SYSTEM_USER_DEVICE_SYSTEM_USER
            CODE_SPLIT_SYSTEM_USER_DEVICE_SYSTEM_USER,
            CODE_PROVISIONING_NOT_ALLOWED_FOR_NON_DEVELOPER_USERS
    })
    public @interface ProvisioningPreCondition {}
    /**
     * Service-specific error code for {@link #createAndProvisionManagedProfile}:
     * Service-specific error code for {@link #provisionFullyManagedDevice} and
     * {@link #createAndProvisionManagedProfile}:
     * Indicates the call to {@link #checkProvisioningPreCondition} returned an error code.
     *
     * @hide
@@ -2202,8 +2231,26 @@ public class DevicePolicyManager {
    public static final int PROVISIONING_RESULT_STARTING_PROFILE_FAILED = 5;
    /**
     * Service-specific error codes for {@link #createAndProvisionManagedProfile} indicating
     * all the errors during provisioning.
     * Service-specific error code for {@link #provisionFullyManagedDevice}:
     * Indicates that removing the non required apps have failed.
     *
     * @hide
     */
    @TestApi
    public static final int PROVISIONING_RESULT_REMOVE_NON_REQUIRED_APPS_FAILED = 6;
    /**
     * Service-specific error code for {@link #provisionFullyManagedDevice}:
     * Indicates the call to {@link #setDeviceOwner} returned {@code false}.
     *
     * @hide
     */
    @TestApi
    public static final int PROVISIONING_RESULT_SET_DEVICE_OWNER_FAILED = 7;
    /**
     * Service-specific error codes for {@link #createAndProvisionManagedProfile} and
     * {@link #provisionFullyManagedDevice} indicating all the errors during provisioning.
     *
     * @hide
     */
@@ -2212,7 +2259,9 @@ public class DevicePolicyManager {
            PROVISIONING_RESULT_PRE_CONDITION_FAILED, PROVISIONING_RESULT_PROFILE_CREATION_FAILED,
            PROVISIONING_RESULT_ADMIN_PACKAGE_INSTALLATION_FAILED,
            PROVISIONING_RESULT_SETTING_PROFILE_OWNER_FAILED,
            PROVISIONING_RESULT_STARTING_PROFILE_FAILED
            PROVISIONING_RESULT_STARTING_PROFILE_FAILED,
            PROVISIONING_RESULT_REMOVE_NON_REQUIRED_APPS_FAILED,
            PROVISIONING_RESULT_SET_DEVICE_OWNER_FAILED
    })
    public @interface ProvisioningResult {}
@@ -5443,6 +5492,16 @@ public class DevicePolicyManager {
    public static final String ACTION_SHOW_NEW_USER_DISCLAIMER =
            "android.app.action.ACTION_SHOW_NEW_USER_DISCLAIMER";
    /**
     * Broadcast action: notify managed provisioning that the device has been provisioned.
     *
     * @hide
     */
    @TestApi
    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
    public static final String ACTION_PROVISIONED_MANAGED_DEVICE =
            "android.app.action.PROVISIONED_MANAGED_DEVICE";
    /**
     * Broadcast action: notify managed provisioning that a new managed profile is created.
     *
@@ -10669,8 +10728,9 @@ public class DevicePolicyManager {
     * @return A {@link ProvisioningPreCondition} value indicating whether provisioning is allowed.
     * @hide
     */
    @TestApi
    public @ProvisioningPreCondition int checkProvisioningPreCondition(
            String action, @NonNull String packageName) {
            @Nullable String action, @NonNull String packageName) {
        try {
            return mService.checkProvisioningPreCondition(action, packageName);
        } catch (RemoteException re) {
@@ -13206,4 +13266,36 @@ public class DevicePolicyManager {
            throw e.rethrowFromSystemServer();
        }
    }
    /**
     * Provisions a managed device and sets the {@code deviceAdminComponentName} as the device
     * owner.
     *
     * <p>The method {@link #checkProvisioningPreCondition} must be returning {@link #CODE_OK}
     * before calling this method.
     *
     * @param provisioningParams Params required to provision a fully managed device,
     * see {@link FullyManagedDeviceProvisioningParams}.
     *
     * @throws SecurityException if the caller does not hold
     * {@link android.Manifest.permission#MANAGE_PROFILE_AND_DEVICE_OWNERS}.
     * @throws ProvisioningException if an error occurred during provisioning.
     *
     * @hide
     */
    @TestApi
    @RequiresPermission(android.Manifest.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS)
    public void provisionFullyManagedDevice(
            @NonNull FullyManagedDeviceProvisioningParams provisioningParams)
            throws ProvisioningException {
        if (mService != null) {
            try {
                mService.provisionFullyManagedDevice(provisioningParams);
            } catch (ServiceSpecificException e) {
                throw new ProvisioningException(e, e.errorCode);
            } catch (RemoteException re) {
                throw re.rethrowFromSystemServer();
            }
        }
    }
}
+19 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.app.admin;

parcelable FullyManagedDeviceProvisioningParams;
+253 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.app.admin;

import static java.util.Objects.requireNonNull;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.annotation.SuppressLint;
import android.annotation.TestApi;
import android.content.ComponentName;
import android.os.Parcel;
import android.os.Parcelable;

import java.util.Locale;

/**
 * Params required to provision a fully managed device, see
 * {@link DevicePolicyManager#provisionFullyManagedDevice}.
 * @hide
 */
@TestApi
public final class FullyManagedDeviceProvisioningParams implements Parcelable {
    @NonNull private final ComponentName mDeviceAdminComponentName;
    @NonNull private final String mOwnerName;
    private final boolean mLeaveAllSystemAppsEnabled;
    @Nullable private final String mTimeZone;
    private final long mLocalTime;
    @SuppressLint("UseIcu")
    @Nullable private final Locale mLocale;

    private FullyManagedDeviceProvisioningParams(
            @NonNull ComponentName deviceAdminComponentName,
            @NonNull String ownerName,
            boolean leaveAllSystemAppsEnabled,
            @Nullable String timeZone,
            long localTime,
            @Nullable @SuppressLint("UseIcu") Locale locale) {
        this.mDeviceAdminComponentName = requireNonNull(deviceAdminComponentName);
        this.mOwnerName = requireNonNull(ownerName);
        this.mLeaveAllSystemAppsEnabled = leaveAllSystemAppsEnabled;
        this.mTimeZone = timeZone;
        this.mLocalTime = localTime;
        this.mLocale = locale;
    }

    private FullyManagedDeviceProvisioningParams(
            @NonNull ComponentName deviceAdminComponentName,
            @NonNull String ownerName,
            boolean leaveAllSystemAppsEnabled,
            @Nullable String timeZone,
            long localTime,
            @Nullable String localeStr) {
        this(deviceAdminComponentName,
                ownerName,
                leaveAllSystemAppsEnabled,
                timeZone,
                localTime,
                getLocale(localeStr));
    }

    @Nullable
    private static Locale getLocale(String localeStr) {
        return localeStr == null ? null : Locale.forLanguageTag(localeStr);
    }

    @NonNull
    public ComponentName getDeviceAdminComponentName() {
        return mDeviceAdminComponentName;
    }

    @NonNull
    public String getOwnerName() {
        return mOwnerName;
    }

    public boolean isLeaveAllSystemAppsEnabled() {
        return mLeaveAllSystemAppsEnabled;
    }

    @Nullable
    public String getTimeZone() {
        return mTimeZone;
    }

    public long getLocalTime() {
        return mLocalTime;
    }

    @Nullable
    public @SuppressLint("UseIcu") Locale getLocale() {
        return mLocale;
    }

    /**
     * Builder class for {@link FullyManagedDeviceProvisioningParams} objects.
     */
    public static final class Builder {
        @NonNull private final ComponentName mDeviceAdminComponentName;
        @NonNull private final String mOwnerName;
        private boolean mLeaveAllSystemAppsEnabled;
        @Nullable private String mTimeZone;
        private long mLocalTime;
        @SuppressLint("UseIcu")
        @Nullable private Locale mLocale;

        /**
         * Initialize a new {@link Builder} to construct a
         * {@link FullyManagedDeviceProvisioningParams}.
         * <p>
         * See {@link DevicePolicyManager#provisionFullyManagedDevice}
         *
         * @param deviceAdminComponentName The admin {@link ComponentName} to be set as the device
         * owner.
         * @param ownerName The name of the device owner.
         *
         * @throws NullPointerException if {@code deviceAdminComponentName} or
         * {@code ownerName} are null.
         */
        public Builder(
                @NonNull ComponentName deviceAdminComponentName, @NonNull String ownerName) {
            this.mDeviceAdminComponentName = requireNonNull(deviceAdminComponentName);
            this.mOwnerName = requireNonNull(ownerName);
        }

        /**
         * Sets whether non-required system apps should be installed on
         * the created profile when
         * {@link DevicePolicyManager#provisionFullyManagedDevice}
         * is called. Defaults to {@code false} if not set.
         */
        @NonNull
        public Builder setLeaveAllSystemAppsEnabled(boolean leaveAllSystemAppsEnabled) {
            this.mLeaveAllSystemAppsEnabled = leaveAllSystemAppsEnabled;
            return this;
        }

        /**
         * Sets {@code timeZone} on the device. If not set or set to {@code null},
         * {@link DevicePolicyManager#provisionFullyManagedDevice} will not set a timezone
         */
        @NonNull
        public Builder setTimeZone(@Nullable String timeZone) {
            this.mTimeZone = timeZone;
            return this;
        }

        /**
         * Sets {@code localTime} on the device, If not set or set to
         * {@code 0}, {@link DevicePolicyManager#provisionFullyManagedDevice} will not set a
         * local time.
         */
        @NonNull
        public Builder setLocalTime(long localTime) {
            this.mLocalTime = localTime;
            return this;
        }

        /**
         * Sets {@link Locale} on the device, If not set or set to {@code null},
         * {@link DevicePolicyManager#provisionFullyManagedDevice} will not set a locale.
         */
        @NonNull
        public Builder setLocale(@SuppressLint("UseIcu") @Nullable Locale locale) {
            this.mLocale = locale;
            return this;
        }

        /**
         * Combines all of the attributes that have been set on this {@code Builder}
         *
         * @return a new {@link FullyManagedDeviceProvisioningParams} object.
         */
        @NonNull
        public FullyManagedDeviceProvisioningParams build() {
            return new FullyManagedDeviceProvisioningParams(
                    mDeviceAdminComponentName,
                    mOwnerName,
                    mLeaveAllSystemAppsEnabled,
                    mTimeZone,
                    mLocalTime,
                    mLocale);
        }
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public String toString() {
        return "FullyManagedDeviceProvisioningParams{"
                + "mDeviceAdminComponentName=" + mDeviceAdminComponentName
                + ", mOwnerName=" + mOwnerName
                + ", mLeaveAllSystemAppsEnabled=" + mLeaveAllSystemAppsEnabled
                + ", mTimeZone=" + (mTimeZone == null ? "null" : mTimeZone)
                + ", mLocalTime=" + mLocalTime
                + ", mLocale=" + (mLocale == null ? "null" : mLocale)
                + '}';
    }

    @Override
    public void writeToParcel(@NonNull Parcel dest, @Nullable int flags) {
        dest.writeTypedObject(mDeviceAdminComponentName, flags);
        dest.writeString(mOwnerName);
        dest.writeBoolean(mLeaveAllSystemAppsEnabled);
        dest.writeString(mTimeZone);
        dest.writeLong(mLocalTime);
        dest.writeString(mLocale == null ? null : mLocale.toLanguageTag());
    }

    @NonNull
    public static final Creator<FullyManagedDeviceProvisioningParams> CREATOR =
            new Creator<FullyManagedDeviceProvisioningParams>() {
                @Override
                public FullyManagedDeviceProvisioningParams createFromParcel(Parcel in) {
                    ComponentName componentName = in.readTypedObject(ComponentName.CREATOR);
                    String ownerName = in.readString();
                    boolean leaveAllSystemAppsEnabled = in.readBoolean();
                    String timeZone = in.readString();
                    long localtime = in.readLong();
                    String locale = in.readString();

                    return new FullyManagedDeviceProvisioningParams(
                            componentName,
                            ownerName,
                            leaveAllSystemAppsEnabled,
                            timeZone,
                            localtime,
                            locale);
                }

                @Override
                public FullyManagedDeviceProvisioningParams[] newArray(int size) {
                    return new FullyManagedDeviceProvisioningParams[size];
                }
            };
}
+2 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.app.admin.SystemUpdatePolicy;
import android.app.admin.PasswordMetrics;
import android.app.admin.FactoryResetProtectionPolicy;
import android.app.admin.ManagedProfileProvisioningParams;
import android.app.admin.FullyManagedDeviceProvisioningParams;
import android.content.ComponentName;
import android.content.Intent;
import android.content.IntentFilter;
@@ -496,4 +497,5 @@ interface IDevicePolicyManager {
    void setOrganizationIdForUser(in String callerPackage, in String enterpriseId, int userId);

    UserHandle createAndProvisionManagedProfile(in ManagedProfileProvisioningParams provisioningParams);
    void provisionFullyManagedDevice(in FullyManagedDeviceProvisioningParams provisioningParams);
}
Loading