Add isHeadlessSystemUserMode() to UserManager
- isHeadlessSystemUserMode() returns whether the device is running with
headless system user (go/multi-user-headless-user0)
- RoSystemProperties.MULTIUSER_HEADLESS_SYSTEM_USER is replaced by
isHeadlessSystemUserMode()
Bug: 137755681
Test: Bluetooth service and Network policy manager should work fine with
headless system user. A profile user should be created with headless
system user.
Change-Id: Ic48d98426f7a5ea47dde2008ae51f78855f622e6
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
index 5530b51..b4a8099 100644
--- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
+++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java
@@ -217,7 +217,6 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.messages.nano.SystemMessageProto.SystemMessage;
import com.android.internal.notification.SystemNotificationChannels;
-import com.android.internal.os.RoSystemProperties;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.util.ArrayUtils;
import com.android.internal.util.ConcurrentUtils;
@@ -1354,7 +1353,7 @@
final Intent viewIntent = buildViewDataUsageIntent(res, policy.template);
// TODO: Resolve to single code path.
- if (isHeadlessSystemUserBuild()) {
+ if (UserManager.isHeadlessSystemUserMode()) {
builder.setContentIntent(PendingIntent.getActivityAsUser(
mContext, 0, viewIntent, PendingIntent.FLAG_UPDATE_CURRENT,
/* options= */ null, UserHandle.CURRENT));
@@ -1382,7 +1381,7 @@
final Intent intent = buildNetworkOverLimitIntent(res, policy.template);
// TODO: Resolve to single code path.
- if (isHeadlessSystemUserBuild()) {
+ if (UserManager.isHeadlessSystemUserMode()) {
builder.setContentIntent(PendingIntent.getActivityAsUser(
mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT,
/* options= */ null, UserHandle.CURRENT));
@@ -1413,7 +1412,7 @@
final Intent intent = buildViewDataUsageIntent(res, policy.template);
// TODO: Resolve to single code path.
- if (isHeadlessSystemUserBuild()) {
+ if (UserManager.isHeadlessSystemUserMode()) {
builder.setContentIntent(PendingIntent.getActivityAsUser(
mContext, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT,
/* options= */ null, UserHandle.CURRENT));
@@ -1440,7 +1439,7 @@
final Intent viewIntent = buildViewDataUsageIntent(res, policy.template);
// TODO: Resolve to single code path.
- if (isHeadlessSystemUserBuild()) {
+ if (UserManager.isHeadlessSystemUserMode()) {
builder.setContentIntent(PendingIntent.getActivityAsUser(
mContext, 0, viewIntent, PendingIntent.FLAG_UPDATE_CURRENT,
/* options= */ null, UserHandle.CURRENT));
@@ -5301,10 +5300,6 @@
return (bundle != null) ? bundle.getBoolean(key, defaultValue) : defaultValue;
}
- private static boolean isHeadlessSystemUserBuild() {
- return RoSystemProperties.MULTIUSER_HEADLESS_SYSTEM_USER;
- }
-
private class NotificationId {
private final String mTag;
private final int mId;