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

Commit b9f85a5e authored by Steve Statia's avatar Steve Statia Committed by Android (Google) Code Review
Browse files

Merge "Get the userId from context instead of getting the UserHandle from the Process." into main

parents e238e8d6 17159c2e
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Process;
import android.os.UserHandle;
import android.os.UserManager;
import android.telephony.TelephonyManager;
@@ -41,9 +40,8 @@ public class TestingSettingsBroadcastReceiver extends BroadcastReceiver {
            && intent.getAction().equals(TelephonyManager.ACTION_SECRET_CODE)
            && !isDisabled(context)) {
            UserManager userManager = context.getSystemService(UserManager.class);
            UserHandle currentUser = Process.myUserHandle();
            if (userManager != null) {
                if (userManager.getUserInfo(currentUser.hashCode()).isMain()) {
                if (userManager.getUserInfo(context.getUserId()).isMain()) {
                    Intent i = new Intent(Intent.ACTION_MAIN);
                    i.setClass(context, TestingSettingsActivity.class);
                    i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
@@ -51,6 +49,8 @@ public class TestingSettingsBroadcastReceiver extends BroadcastReceiver {
                } else {
                    Log.d(TAG, "Not main user, not starting TestingSettingsActivity.");
                }
            } else {
                Log.w(TAG, "UserManager is null, not starting TestingSettingsActivity");
            }
        }
    }