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

Commit 5e2c8840 authored by Bookatz's avatar Bookatz
Browse files

Do not use empty UserInfo constructor

The UserInfo() constructor is not safe, since it does not set the
mandatory fields. It should not be used. Right now it is used in some
tests, so we cannot remove it yet. But we mark that it should not
be used.

Test: N/A (just comments/annotations)
Bug: 142482943
Change-Id: I2f70a8d372c2e2bcd0e136cfe7ff76f9756dddeb
parent db644b95
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ import android.os.UserHandle;
import android.os.UserManager;
import android.util.DebugUtils;

import com.android.internal.annotations.VisibleForTesting;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@@ -385,6 +387,13 @@ public class UserInfo implements Parcelable {
        }
    }

    // TODO(b/142482943): Get rid of this (after removing it from all tests) if feasible.
    /**
     * @deprecated This is dangerous since it doesn't set the mandatory fields. Use a different
     * constructor instead.
     */
    @Deprecated
    @VisibleForTesting
    public UserInfo() {
    }