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

Commit b8151ecd authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Add an icon to the user information.

Store the icon in the user folder under /data/system,
similar to how the wallpaper is stored.

Change-Id: Id8ccb55b9e2ba7b4c557505a7f69f04eca1518cf
parent 1c1ca050
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -1206,7 +1206,8 @@ final class ApplicationPackageManager extends PackageManager {
            return mPM.getUsers();
            return mPM.getUsers();
        } catch (RemoteException re) {
        } catch (RemoteException re) {
            ArrayList<UserInfo> users = new ArrayList<UserInfo>();
            ArrayList<UserInfo> users = new ArrayList<UserInfo>();
            UserInfo primary = new UserInfo(0, "Root!", UserInfo.FLAG_ADMIN | UserInfo.FLAG_PRIMARY);
            UserInfo primary = new UserInfo(0, "Root!", null,
                    UserInfo.FLAG_ADMIN | UserInfo.FLAG_PRIMARY);
            users.add(primary);
            users.add(primary);
            return users;
            return users;
        }
        }
@@ -1240,9 +1241,9 @@ final class ApplicationPackageManager extends PackageManager {
     * @hide
     * @hide
     */
     */
    @Override
    @Override
    public void updateUserName(int id, String name) {
    public void setUserName(int id, String name) {
        try {
        try {
            mPM.updateUserName(id, name);
            mPM.setUserName(id, name);
        } catch (RemoteException re) {
        } catch (RemoteException re) {
        }
        }
    }
    }
+3 −1
Original line number Original line Diff line number Diff line
@@ -41,6 +41,7 @@ import android.content.pm.ServiceInfo;
import android.content.pm.UserInfo;
import android.content.pm.UserInfo;
import android.content.pm.VerifierDeviceIdentity;
import android.content.pm.VerifierDeviceIdentity;
import android.net.Uri;
import android.net.Uri;
import android.os.ParcelFileDescriptor;
import android.content.IntentSender;
import android.content.IntentSender;


/**
/**
@@ -359,7 +360,8 @@ interface IPackageManager {


    UserInfo createUser(in String name, int flags);
    UserInfo createUser(in String name, int flags);
    boolean removeUser(int userId);
    boolean removeUser(int userId);
    void updateUserName(int userId, String name);
    void setUserName(int userId, String name);
    ParcelFileDescriptor setUserIcon(int userId);


    void installPackageWithVerification(in Uri packageURI, in IPackageInstallObserver observer,
    void installPackageWithVerification(in Uri packageURI, in IPackageInstallObserver observer,
            int flags, in String installerPackageName, in Uri verificationURI,
            int flags, in String installerPackageName, in Uri verificationURI,
+1 −1
Original line number Original line Diff line number Diff line
@@ -2646,7 +2646,7 @@ public abstract class PackageManager {
     * @param name the new name for the user
     * @param name the new name for the user
     * @hide
     * @hide
     */
     */
    public abstract void updateUserName(int id, String name);
    public abstract void setUserName(int id, String name);


    /**
    /**
     * Changes the user's properties specified by the flags.
     * Changes the user's properties specified by the flags.
+9 −0
Original line number Original line Diff line number Diff line
@@ -43,12 +43,18 @@ public class UserInfo implements Parcelable {


    public int id;
    public int id;
    public String name;
    public String name;
    public String iconPath;
    public int flags;
    public int flags;


    public UserInfo(int id, String name, int flags) {
    public UserInfo(int id, String name, int flags) {
        this(id, name, null, flags);
    }

    public UserInfo(int id, String name, String iconPath, int flags) {
        this.id = id;
        this.id = id;
        this.name = name;
        this.name = name;
        this.flags = flags;
        this.flags = flags;
        this.iconPath = iconPath;
    }
    }


    public boolean isPrimary() {
    public boolean isPrimary() {
@@ -68,6 +74,7 @@ public class UserInfo implements Parcelable {


    public UserInfo(UserInfo orig) {
    public UserInfo(UserInfo orig) {
        name = orig.name;
        name = orig.name;
        iconPath = orig.iconPath;
        id = orig.id;
        id = orig.id;
        flags = orig.flags;
        flags = orig.flags;
    }
    }
@@ -84,6 +91,7 @@ public class UserInfo implements Parcelable {
    public void writeToParcel(Parcel dest, int parcelableFlags) {
    public void writeToParcel(Parcel dest, int parcelableFlags) {
        dest.writeInt(id);
        dest.writeInt(id);
        dest.writeString(name);
        dest.writeString(name);
        dest.writeString(iconPath);
        dest.writeInt(flags);
        dest.writeInt(flags);
    }
    }


@@ -100,6 +108,7 @@ public class UserInfo implements Parcelable {
    private UserInfo(Parcel source) {
    private UserInfo(Parcel source) {
        id = source.readInt();
        id = source.readInt();
        name = source.readString();
        name = source.readString();
        iconPath = source.readString();
        flags = source.readInt();
        flags = source.readInt();
    }
    }
}
}
+3 −3
Original line number Original line Diff line number Diff line
@@ -27,11 +27,11 @@
    android:paddingBottom="6dip"
    android:paddingBottom="6dip"
    >
    >
    <ImageView android:id="@+id/icon"
    <ImageView android:id="@+id/icon"
        android:layout_width="wrap_content"
        android:layout_width="56dp"
        android:layout_height="match_parent"
        android:layout_height="56dp"
        android:layout_gravity="center"
        android:layout_gravity="center"
        android:layout_marginRight="16dip"
        android:layout_marginRight="16dip"
        />
        android:scaleType="center"/>


    <LinearLayout
    <LinearLayout
        android:orientation="vertical"
        android:orientation="vertical"
Loading