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