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

Commit bf4372be authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Modify DevicePolicyManagerService to extend IDevicePolicyManager.aidl"

parents bf6c9746 01ed6212
Loading
Loading
Loading
Loading
+15 −19
Original line number Diff line number Diff line
@@ -221,6 +221,7 @@ import android.app.admin.DevicePolicyStringResource;
import android.app.admin.DeviceStateCache;
import android.app.admin.FactoryResetProtectionPolicy;
import android.app.admin.FullyManagedDeviceProvisioningParams;
import android.app.admin.IDevicePolicyManager;
import android.app.admin.ManagedProfileProvisioningParams;
import android.app.admin.ManagedSubscriptionsPolicy;
import android.app.admin.NetworkEvent;
@@ -442,7 +443,7 @@ import java.util.stream.Collectors;
/**
 * Implementation of the device policy APIs.
 */
public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
    protected static final String LOG_TAG = "DevicePolicyManager";
@@ -920,25 +921,26 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    private final ArrayList<Object> mPendingUserCreatedCallbackTokens = new ArrayList<>();
    public static final class Lifecycle extends SystemService {
        private BaseIDevicePolicyManager mService;
        private DevicePolicyManagerService mService;
        public Lifecycle(Context context) {
            super(context);
            String dpmsClassName = context.getResources()
                    .getString(R.string.config_deviceSpecificDevicePolicyManagerService);
            if (TextUtils.isEmpty(dpmsClassName)) {
                dpmsClassName = DevicePolicyManagerService.class.getName();
            }
                mService = new DevicePolicyManagerService(context);
            } else {
                try {
                    Class<?> serviceClass = Class.forName(dpmsClassName);
                    Constructor<?> constructor = serviceClass.getConstructor(Context.class);
                mService = (BaseIDevicePolicyManager) constructor.newInstance(context);
                    mService = (DevicePolicyManagerService) constructor.newInstance(context);
                } catch (Exception e) {
                    throw new IllegalStateException(
                        "Failed to instantiate DevicePolicyManagerService with class name: "
                        + dpmsClassName, e);
                }
            }
        }
        /** Sets the {@link DevicePolicySafetyChecker}. */
        public void setDevicePolicySafetyChecker(DevicePolicySafetyChecker safetyChecker) {
@@ -1348,7 +1350,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        }
    }
    @Override
    public void setDevicePolicySafetyChecker(DevicePolicySafetyChecker safetyChecker) {
        CallerIdentity callerIdentity = getCallerIdentity();
        Preconditions.checkCallAuthorization(mIsAutomotive || isAdb(callerIdentity), "can only set "
@@ -3090,7 +3091,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
    }
    @VisibleForTesting
    @Override
    void systemReady(int phase) {
        if (!mHasFeature) {
            return;
@@ -3289,7 +3289,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        }
    }
    @Override
    void handleStartUser(int userId) {
        synchronized (getLockObject()) {
            pushScreenCapturePolicy(userId);
@@ -3337,7 +3336,6 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
                        targetUserId, protectedPackages));
    }
    @Override
    void handleUnlockUser(int userId) {
        startOwnerService(userId, "unlock-user");
        if (isCoexistenceFlagEnabled()) {
@@ -3345,12 +3343,10 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
        }
    }
    @Override
    void handleOnUserUnlocked(int userId) {
        showNewUserDisclaimerIfNecessary(userId);
    }
    @Override
    void handleStopUser(int userId) {
        updateNetworkPreferenceForUser(userId, List.of(PreferentialNetworkServiceConfig.DEFAULT));
        mDeviceAdminServiceController.stopServicesForUser(userId, /* actionForLog= */ "stop-user");