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

Commit c3e4464c authored by Eric Biggers's avatar Eric Biggers Committed by Android (Google) Code Review
Browse files

Merge "Remove ADD_ISFINANCED_DEVICE_FLAG" into main

parents 3b20644f 9c984252
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -319,12 +319,6 @@ import java.util.function.Consumer;
@RequiresFeature(PackageManager.FEATURE_DEVICE_ADMIN)
public class DevicePolicyManager {
    /** @hide */
    public static final String ADD_ISFINANCED_DEVICE_FLAG =
            "add-isfinanced-device";
    /** @hide */
    public static final boolean ADD_ISFINANCED_FEVICE_DEFAULT = true;
    private static String TAG = "DevicePolicyManager";
    private final Context mContext;
+1 −11
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.settingslib.enterprise;

import static android.app.admin.DevicePolicyManager.DEVICE_OWNER_TYPE_FINANCED;

import static com.android.settingslib.enterprise.ActionDisabledLearnMoreButtonLauncher.DEFAULT_RESOLVE_ACTIVITY_CHECKER;
import static com.android.settingslib.enterprise.ManagedDeviceActionDisabledByAdminController.DEFAULT_FOREGROUND_USER_CHECKER;

@@ -29,7 +27,6 @@ import android.hardware.biometrics.BiometricAuthenticator;
import android.hardware.biometrics.ParentalControlsUtilsInternal;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.DeviceConfig;
import android.text.TextUtils;

/**
@@ -94,15 +91,8 @@ public final class ActionDisabledByAdminControllerFactory {

    private static boolean isFinancedDevice(Context context) {
        DevicePolicyManager dpm = context.getSystemService(DevicePolicyManager.class);
        // TODO(b/259908270): remove
        if (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_DEVICE_POLICY_MANAGER,
                DevicePolicyManager.ADD_ISFINANCED_DEVICE_FLAG,
                DevicePolicyManager.ADD_ISFINANCED_FEVICE_DEFAULT)) {
        return dpm.isFinancedDevice();
    }
        return dpm.isDeviceManaged() && dpm.getDeviceOwnerType(
                dpm.getDeviceOwnerComponentOnAnyUser()) == DEVICE_OWNER_TYPE_FINANCED;
    }

    private ActionDisabledByAdminControllerFactory() {
        throw new UnsupportedOperationException("provides only static methods");
+0 −5
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ import android.os.Handler;
import android.os.Looper;
import android.platform.test.annotations.DisableFlags;
import android.platform.test.annotations.EnableFlags;
import android.provider.DeviceConfig;
import android.provider.Settings;
import android.testing.TestableLooper;
import android.testing.TestableLooper.RunWithLooper;
@@ -124,10 +123,6 @@ public class QSSecurityFooterTest extends SysuiTestCase {
        Looper looper = mTestableLooper.getLooper();
        mShadeDialogContextInteractor = new FakeShadeDialogContextInteractor(mContext);
        Handler mainHandler = new Handler(looper);
        // TODO(b/259908270): remove
        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_DEVICE_POLICY_MANAGER,
                DevicePolicyManager.ADD_ISFINANCED_DEVICE_FLAG, "true",
                /* makeDefault= */ false);
        when(mUserTracker.getUserInfo()).thenReturn(mock(UserInfo.class));
        mFooterUtils = new QSSecurityFooterUtils(getContext(),
                getContext().getSystemService(DevicePolicyManager.class), mUserTracker,
+0 −5
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ import android.content.Context;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Looper;
import android.os.UserManager;
import android.provider.DeviceConfig;
import android.testing.TestableLooper;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityManager;
@@ -214,10 +213,6 @@ public class KeyguardIndicationControllerBaseTest extends SysuiTestCase {
        mTextView = new KeyguardIndicationTextView(mContext);
        mTextView.setAnimationsEnabled(false);

        // TODO(b/259908270): remove
        DeviceConfig.setProperty(DeviceConfig.NAMESPACE_DEVICE_POLICY_MANAGER,
                DevicePolicyManager.ADD_ISFINANCED_DEVICE_FLAG, "true",
                /* makeDefault= */ false);
        mContext.addMockSystemService(Context.DEVICE_POLICY_SERVICE, mDevicePolicyManager);
        mContext.addMockSystemService(UserManager.class, mUserManager);
        mContext.addMockSystemService(Context.TRUST_SERVICE, mock(TrustManager.class));
+3 −19
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
 */
package com.android.systemui.qs;

import static android.app.admin.DevicePolicyManager.DEVICE_OWNER_TYPE_FINANCED;
import static android.app.admin.DevicePolicyResources.Strings.SystemUi.QS_DIALOG_MANAGEMENT;
import static android.app.admin.DevicePolicyResources.Strings.SystemUi.QS_DIALOG_MANAGEMENT_CA_CERT;
import static android.app.admin.DevicePolicyResources.Strings.SystemUi.QS_DIALOG_MANAGEMENT_NAMED_VPN;
@@ -57,7 +56,6 @@ import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Looper;
import android.os.UserManager;
import android.provider.DeviceConfig;
import android.provider.Settings;
import android.text.SpannableStringBuilder;
import android.text.method.LinkMovementMethod;
@@ -374,7 +372,7 @@ public class QSSecurityFooterUtils implements DialogInterface.OnClickListener {
        if (organizationName == null) {
            return mDpm.getResources().getString(QS_MSG_MANAGEMENT, mManagementMessageSupplier);
        }
        if (isFinancedDevice()) {
        if (mSecurityController.isFinancedDevice()) {
            return mContext.getString(
                    R.string.quick_settings_financed_disclosure_named_management,
                    organizationName);
@@ -710,7 +708,7 @@ public class QSSecurityFooterUtils implements DialogInterface.OnClickListener {
            return null;
        }
        if (organizationName != null) {
            if (isFinancedDevice()) {
            if (mSecurityController.isFinancedDevice()) {
                return mContext.getString(R.string.monitoring_financed_description_named_management,
                        organizationName, organizationName);
            } else {
@@ -814,7 +812,7 @@ public class QSSecurityFooterUtils implements DialogInterface.OnClickListener {

    @VisibleForTesting
    CharSequence getManagementTitle(CharSequence deviceOwnerOrganization) {
        if (deviceOwnerOrganization != null && isFinancedDevice()) {
        if (deviceOwnerOrganization != null && mSecurityController.isFinancedDevice()) {
            return mContext.getString(R.string.monitoring_title_financed_device,
                    deviceOwnerOrganization);
        } else {
@@ -844,18 +842,4 @@ public class QSSecurityFooterUtils implements DialogInterface.OnClickListener {
            return 314159257; // prime
        }
    }

    // TODO(b/259908270): remove and inline direct call to mSecurityController.isFinancedDevice()
    private boolean isFinancedDevice() {
        if (DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_DEVICE_POLICY_MANAGER,
                DevicePolicyManager.ADD_ISFINANCED_DEVICE_FLAG,
                DevicePolicyManager.ADD_ISFINANCED_FEVICE_DEFAULT)) {
            return mSecurityController.isFinancedDevice();
        } else {
            return mSecurityController.isDeviceManaged()
                    && mSecurityController.getDeviceOwnerType(
                    mSecurityController.getDeviceOwnerComponentOnAnyUser())
                    == DEVICE_OWNER_TYPE_FINANCED;
        }
    }
}
Loading