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

Commit 6953b903 authored by Kholoud Mohamed's avatar Kholoud Mohamed Committed by Android (Google) Code Review
Browse files

Revert "Introduce a new headless-user-mode attribute"

Revert submission 27247835-headlessDoAttribute

Reason for revert: potential root cause for b/339271272

Reverted changes: /q/submissionid:27247835-headlessDoAttribute

Change-Id: Ic1212e6d1c6d01bf49000193081e748e948ce797
parent 4ee08d17
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -1030,19 +1030,11 @@ aconfig_declarations {
    name: "device_policy_aconfig_flags",
    package: "android.app.admin.flags",
    container: "system",
    exportable: true,
    srcs: [
        "core/java/android/app/admin/flags/flags.aconfig",
    ],
}

java_aconfig_library {
    name: "device_policy_exported_aconfig_flags_lib",
    aconfig_declarations: "device_policy_aconfig_flags",
    defaults: ["framework-minus-apex-aconfig-java-defaults"],
    mode: "exported",
}

java_aconfig_library {
    name: "device_policy_aconfig_flags_lib",
    aconfig_declarations: "device_policy_aconfig_flags",
+6 −28
Original line number Diff line number Diff line
@@ -21,7 +21,6 @@ import static android.app.admin.flags.Flags.FLAG_HEADLESS_DEVICE_OWNER_SINGLE_US
import android.annotation.FlaggedApi;
import android.annotation.IntDef;
import android.annotation.NonNull;
import android.app.admin.flags.Flags;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.ComponentName;
import android.content.Context;
@@ -177,10 +176,6 @@ public final class DeviceAdminInfo implements Parcelable {
     * provisioned into "affiliated" mode when on a Headless System User Mode device.
     *
     * <p>This mode adds a Profile Owner to all users other than the user the Device Owner is on.
     *
     * <p>Starting from Android version {@link android.os.Build.VERSION_CODES#VANILLA_ICE_CREAM},
     * DPCs should set the value of attribute "headless-device-owner-mode" inside the
     * "headless-system-user" tag as "affiliated".
     */
    public static final int HEADLESS_DEVICE_OWNER_MODE_AFFILIATED = 1;

@@ -190,10 +185,6 @@ public final class DeviceAdminInfo implements Parcelable {
     *
     * <p>This mode only allows a single secondary user on the device blocking the creation of
     * additional secondary users.
     *
     * <p>Starting from Android version {@link android.os.Build.VERSION_CODES#VANILLA_ICE_CREAM},
     * DPCs should set the value of attribute "headless-device-owner-mode" inside the
     * "headless-system-user" tag as "single_user".
     */
    @FlaggedApi(FLAG_HEADLESS_DEVICE_OWNER_SINGLE_USER_ENABLED)
    public static final int HEADLESS_DEVICE_OWNER_MODE_SINGLE_USER = 2;
@@ -392,30 +383,17 @@ public final class DeviceAdminInfo implements Parcelable {
                    }
                    mSupportsTransferOwnership = true;
                } else if (tagName.equals("headless-system-user")) {
                    String deviceOwnerModeStringValue = null;
                    if (Flags.headlessSingleUserCompatibilityFix()) {
                        deviceOwnerModeStringValue = parser.getAttributeValue(
                                 null, "headless-device-owner-mode");
                    }
                    if (deviceOwnerModeStringValue == null) {
                        deviceOwnerModeStringValue =
                    String deviceOwnerModeStringValue =
                            parser.getAttributeValue(null, "device-owner-mode");
                    }

                    if ("unsupported".equalsIgnoreCase(deviceOwnerModeStringValue)) {
                    if (deviceOwnerModeStringValue.equalsIgnoreCase("unsupported")) {
                        mHeadlessDeviceOwnerMode = HEADLESS_DEVICE_OWNER_MODE_UNSUPPORTED;
                    } else if ("affiliated".equalsIgnoreCase(deviceOwnerModeStringValue)) {
                    } else if (deviceOwnerModeStringValue.equalsIgnoreCase("affiliated")) {
                        mHeadlessDeviceOwnerMode = HEADLESS_DEVICE_OWNER_MODE_AFFILIATED;
                    } else if ("single_user".equalsIgnoreCase(deviceOwnerModeStringValue)) {
                    } else if (deviceOwnerModeStringValue.equalsIgnoreCase("single_user")) {
                        mHeadlessDeviceOwnerMode = HEADLESS_DEVICE_OWNER_MODE_SINGLE_USER;
                    } else {
                        if (Flags.headlessSingleUserCompatibilityFix()) {
                            Log.e(TAG, "Unknown headless-system-user mode: "
                                    + deviceOwnerModeStringValue);
                        } else {
                            throw new XmlPullParserException(
                                    "headless-system-user mode must be valid");
                        }
                        throw new XmlPullParserException("headless-system-user mode must be valid");
                    }
                }
            }
+0 −21
Original line number Diff line number Diff line
@@ -303,24 +303,3 @@ flag {
      purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "headless_single_user_compatibility_fix"
    namespace: "enterprise"
    description: "Fix for compatibility issue introduced from using single_user mode on pre-Android V builds"
    bug: "338050276"
    is_exported: true
    metadata {
      purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "headless_single_min_target_sdk"
    namespace: "enterprise"
    description: "Only allow DPCs targeting Android V to provision into single user mode"
    bug: "338588825"
    metadata {
      purpose: PURPOSE_BUGFIX
    }
}
+3 −6
Original line number Diff line number Diff line
@@ -21610,12 +21610,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
                                == HEADLESS_DEVICE_OWNER_MODE_SINGLE_USER;
            }
            if (Flags.headlessSingleMinTargetSdk()
                    && mInjector.userManagerIsHeadlessSystemUserMode()
                    && isSingleUserMode
                    && !mInjector.isChangeEnabled(
                            PROVISION_SINGLE_USER_MODE, deviceAdmin.getPackageName(),
                    caller.getUserId())) {
            if (Flags.headlessSingleUserFixes() && mInjector.userManagerIsHeadlessSystemUserMode()
                    && isSingleUserMode && !mInjector.isChangeEnabled(
                    PROVISION_SINGLE_USER_MODE, deviceAdmin.getPackageName(), caller.getUserId())) {
                throw new IllegalStateException("Device admin is not targeting Android V.");
            }