Merge "Fix NPE if default supervisor is not defined" am: 9bc3b6a207 am: 4d93ad694b

Change-Id: Ibb53d7709aab6f98d61045a5745fd0d52d108346
This commit is contained in:
Edgar Wang
2020-05-28 06:59:05 +00:00
committed by Automerger Merge Worker

View File

@@ -288,7 +288,7 @@ public class DeviceAdminAdd extends Activity {
// setup.
final String supervisor = getString(
com.android.internal.R.string.config_defaultSupervisionProfileOwnerComponent);
if (supervisor == null) {
if (TextUtils.isEmpty(supervisor)) {
Log.w(TAG, "Unable to set profile owner post-setup, no default supervisor"
+ "profile owner defined");
finish();
@@ -297,7 +297,7 @@ public class DeviceAdminAdd extends Activity {
final ComponentName supervisorComponent = ComponentName.unflattenFromString(
supervisor);
if (who.compareTo(supervisorComponent) != 0) {
if (supervisorComponent == null || who.compareTo(supervisorComponent) != 0) {
Log.w(TAG, "Unable to set non-default profile owner post-setup " + who);
finish();
return;