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

Commit 77ce02c1 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove CarUserManagerHelper #getCurrentForegroundUserInfo and #getCurrentForegroundUserId"

parents 7e1c51a4 a8620804
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.statusbar.car;
import static android.content.DialogInterface.BUTTON_NEGATIVE;
import static android.content.DialogInterface.BUTTON_POSITIVE;

import android.app.ActivityManager;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.Dialog;
@@ -80,7 +81,7 @@ public class UserGridRecyclerView extends RecyclerView {
        mCarUserManagerHelper = new CarUserManagerHelper(mContext);
        mUserManager = UserManager.get(mContext);

        addItemDecoration(new ItemSpacingDecoration(context.getResources().getDimensionPixelSize(
        addItemDecoration(new ItemSpacingDecoration(mContext.getResources().getDimensionPixelSize(
                R.dimen.car_user_switcher_vertical_spacing_between_users)));
    }

@@ -140,8 +141,7 @@ public class UserGridRecyclerView extends RecyclerView {
                continue;
            }

            boolean isForeground =
                    mCarUserManagerHelper.getCurrentForegroundUserId() == userInfo.id;
            boolean isForeground = ActivityManager.getCurrentUser() == userInfo.id;
            UserRecord record = new UserRecord(userInfo, false /* isStartGuestSession */,
                    false /* isAddUser */, isForeground);
            userRecords.add(record);
@@ -159,7 +159,7 @@ public class UserGridRecyclerView extends RecyclerView {
    }

    private UserRecord createForegroundUserRecord() {
        return new UserRecord(mCarUserManagerHelper.getCurrentForegroundUserInfo(),
        return new UserRecord(mUserManager.getUserInfo(ActivityManager.getCurrentUser()),
                false /* isStartGuestSession */, false /* isAddUser */, true /* isForeground */);
    }

+2 −3
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

package com.android.systemui.statusbar.car.privacy;

import android.car.userlib.CarUserManagerHelper;
import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
@@ -38,10 +38,9 @@ public class PrivacyApplication {
    public PrivacyApplication(String packageName, Context context) {
        mPackageName = packageName;
        try {
            CarUserManagerHelper carUserManagerHelper = new CarUserManagerHelper(context);
            ApplicationInfo app = context.getPackageManager()
                    .getApplicationInfoAsUser(packageName, 0,
                            carUserManagerHelper.getCurrentForegroundUserId());
                            ActivityManager.getCurrentUser());
            mIcon = context.getPackageManager().getApplicationIcon(app);
            mApplicationName = context.getPackageManager().getApplicationLabel(app).toString();
        } catch (PackageManager.NameNotFoundException e) {