am 3501f858: Merge "Don\'t create if not primary user" into lmp-mr1-dev
* commit '3501f858cc014d19faa97cdf2ca837e7319e1c34':
Don't create if not primary user
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 6476f50..23f44e3 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());