BuildNumberPreferenceControllerTest converted to JUnit
UserManager spy used instead of ShadowUserManager. ArgumentCaptor used for ClipData rather than getting the primary clip. Test: atest -c BuildNumberPreferenceControllerTest Change-Id: Idd9e93371f1abda7bf9169ee86116fb7efb9ca09
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package com.android.settings.deviceinfo;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.app.settings.SettingsEnums;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
@@ -29,6 +30,7 @@ import android.text.BidiFormatter;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.Preference;
|
||||
|
||||
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
|
||||
@@ -112,7 +114,7 @@ public class BuildNumberPreferenceController extends BasePreferenceController im
|
||||
if (!TextUtils.equals(preference.getKey(), getPreferenceKey())) {
|
||||
return false;
|
||||
}
|
||||
if (Utils.isMonkeyRunning()) {
|
||||
if (isUserAMonkey()) {
|
||||
return false;
|
||||
}
|
||||
// Don't enable developer options for secondary non-demo users.
|
||||
@@ -245,4 +247,9 @@ public class BuildNumberPreferenceController extends BasePreferenceController im
|
||||
Toast.LENGTH_LONG);
|
||||
mDevHitToast.show();
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
protected boolean isUserAMonkey() {
|
||||
return ActivityManager.isUserAMonkey();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user