Change ProfileType definition
Bug: 141601408
Test: rebuild
Change-Id: Ia4d4fabe8a4daad4ce54c243748fa3c29bf944ba
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index b5a1539..bef4f1b 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -1060,9 +1060,9 @@
public static Fragment getTargetFragment(Activity activity, String fragmentName, Bundle args) {
Fragment f = null;
final boolean isPersonal = args != null ? args.getInt(ProfileSelectFragment.EXTRA_PROFILE)
- == ProfileSelectFragment.PERSONAL : false;
+ == ProfileSelectFragment.ProfileType.PERSONAL : false;
final boolean isWork = args != null ? args.getInt(ProfileSelectFragment.EXTRA_PROFILE)
- == ProfileSelectFragment.WORK : false;
+ == ProfileSelectFragment.ProfileType.WORK : false;
if (FeatureFlagUtils.isEnabled(activity, FeatureFlags.PERSONAL_WORK_PROFILE)
&& UserManager.get(activity).getUserProfiles().size() > 1
&& ProfileFragmentBridge.FRAGMENT_MAP.get(fragmentName) != null
diff --git a/src/com/android/settings/accounts/AccountDashboardFragment.java b/src/com/android/settings/accounts/AccountDashboardFragment.java
index bee9071..53b5ea3 100644
--- a/src/com/android/settings/accounts/AccountDashboardFragment.java
+++ b/src/com/android/settings/accounts/AccountDashboardFragment.java
@@ -73,7 +73,7 @@
final AccountPreferenceController accountPrefController =
new AccountPreferenceController(context, parent, authorities,
- ProfileSelectFragment.ALL);
+ ProfileSelectFragment.ProfileType.ALL);
if (parent != null) {
parent.getSettingsLifecycle().addObserver(accountPrefController);
}
diff --git a/src/com/android/settings/accounts/AccountPersonalDashboardFragment.java b/src/com/android/settings/accounts/AccountPersonalDashboardFragment.java
index e0db7f5..f29326e 100644
--- a/src/com/android/settings/accounts/AccountPersonalDashboardFragment.java
+++ b/src/com/android/settings/accounts/AccountPersonalDashboardFragment.java
@@ -71,7 +71,7 @@
final AccountPreferenceController accountPrefController =
new AccountPreferenceController(context, parent, authorities,
- ProfileSelectFragment.PERSONAL);
+ ProfileSelectFragment.ProfileType.PERSONAL);
if (parent != null) {
parent.getSettingsLifecycle().addObserver(accountPrefController);
}
diff --git a/src/com/android/settings/accounts/AccountPreferenceController.java b/src/com/android/settings/accounts/AccountPreferenceController.java
index 36a7012..1f27963 100644
--- a/src/com/android/settings/accounts/AccountPreferenceController.java
+++ b/src/com/android/settings/accounts/AccountPreferenceController.java
@@ -277,10 +277,10 @@
final int profilesCount = profiles.size();
for (int i = 0; i < profilesCount; i++) {
if (profiles.get(i).isManagedProfile()
- && (mType & ProfileSelectFragment.WORK) != 0) {
+ && (mType & ProfileSelectFragment.ProfileType.WORK) != 0) {
updateProfileUi(profiles.get(i));
} else if (!profiles.get(i).isManagedProfile()
- && (mType & ProfileSelectFragment.PERSONAL) != 0) {
+ && (mType & ProfileSelectFragment.ProfileType.PERSONAL) != 0) {
updateProfileUi(profiles.get(i));
}
}
@@ -324,7 +324,7 @@
preferenceGroup.setContentDescription(
mContext.getString(R.string.account_settings));
} else if (userInfo.isManagedProfile()) {
- if (mType == ProfileSelectFragment.ALL) {
+ if (mType == ProfileSelectFragment.ProfileType.ALL) {
preferenceGroup.setTitle(R.string.category_work);
final String workGroupSummary = getWorkGroupSummary(context, userInfo);
preferenceGroup.setSummary(workGroupSummary);
@@ -336,7 +336,7 @@
DISALLOW_REMOVE_MANAGED_PROFILE, UserHandle.myUserId());
profileData.managedProfilePreference = newManagedProfileSettings();
} else {
- if (mType == ProfileSelectFragment.ALL) {
+ if (mType == ProfileSelectFragment.ProfileType.ALL) {
preferenceGroup.setTitle(R.string.category_personal);
preferenceGroup.setContentDescription(
mContext.getString(R.string.accessibility_category_personal));
diff --git a/src/com/android/settings/accounts/AccountWorkProfileDashboardFragment.java b/src/com/android/settings/accounts/AccountWorkProfileDashboardFragment.java
index 8dfa934..853c66b 100644
--- a/src/com/android/settings/accounts/AccountWorkProfileDashboardFragment.java
+++ b/src/com/android/settings/accounts/AccountWorkProfileDashboardFragment.java
@@ -71,7 +71,7 @@
final AccountPreferenceController accountPrefController =
new AccountPreferenceController(context, parent, authorities,
- ProfileSelectFragment.WORK);
+ ProfileSelectFragment.ProfileType.WORK);
if (parent != null) {
parent.getSettingsLifecycle().addObserver(accountPrefController);
}
diff --git a/src/com/android/settings/applications/manageapplications/ManageApplications.java b/src/com/android/settings/applications/manageapplications/ManageApplications.java
index 4ce8fa4..7da89e4 100644
--- a/src/com/android/settings/applications/manageapplications/ManageApplications.java
+++ b/src/com/android/settings/applications/manageapplications/ManageApplications.java
@@ -102,9 +102,9 @@
import com.android.settings.core.SubSettingLauncher;
import com.android.settings.dashboard.profileselector.ProfileSelectFragment;
import com.android.settings.fuelgauge.HighPowerDetail;
-import com.android.settings.notification.app.AppNotificationSettings;
import com.android.settings.notification.ConfigureNotificationSettings;
import com.android.settings.notification.NotificationBackend;
+import com.android.settings.notification.app.AppNotificationSettings;
import com.android.settings.widget.LoadingViewController;
import com.android.settings.wifi.AppStateChangeWifiStateBridge;
import com.android.settings.wifi.ChangeWifiStateDetails;
@@ -311,9 +311,9 @@
final AppFilterRegistry appFilterRegistry = AppFilterRegistry.getInstance();
mFilter = appFilterRegistry.get(appFilterRegistry.getDefaultFilterType(mListType));
mIsPersonalOnly = args != null ? args.getInt(ProfileSelectFragment.EXTRA_PROFILE)
- == ProfileSelectFragment.PERSONAL : false;
+ == ProfileSelectFragment.ProfileType.PERSONAL : false;
mIsWorkOnly = args != null ? args.getInt(ProfileSelectFragment.EXTRA_PROFILE)
- == ProfileSelectFragment.WORK : false;
+ == ProfileSelectFragment.ProfileType.WORK : false;
mWorkUserId = args != null ? args.getInt(EXTRA_WORK_ID) : NO_USER_SPECIFIED;
mExpandSearch = activity.getIntent().getBooleanExtra(EXTRA_EXPAND_SEARCH_VIEW, false);
diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java
index de23ec0..79228c2 100644
--- a/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java
+++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java
@@ -53,26 +53,29 @@
* Denotes the profile type.
*/
@Retention(RetentionPolicy.SOURCE)
- @IntDef({PERSONAL, WORK, ALL})
+ @IntDef({
+ ProfileType.PERSONAL,
+ ProfileType.WORK,
+ ProfileType.ALL
+ })
public @interface ProfileType {
+ /**
+ * It is personal work profile.
+ */
+ int PERSONAL = 1;
+
+ /**
+ * It is work profile
+ */
+ int WORK = 1 << 1;
+
+ /**
+ * It is personal and work profile
+ */
+ int ALL = PERSONAL | WORK;
}
/**
- * It is personal work profile.
- */
- public static final int PERSONAL = 1;
-
- /**
- * It is work profile
- */
- public static final int WORK = 1 << 1;
-
- /**
- * It is personal and work profile
- */
- public static final int ALL = PERSONAL | WORK;
-
- /**
* Used in fragment argument and pass {@link ProfileType} to it
*/
public static final String EXTRA_PROFILE = "profile";
diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectManageApplications.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectManageApplications.java
index a448f57..17fed11 100644
--- a/src/com/android/settings/dashboard/profileselector/ProfileSelectManageApplications.java
+++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectManageApplications.java
@@ -30,12 +30,12 @@
@Override
public Fragment[] getFragments() {
final Bundle workOnly = getArguments() != null ? getArguments().deepCopy() : new Bundle();
- workOnly.putInt(EXTRA_PROFILE, ProfileSelectFragment.WORK);
+ workOnly.putInt(EXTRA_PROFILE, ProfileSelectFragment.ProfileType.WORK);
final Fragment workFragment = new ManageApplications();
workFragment.setArguments(workOnly);
final Bundle personalOnly = getArguments() != null ? getArguments() : new Bundle();
- personalOnly.putInt(EXTRA_PROFILE, ProfileSelectFragment.PERSONAL);
+ personalOnly.putInt(EXTRA_PROFILE, ProfileSelectFragment.ProfileType.PERSONAL);
final Fragment personalFragment = new ManageApplications();
personalFragment.setArguments(personalOnly);
return new Fragment[]{
diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectStorageFragment.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectStorageFragment.java
index c204ad4..bb39cdb 100644
--- a/src/com/android/settings/dashboard/profileselector/ProfileSelectStorageFragment.java
+++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectStorageFragment.java
@@ -37,7 +37,7 @@
final Bundle storageBundle = new Bundle();
storageBundle.putString(VolumeInfo.EXTRA_VOLUME_ID, VolumeInfo.ID_PRIVATE_INTERNAL);
- storageBundle.putInt(EXTRA_PROFILE, ProfileSelectFragment.PERSONAL);
+ storageBundle.putInt(EXTRA_PROFILE, ProfileSelectFragment.ProfileType.PERSONAL);
final Fragment storageDashboardFragment = new StorageDashboardFragment();
storageDashboardFragment.setArguments(storageBundle);
diff --git a/src/com/android/settings/deviceinfo/StorageDashboardFragment.java b/src/com/android/settings/deviceinfo/StorageDashboardFragment.java
index b36ad43..bbd87ab 100644
--- a/src/com/android/settings/deviceinfo/StorageDashboardFragment.java
+++ b/src/com/android/settings/deviceinfo/StorageDashboardFragment.java
@@ -87,7 +87,7 @@
StorageManager sm = activity.getSystemService(StorageManager.class);
mVolume = Utils.maybeInitializeVolume(sm, getArguments());
mPersonalOnly = getArguments().getInt(ProfileSelectFragment.EXTRA_PROFILE)
- == ProfileSelectFragment.PERSONAL;
+ == ProfileSelectFragment.ProfileType.PERSONAL;
if (mVolume == null) {
activity.finish();
return;
diff --git a/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java b/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java
index 164eca7..1f58ea9 100644
--- a/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java
+++ b/src/com/android/settings/deviceinfo/storage/StorageItemPreferenceController.java
@@ -405,7 +405,8 @@
} else {
final Bundle args = new Bundle(2 + additionalCapacity);
args.putInt(ProfileSelectFragment.EXTRA_PROFILE,
- mIsWorkProfile ? ProfileSelectFragment.WORK : ProfileSelectFragment.ALL);
+ mIsWorkProfile ? ProfileSelectFragment.ProfileType.WORK
+ : ProfileSelectFragment.ProfileType.ALL);
args.putInt(ManageApplications.EXTRA_WORK_ID, mUserId);
return args;
}