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

Commit d75930cb authored by Rubin Xu's avatar Rubin Xu
Browse files

DevicePolicyManager: Skip clearing APN before boot completed

It's not possible to connect to APN's content provider before
boot completed, so skip the cleanup step in this case.

Bug: 277903236
Test: manual
Change-Id: I7d2304a13e1a4e3ac81ad675ced600c9c3801576
parent b1cd4937
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -259,7 +259,6 @@ import android.Manifest.permission;
import android.accessibilityservice.AccessibilityServiceInfo;
import android.accounts.Account;
import android.accounts.AccountManager;
import android.accounts.AccountManagerFuture;
import android.accounts.AuthenticatorException;
import android.accounts.OperationCanceledException;
import android.annotation.IntDef;
@@ -447,7 +446,6 @@ import android.util.AtomicFile;
import android.util.DebugUtils;
import android.util.IndentingPrintWriter;
import android.util.IntArray;
import android.util.Log;
import android.util.Pair;
import android.util.Slog;
import android.util.SparseArray;
@@ -490,6 +488,7 @@ import com.android.server.LockGuard;
import com.android.server.PersistentDataBlockManagerInternal;
import com.android.server.SystemServerInitThreadPool;
import com.android.server.SystemService;
import com.android.server.SystemServiceManager;
import com.android.server.devicepolicy.ActiveAdmin.TrustAgentInfo;
import com.android.server.inputmethod.InputMethodManagerInternal;
import com.android.server.net.NetworkPolicyManagerInternal;
@@ -10072,6 +10071,13 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
        if (!mHasTelephonyFeature) {
            return;
        }
        if (!LocalServices.getService(SystemServiceManager.class).isBootCompleted()) {
            Slogf.i(LOG_TAG, "Skip clearing managed profile Apn before boot completed");
            // Cannot talk to APN content provider before system boots
            // Ideally we should delay the cleanup post boot_completed, not just
            // skipping  it altogether.
            return;
        }
        final List<ApnSetting> apns = getOverrideApnsUnchecked();
        for (ApnSetting apn : apns) {
            if (apn.getApnTypeBitmask() == ApnSetting.TYPE_ENTERPRISE) {