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

Commit bd247ade authored by Ethan Chen's avatar Ethan Chen Committed by Ricardo Cerqueira
Browse files

Fix showing owner info creation from UserTile if no owner is set

* Turns out the default user will always be present, meaning a check of
  user count == 0 fails.

Change-Id: Id8e8e75c5f51c73a60d7b9039298ecb90e572bc9
parent aba92e3c
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -46,13 +46,18 @@ public class UserTile extends QuickSettingsTile {
                final UserManager um =
                        (UserManager) mContext.getSystemService(Context.USER_SERVICE);
                int numUsers = um.getUsers(true).size();
                if (numUsers == 0) {
                if (numUsers <= 1) {
                    final Cursor cursor = mContext.getContentResolver().query(
                            Profile.CONTENT_URI, null, null, null, null);
                    if (cursor.moveToNext() && !cursor.isNull(0)) {
                        Intent intent = new Intent(Intent.ACTION_VIEW, ContactsContract.Profile.CONTENT_URI);
                        startSettingsActivity(intent);
                    } else {
                        Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI);
                        intent.putExtra(INTENT_EXTRA_NEW_LOCAL_PROFILE, true);
                        startSettingsActivity(intent);
                } else if (numUsers == 1) {
                    Intent intent = new Intent(Intent.ACTION_VIEW, ContactsContract.Profile.CONTENT_URI);
                    startSettingsActivity(intent);
                    }
                    cursor.close();
                } else {
                    try {
                        WindowManagerGlobal.getWindowManagerService().lockNow(