Don't create if not primary user
PhoneGlobals is instantiated only for primary users so check for
attempts to bring up this settings screen for non-primary users.
Bug:18354968
Change-Id: I449287603de51c7a42fc3ca27b8b46681129f6bb
diff --git a/res/values/strings.xml b/res/values/strings.xml
index fabb30b..db68ecb 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -264,6 +264,8 @@
<!-- Title of the progress dialog displayed while updating Call settings -->
<string name="updating_title">Call settings</string>
+ <!-- Toast in Call settings when asked to launch settings for a secondary user -->
+ <string name="call_settings_primary_user_only">Call settings can only be changed by the primary user.</string>
<!-- Title of the "Call settings" settings screen, with a text label identifying which SIM the settings are for. -->
<string name="call_settings_with_label">Call settings (<xliff:g id="subscriptionlabel" example="Verizon">%s</xliff:g>)</string>
<!-- Title of the alert dialog displayed if an error occurs while updating Call settings -->
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 2755bd7..7e670aa 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -52,6 +52,7 @@
import android.util.Log;
import android.view.MenuItem;
import android.widget.ListAdapter;
+import android.widget.Toast;
import com.android.ims.ImsManager;
import com.android.internal.telephony.CallForwardInfo;
@@ -1123,6 +1124,14 @@
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,
+ Toast.LENGTH_SHORT).show();
+ finish();
+ return;
+ }
+
mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
mVmProviderSettingsUtil = new VoicemailProviderSettingsUtil(getApplicationContext());