clean up USER_OWNER in telephony service

Change-Id: I188c7fe3e38691979b5431a4efc68b5206d1c02e
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 00c9170..895c685 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -30,6 +30,7 @@
 import android.os.Bundle;
 import android.os.PersistableBundle;
 import android.os.UserHandle;
+import android.os.UserManager;
 import android.preference.CheckBoxPreference;
 import android.preference.ListPreference;
 import android.preference.Preference;
@@ -171,9 +172,9 @@
         super.onCreate(icicle);
         if (DBG) log("onCreate: Intent is " + getIntent());
 
-        // Make sure we are running as the primary user.
-        if (UserHandle.myUserId() != UserHandle.USER_OWNER) {
-            Toast.makeText(this, R.string.call_settings_primary_user_only,
+        // Make sure we are running as an admin user.
+        if (!UserManager.get(this).isAdminUser()) {
+            Toast.makeText(this, R.string.call_settings_admin_user_only,
                     Toast.LENGTH_SHORT).show();
             finish();
             return;
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index c94bf4c..b470398 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -35,6 +35,7 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.content.pm.PackageManager.NameNotFoundException;
+import android.content.pm.UserInfo;
 import android.net.Uri;
 import android.os.AsyncResult;
 import android.os.Bundle;
@@ -704,11 +705,10 @@
             actionBar.setDisplayHomeAsUpEnabled(true);
         }
 
-        final boolean isSecondaryUser = UserHandle.myUserId() != UserHandle.USER_OWNER;
         // Enable link to CMAS app settings depending on the value in config.xml.
         final boolean isCellBroadcastAppLinkEnabled = this.getResources().getBoolean(
                 com.android.internal.R.bool.config_cellBroadcastAppLinks);
-        if (isSecondaryUser || !isCellBroadcastAppLinkEnabled
+        if (!mUm.isAdminUser() || !isCellBroadcastAppLinkEnabled
                 || mUm.hasUserRestriction(UserManager.DISALLOW_CONFIG_CELL_BROADCASTS)) {
             PreferenceScreen root = getPreferenceScreen();
             Preference ps = findPreference(BUTTON_CELL_BROADCAST_SETTINGS);
diff --git a/src/com/android/phone/OutgoingCallBroadcaster.java b/src/com/android/phone/OutgoingCallBroadcaster.java
index 1a23bc4..cfe6f32 100644
--- a/src/com/android/phone/OutgoingCallBroadcaster.java
+++ b/src/com/android/phone/OutgoingCallBroadcaster.java
@@ -635,7 +635,7 @@
         // timeout.
         mHandler.sendEmptyMessageDelayed(EVENT_OUTGOING_CALL_TIMEOUT,
                 OUTGOING_CALL_TIMEOUT_THRESHOLD);
-        sendOrderedBroadcastAsUser(broadcastIntent, UserHandle.OWNER,
+        sendOrderedBroadcastAsUser(broadcastIntent, UserHandle.SYSTEM,
                 android.Manifest.permission.PROCESS_OUTGOING_CALLS,
                 AppOpsManager.OP_PROCESS_OUTGOING_CALLS,
                 new OutgoingCallReceiver(),
diff --git a/src/com/android/phone/vvm/omtp/SimChangeReceiver.java b/src/com/android/phone/vvm/omtp/SimChangeReceiver.java
index 4e7c165..c42797a 100644
--- a/src/com/android/phone/vvm/omtp/SimChangeReceiver.java
+++ b/src/com/android/phone/vvm/omtp/SimChangeReceiver.java
@@ -19,6 +19,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.os.UserHandle;
+import android.os.UserManager;
 import android.telecom.PhoneAccountHandle;
 import android.telephony.CarrierConfigManager;
 import android.telephony.SubscriptionManager;
@@ -45,8 +46,8 @@
 
     @Override
     public void onReceive(Context context, Intent intent) {
-        if (UserHandle.myUserId() != UserHandle.USER_OWNER) {
-            Log.v(TAG, "Received broadcast for user that is not owner.");
+        if (UserHandle.myUserId() != UserHandle.USER_SYSTEM) {
+            Log.v(TAG, "Received broadcast for user that is not system.");
             return;
         }