Remove phone information for a secondary user

Default phone information is not available for a secondary
user and when accessed using service command *#*#INFO#*#*,
it causes crash in Settings. Removed the preference for a
secondary user.

To verify:
1. Add user(slide down status bar>user icon>Add user>
   OK>finish the setup guide).
2. As new user launch Phone app>input “*#*#4636#*#*”>
   tap Phone information>check
Causes Settings to crash with:
  Caused by: java.lang.IllegalStateException: Default phones haven't been made yet!
  at com.android.internal.telephony.PhoneFactory.getDefaultPhone(PhoneFactory.java:214)
  at com.android.settings.RadioInfo.onCreate(RadioInfo.java:263)
  at android.app.Activity.performCreate(Activity.java:5990)
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278)

Change-Id: Ie23107c5eead04183cfd8b5460a9a7a3426a99b8
This commit is contained in:
Raju Yadav
2015-04-29 11:04:49 +02:00
committed by Johan Redestig
parent a9657f553d
commit 05fb069d65
2 changed files with 10 additions and 1 deletions

View File

@@ -18,7 +18,8 @@
android:title="@string/testing" >
<PreferenceScreen
android:title="@string/testing_phone_info">
android:title="@string/testing_phone_info"
android:key="radio_info_settings">
<intent android:action="android.intent.action.MAIN"
android:targetPackage="com.android.settings"
android:targetClass="com.android.settings.RadioInfo" />

View File

@@ -17,7 +17,9 @@
package com.android.settings;
import android.os.Bundle;
import android.os.UserHandle;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
public class TestingSettings extends PreferenceActivity {
@@ -26,6 +28,12 @@ public class TestingSettings extends PreferenceActivity {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.testing_settings);
if (UserHandle.myUserId() != UserHandle.USER_OWNER) {
PreferenceScreen preferenceScreen = (PreferenceScreen)
findPreference("radio_info_settings");
getPreferenceScreen().removePreference(preferenceScreen);
}
}
}