diff options
author | 2024-08-29 12:54:10 +0000 | |
---|---|---|
committer | 2024-08-29 12:54:10 +0000 | |
commit | 60b76eb8c38b4587460b876ef7ff8c10cdb67b27 (patch) | |
tree | 6137fc565a7d2312b995089f008126478df24fd3 | |
parent | 44c2a9ffd05627f4161d65a5146588e3fa4382fb (diff) | |
parent | 0d9e07dd74bd9573d43ab1ea00e2e612ea93c051 (diff) |
Merge changes from topics "assist-flag-cleanup", "esimmgmt-flag-cleanup" into main
* changes:
Clean up fully rolled out AssistContentUserRestrictionEnabled
Clean up fully rolled out EsimManagementEnabled
9 files changed, 32 insertions, 70 deletions
diff --git a/core/api/current.txt b/core/api/current.txt index 2565d6ff3624..ed8ab06810f9 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -141,7 +141,7 @@ package android { field public static final String MANAGE_DEVICE_POLICY_APPS_CONTROL = "android.permission.MANAGE_DEVICE_POLICY_APPS_CONTROL"; field public static final String MANAGE_DEVICE_POLICY_APP_RESTRICTIONS = "android.permission.MANAGE_DEVICE_POLICY_APP_RESTRICTIONS"; field public static final String MANAGE_DEVICE_POLICY_APP_USER_DATA = "android.permission.MANAGE_DEVICE_POLICY_APP_USER_DATA"; - field @FlaggedApi("android.app.admin.flags.assist_content_user_restriction_enabled") public static final String MANAGE_DEVICE_POLICY_ASSIST_CONTENT = "android.permission.MANAGE_DEVICE_POLICY_ASSIST_CONTENT"; + field public static final String MANAGE_DEVICE_POLICY_ASSIST_CONTENT = "android.permission.MANAGE_DEVICE_POLICY_ASSIST_CONTENT"; field public static final String MANAGE_DEVICE_POLICY_AUDIO_OUTPUT = "android.permission.MANAGE_DEVICE_POLICY_AUDIO_OUTPUT"; field public static final String MANAGE_DEVICE_POLICY_AUTOFILL = "android.permission.MANAGE_DEVICE_POLICY_AUTOFILL"; field public static final String MANAGE_DEVICE_POLICY_BACKUP_SERVICE = "android.permission.MANAGE_DEVICE_POLICY_BACKUP_SERVICE"; @@ -169,7 +169,7 @@ package android { field public static final String MANAGE_DEVICE_POLICY_LOCK = "android.permission.MANAGE_DEVICE_POLICY_LOCK"; field public static final String MANAGE_DEVICE_POLICY_LOCK_CREDENTIALS = "android.permission.MANAGE_DEVICE_POLICY_LOCK_CREDENTIALS"; field public static final String MANAGE_DEVICE_POLICY_LOCK_TASK = "android.permission.MANAGE_DEVICE_POLICY_LOCK_TASK"; - field @FlaggedApi("android.app.admin.flags.esim_management_enabled") public static final String MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS = "android.permission.MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS"; + field public static final String MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS = "android.permission.MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS"; field public static final String MANAGE_DEVICE_POLICY_METERED_DATA = "android.permission.MANAGE_DEVICE_POLICY_METERED_DATA"; field public static final String MANAGE_DEVICE_POLICY_MICROPHONE = "android.permission.MANAGE_DEVICE_POLICY_MICROPHONE"; field @FlaggedApi("android.app.admin.flags.dedicated_device_control_api_enabled") public static final String MANAGE_DEVICE_POLICY_MICROPHONE_TOGGLE = "android.permission.MANAGE_DEVICE_POLICY_MICROPHONE_TOGGLE"; @@ -8081,7 +8081,7 @@ package android.app.admin { method public CharSequence getStartUserSessionMessage(@NonNull android.content.ComponentName); method @Deprecated public boolean getStorageEncryption(@Nullable android.content.ComponentName); method public int getStorageEncryptionStatus(); - method @FlaggedApi("android.app.admin.flags.esim_management_enabled") @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS) public java.util.Set<java.lang.Integer> getSubscriptionIds(); + method @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS) public java.util.Set<java.lang.Integer> getSubscriptionIds(); method @Nullable public android.app.admin.SystemUpdatePolicy getSystemUpdatePolicy(); method @Nullable public android.os.PersistableBundle getTransferOwnershipBundle(); method @Nullable public java.util.List<android.os.PersistableBundle> getTrustAgentConfiguration(@Nullable android.content.ComponentName, @NonNull android.content.ComponentName); @@ -34116,7 +34116,7 @@ package android.os { field public static final String DISALLOW_AIRPLANE_MODE = "no_airplane_mode"; field public static final String DISALLOW_AMBIENT_DISPLAY = "no_ambient_display"; field public static final String DISALLOW_APPS_CONTROL = "no_control_apps"; - field @FlaggedApi("android.app.admin.flags.assist_content_user_restriction_enabled") public static final String DISALLOW_ASSIST_CONTENT = "no_assist_content"; + field public static final String DISALLOW_ASSIST_CONTENT = "no_assist_content"; field public static final String DISALLOW_AUTOFILL = "no_autofill"; field public static final String DISALLOW_BLUETOOTH = "no_bluetooth"; field public static final String DISALLOW_BLUETOOTH_SHARING = "no_bluetooth_sharing"; @@ -34166,7 +34166,7 @@ package android.os { field public static final String DISALLOW_SHARE_INTO_MANAGED_PROFILE = "no_sharing_into_profile"; field public static final String DISALLOW_SHARE_LOCATION = "no_share_location"; field public static final String DISALLOW_SHARING_ADMIN_CONFIGURED_WIFI = "no_sharing_admin_configured_wifi"; - field @FlaggedApi("android.app.admin.flags.esim_management_enabled") public static final String DISALLOW_SIM_GLOBALLY = "no_sim_globally"; + field public static final String DISALLOW_SIM_GLOBALLY = "no_sim_globally"; field public static final String DISALLOW_SMS = "no_sms"; field public static final String DISALLOW_SYSTEM_ERROR_DIALOGS = "no_system_error_dialogs"; field @FlaggedApi("com.android.net.thread.platform.flags.thread_user_restriction_enabled") public static final String DISALLOW_THREAD_NETWORK = "no_thread_network"; diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java index 0fc77f00e648..d31d8f27844a 100644 --- a/core/java/android/app/admin/DevicePolicyManager.java +++ b/core/java/android/app/admin/DevicePolicyManager.java @@ -56,7 +56,6 @@ import static android.Manifest.permission.SET_TIME_ZONE; import static android.app.admin.DeviceAdminInfo.HEADLESS_DEVICE_OWNER_MODE_UNSUPPORTED; import static android.app.admin.flags.Flags.FLAG_DEVICE_POLICY_SIZE_TRACKING_INTERNAL_BUG_FIX_ENABLED; import static android.app.admin.flags.Flags.FLAG_DEVICE_THEFT_API_ENABLED; -import static android.app.admin.flags.Flags.FLAG_ESIM_MANAGEMENT_ENABLED; import static android.app.admin.flags.Flags.FLAG_DEVICE_POLICY_SIZE_TRACKING_ENABLED; import static android.app.admin.flags.Flags.FLAG_HEADLESS_DEVICE_OWNER_PROVISIONING_FIX_ENABLED; import static android.app.admin.flags.Flags.onboardingBugreportV2Enabled; @@ -17742,7 +17741,6 @@ public class DevicePolicyManager { * @throws SecurityException if the caller is not authorized to call this method. * @return ids of all managed subscriptions currently downloaded by an admin on the device. */ - @FlaggedApi(FLAG_ESIM_MANAGEMENT_ENABLED) @RequiresPermission(android.Manifest.permission.MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS) @NonNull public Set<Integer> getSubscriptionIds() { diff --git a/core/java/android/app/admin/flags/flags.aconfig b/core/java/android/app/admin/flags/flags.aconfig index f2861fef6b33..29a5048daae6 100644 --- a/core/java/android/app/admin/flags/flags.aconfig +++ b/core/java/android/app/admin/flags/flags.aconfig @@ -139,6 +139,7 @@ flag { bug: "293441361" } +# Fully rolled out and must not be used. flag { name: "assist_content_user_restriction_enabled" is_exported: true @@ -165,6 +166,7 @@ flag { bug: "304999634" } +# Fully rolled out and must not be used. flag { name: "esim_management_enabled" is_exported: true diff --git a/core/java/android/os/UserManager.java b/core/java/android/os/UserManager.java index 536eca6f9a0f..f1ec0e4e9bdc 100644 --- a/core/java/android/os/UserManager.java +++ b/core/java/android/os/UserManager.java @@ -1978,7 +1978,6 @@ public class UserManager { * @see DevicePolicyManager#clearUserRestriction(ComponentName, String) * @see #getUserRestrictions() */ - @FlaggedApi(android.app.admin.flags.Flags.FLAG_ESIM_MANAGEMENT_ENABLED) public static final String DISALLOW_SIM_GLOBALLY = "no_sim_globally"; @@ -1999,7 +1998,6 @@ public class UserManager { * @see DevicePolicyManager#clearUserRestriction(ComponentName, String) * @see #getUserRestrictions() */ - @FlaggedApi(android.app.admin.flags.Flags.FLAG_ASSIST_CONTENT_USER_RESTRICTION_ENABLED) public static final String DISALLOW_ASSIST_CONTENT = "no_assist_content"; /** diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 854deb01aa48..8f0927f791c9 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -3766,7 +3766,6 @@ privileged app such as the Assistant app. <p>Protection level: internal|role <p>Intended for use by the DEVICE_POLICY_MANAGEMENT role only. - @FlaggedApi("android.app.admin.flags.assist_content_user_restriction_enabled") --> <permission android:name="android.permission.MANAGE_DEVICE_POLICY_ASSIST_CONTENT" android:protectionLevel="internal|role" /> @@ -4027,7 +4026,6 @@ APIs protected by this permission on users different to the calling user. <p>Protection level: internal|role <p>Intended for use by the DEVICE_POLICY_MANAGEMENT role only. - @FlaggedApi("android.app.admin.flags.esim_management_enabled") --> <permission android:name="android.permission.MANAGE_DEVICE_POLICY_MANAGED_SUBSCRIPTIONS" android:protectionLevel="internal|role" /> diff --git a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java index 95e5b84a8ed3..2bc6d53147fb 100644 --- a/services/core/java/com/android/server/pm/UserRestrictionsUtils.java +++ b/services/core/java/com/android/server/pm/UserRestrictionsUtils.java @@ -503,26 +503,21 @@ public class UserRestrictionsUtils { String restriction, boolean isMainUser, boolean isProfileOwnerOnOrgOwnedDevice) { - if (android.app.admin.flags.Flags.esimManagementEnabled()) { - if (IMMUTABLE_BY_OWNERS.contains(restriction)) { - return false; - } - if (DEVICE_OWNER_ONLY_RESTRICTIONS.contains(restriction)) { - return false; - } - if (!isMainUser && MAIN_USER_ONLY_RESTRICTIONS.contains(restriction)) { - return false; - } - if (!isProfileOwnerOnOrgOwnedDevice - && PROFILE_OWNER_ORGANIZATION_OWNED_PROFILE_RESTRICTIONS.contains( - restriction)) { - return false; - } - return true; + if (IMMUTABLE_BY_OWNERS.contains(restriction)) { + return false; + } + if (DEVICE_OWNER_ONLY_RESTRICTIONS.contains(restriction)) { + return false; + } + if (!isMainUser && MAIN_USER_ONLY_RESTRICTIONS.contains(restriction)) { + return false; + } + if (!isProfileOwnerOnOrgOwnedDevice + && PROFILE_OWNER_ORGANIZATION_OWNED_PROFILE_RESTRICTIONS.contains( + restriction)) { + return false; } - return !IMMUTABLE_BY_OWNERS.contains(restriction) - && !DEVICE_OWNER_ONLY_RESTRICTIONS.contains(restriction) - && !(!isMainUser && MAIN_USER_ONLY_RESTRICTIONS.contains(restriction)); + return true; } /** diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index af4a48da7e0e..4abbdee65acb 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -13972,11 +13972,9 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { UserManager.DISALLOW_THREAD_NETWORK, new String[]{MANAGE_DEVICE_POLICY_THREAD_NETWORK}); } - if (Flags.assistContentUserRestrictionEnabled()) { - USER_RESTRICTION_PERMISSIONS.put( - UserManager.DISALLOW_ASSIST_CONTENT, - new String[]{MANAGE_DEVICE_POLICY_ASSIST_CONTENT}); - } + USER_RESTRICTION_PERMISSIONS.put( + UserManager.DISALLOW_ASSIST_CONTENT, + new String[]{MANAGE_DEVICE_POLICY_ASSIST_CONTENT}); USER_RESTRICTION_PERMISSIONS.put( UserManager.DISALLOW_ULTRA_WIDEBAND_RADIO, new String[]{MANAGE_DEVICE_POLICY_NEARBY_COMMUNICATION}); USER_RESTRICTION_PERMISSIONS.put( @@ -19755,16 +19753,14 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } private void transferSubscriptionOwnership(ComponentName admin, ComponentName target) { - if (Flags.esimManagementEnabled()) { - SubscriptionManager subscriptionManager = mContext.getSystemService( - SubscriptionManager.class); - for (int subId : getSubscriptionIdsInternal(admin.getPackageName()).toArray()) { - try { - subscriptionManager.setGroupOwner(subId, target.getPackageName()); - } catch (Exception e) { - // Shouldn't happen. - Slogf.e(LOG_TAG, e, "Error setting group owner for subId: " + subId); - } + SubscriptionManager subscriptionManager = mContext.getSystemService( + SubscriptionManager.class); + for (int subId : getSubscriptionIdsInternal(admin.getPackageName()).toArray()) { + try { + subscriptionManager.setGroupOwner(subId, target.getPackageName()); + } catch (Exception e) { + // Shouldn't happen. + Slogf.e(LOG_TAG, e, "Error setting group owner for subId: " + subId); } } } diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/PolicyDefinition.java b/services/devicepolicy/java/com/android/server/devicepolicy/PolicyDefinition.java index 19a942cd2eed..24ee46fbcd6f 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/PolicyDefinition.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/PolicyDefinition.java @@ -536,7 +536,6 @@ final class PolicyDefinition<V> { USER_RESTRICTION_FLAGS.put( UserManager.DISALLOW_THREAD_NETWORK, POLICY_FLAG_GLOBAL_ONLY_POLICY); } - USER_RESTRICTION_FLAGS.put(UserManager.DISALLOW_ASSIST_CONTENT, /* flags= */ 0); for (String key : USER_RESTRICTION_FLAGS.keySet()) { createAndAddUserRestrictionPolicyDefinition(key, USER_RESTRICTION_FLAGS.get(key)); } diff --git a/services/tests/servicestests/src/com/android/server/pm/UserRestrictionsUtilsTest.java b/services/tests/servicestests/src/com/android/server/pm/UserRestrictionsUtilsTest.java index 55c48e07162b..f0a5f7583661 100644 --- a/services/tests/servicestests/src/com/android/server/pm/UserRestrictionsUtilsTest.java +++ b/services/tests/servicestests/src/com/android/server/pm/UserRestrictionsUtilsTest.java @@ -36,7 +36,6 @@ import android.util.SparseArray; import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; -import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -55,11 +54,6 @@ public class UserRestrictionsUtilsTest { @Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); - @Before - public void setUp() { - mSetFlagsRule.enableFlags(android.app.admin.flags.Flags.FLAG_ESIM_MANAGEMENT_ENABLED); - } - @Test public void testNonNull() { Bundle out = UserRestrictionsUtils.nonNull(null); @@ -144,7 +138,6 @@ public class UserRestrictionsUtilsTest { @Test public void testCanProfileOwnerChange_restrictionRequiresOrgOwnedDevice_orgOwned() { - mSetFlagsRule.enableFlags(android.app.admin.flags.Flags.FLAG_ESIM_MANAGEMENT_ENABLED); assertTrue(UserRestrictionsUtils.canProfileOwnerChange( UserManager.DISALLOW_SIM_GLOBALLY, false, @@ -157,7 +150,6 @@ public class UserRestrictionsUtilsTest { @Test public void testCanProfileOwnerChange_restrictionRequiresOrgOwnedDevice_notOrgOwned() { - mSetFlagsRule.enableFlags(android.app.admin.flags.Flags.FLAG_ESIM_MANAGEMENT_ENABLED); assertFalse(UserRestrictionsUtils.canProfileOwnerChange( UserManager.DISALLOW_SIM_GLOBALLY, false, @@ -169,22 +161,7 @@ public class UserRestrictionsUtilsTest { } @Test - public void - testCanProfileOwnerChange_disabled_restrictionRequiresOrgOwnedDevice_notOrgOwned() { - mSetFlagsRule.disableFlags(android.app.admin.flags.Flags.FLAG_ESIM_MANAGEMENT_ENABLED); - assertTrue(UserRestrictionsUtils.canProfileOwnerChange( - UserManager.DISALLOW_SIM_GLOBALLY, - false, - false)); - assertTrue(UserRestrictionsUtils.canProfileOwnerChange( - UserManager.DISALLOW_SIM_GLOBALLY, - true, - false)); - } - - @Test public void testCanProfileOwnerChange_restrictionNotRequiresOrgOwnedDevice_orgOwned() { - mSetFlagsRule.enableFlags(android.app.admin.flags.Flags.FLAG_ESIM_MANAGEMENT_ENABLED); assertTrue(UserRestrictionsUtils.canProfileOwnerChange( UserManager.DISALLOW_ADJUST_VOLUME, false, @@ -197,7 +174,6 @@ public class UserRestrictionsUtilsTest { @Test public void testCanProfileOwnerChange_restrictionNotRequiresOrgOwnedDevice_notOrgOwned() { - mSetFlagsRule.enableFlags(android.app.admin.flags.Flags.FLAG_ESIM_MANAGEMENT_ENABLED); assertTrue(UserRestrictionsUtils.canProfileOwnerChange( UserManager.DISALLOW_ADJUST_VOLUME, false, |