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

Commit 9ce7bad9 authored by Bonian Chen's avatar Bonian Chen Committed by Android (Google) Code Review
Browse files

Merge "[Settings] Code refactor"

parents 976dca21 f399bd1a
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -372,7 +372,7 @@ public final class Utils extends com.android.settingslib.Utils {
    }

    public static boolean hasMultipleUsers(Context context) {
        return ((UserManager) context.getSystemService(Context.USER_SERVICE))
        return context.getSystemService(UserManager.class)
                .getUsers().size() > 1;
    }

@@ -666,7 +666,7 @@ public final class Utils extends com.android.settingslib.Utils {
     * @throws SecurityException if the given userId does not belong to the current user group.
     */
    public static int enforceSameOwner(Context context, int userId) {
        final UserManager um = UserManager.get(context);
        final UserManager um = context.getSystemService(UserManager.class);
        final int[] profileIds = um.getProfileIdsWithDisabled(UserHandle.myUserId());
        if (ArrayUtils.contains(profileIds, userId)) {
            return userId;
@@ -686,7 +686,7 @@ public final class Utils extends com.android.settingslib.Utils {
     * Returns the user id of the credential owner of the given user id.
     */
    public static int getCredentialOwnerUserId(Context context, int userId) {
        final UserManager um = UserManager.get(context);
        final UserManager um = context.getSystemService(UserManager.class);
        return um.getCredentialOwnerProfile(userId);
    }

@@ -823,7 +823,8 @@ public final class Utils extends com.android.settingslib.Utils {
    }

    public static boolean isDemoUser(Context context) {
        return UserManager.isDeviceInDemoMode(context) && UserManager.get(context).isDemoUser();
        return UserManager.isDeviceInDemoMode(context)
                && context.getSystemService(UserManager.class).isDemoUser();
    }

    public static ComponentName getDeviceOwnerComponent(Context context) {
@@ -1051,7 +1052,7 @@ public final class Utils extends com.android.settingslib.Utils {
        final boolean isWork = args != null ? args.getInt(ProfileSelectFragment.EXTRA_PROFILE)
                == ProfileSelectFragment.ProfileType.WORK : false;
        if (FeatureFlagUtils.isEnabled(activity, FeatureFlags.PERSONAL_WORK_PROFILE)
                && UserManager.get(activity).getUserProfiles().size() > 1
                && activity.getSystemService(UserManager.class).getUserProfiles().size() > 1
                && ProfileFragmentBridge.FRAGMENT_MAP.get(fragmentName) != null
                && !isWork && !isPersonal) {
            f = Fragment.instantiate(activity, ProfileFragmentBridge.FRAGMENT_MAP.get(fragmentName),
+1 −1
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ public final class CellInfoUtil {
    /**
     * Returns the title of the network obtained in the manual search.
     *
     * @param cellId contains the information of the network.
     * @param cellId contains the identity of the network.
     * @param networkMccMnc contains the MCCMNC string of the network
     * @return Long Name if not null/empty, otherwise Short Name if not null/empty,
     * else MCCMNC string.