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

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

Merge "DeviceAdminService must be protected with BIND_DEVICE_ADMIN." into oc-dev

parents 5b4e16c3 fe739701
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1518,7 +1518,8 @@ public class DevicePolicyManager {
     * Service action: Action for a service that device owner and profile owner can optionally
     * own.  If a device owner or a profile owner has such a service, the system tries to keep
     * a bound connection to it, in order to keep their process always running.
     * The service must not be exported.
     * The service must be protected with the {@link android.Manifest.permission#BIND_DEVICE_ADMIN}
     * permission.
     */
    @SdkConstant(SdkConstantType.SERVICE_ACTION)
    public static final String ACTION_DEVICE_ADMIN_SERVICE
+6 −3
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */
package com.android.server.devicepolicy;

import android.Manifest.permission;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.admin.DevicePolicyManager;
@@ -115,10 +116,12 @@ public class DeviceAdminServiceController {
                return null;
            }
            final ServiceInfo si = list.get(0).serviceInfo;
            if (si.exported) {
                Log.e(TAG, "DeviceAdminService must not be exported: '"

            if (!permission.BIND_DEVICE_ADMIN.equals(si.permission)) {
                Log.e(TAG, "DeviceAdminService "
                        + si.getComponentName().flattenToShortString()
                        + "' will be ignored.");
                        + " must be protected with " + permission.BIND_DEVICE_ADMIN
                        + ".");
                return null;
            }
            return si;