Various small crash fixes and guards
Bug: 25501551
Bug: 25583654
Bug: 25510495
Bug: 23575961
Change-Id: Id0e7f6aacdf763bf95b49d281aa8755afcd2e5ef
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index b71e964..774cb45 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -382,16 +382,6 @@
android:value="true" />
</activity>
- <!-- Suspect activity alias: targetActivity is Settings itself, does not define a name. Remove? -->
- <activity-alias android:name=".wifi.WifiApSettings"
- android:targetActivity="Settings">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.DEFAULT" />
- <category android:name="android.intent.category.VOICE_LAUNCH" />
- </intent-filter>
- </activity-alias>
-
<!-- Runs in the phone process since it needs access to UiccController -->
<activity android:name="Settings$ApnSettingsActivity"
android:label="@string/apn_settings"
@@ -1948,17 +1938,6 @@
</intent-filter>
</activity>
- <!-- Suspect activity alias: targetActivity is Settings itself, does not define a name. Remove? -->
- <activity-alias android:name="ProxySelector"
- android:label="@string/proxy_settings_label"
- android:targetActivity="Settings">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.DEFAULT" />
- <category android:name="android.intent.category.VOICE_LAUNCH" />
- </intent-filter>
- </activity-alias>
-
<!-- TODO: Is this needed? -->
<activity android:name="BandMode"
android:theme="@android:style/Theme.Dialog"
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index 870cb20..b2ccdd1 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -22,7 +22,6 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
import android.content.pm.ServiceInfo;
import android.content.res.Configuration;
import android.net.Uri;
@@ -41,7 +40,6 @@
import android.view.KeyCharacterMap;
import android.view.KeyEvent;
import android.view.accessibility.AccessibilityManager;
-
import com.android.internal.content.PackageMonitor;
import com.android.internal.logging.MetricsLogger;
import com.android.internal.view.RotationPolicy;
@@ -127,7 +125,9 @@
private final Runnable mUpdateRunnable = new Runnable() {
@Override
public void run() {
- updateServicesPreferences();
+ if (getActivity() != null) {
+ updateServicesPreferences();
+ }
}
};
diff --git a/src/com/android/settings/dashboard/DashboardSummary.java b/src/com/android/settings/dashboard/DashboardSummary.java
index 6f10ac6..a771400 100644
--- a/src/com/android/settings/dashboard/DashboardSummary.java
+++ b/src/com/android/settings/dashboard/DashboardSummary.java
@@ -88,6 +88,7 @@
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
super.onCreateOptionsMenu(menu, inflater);
+ if (getActivity() == null) return;
HelpUtils.prepareHelpMenuItem(getActivity(), menu, R.string.help_uri_dashboard,
getClass().getName());
}
diff --git a/src/com/android/settings/nfc/PaymentSettings.java b/src/com/android/settings/nfc/PaymentSettings.java
index c0f3ff7..b03a9ef 100644
--- a/src/com/android/settings/nfc/PaymentSettings.java
+++ b/src/com/android/settings/nfc/PaymentSettings.java
@@ -25,11 +25,9 @@
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
-
import com.android.internal.logging.MetricsLogger;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
-import com.android.settings.nfc.PaymentBackend.PaymentAppInfo;
import java.util.List;
@@ -48,21 +46,11 @@
mPaymentBackend = new PaymentBackend(getActivity());
setHasOptionsMenu(true);
- }
-
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- super.onViewCreated(view, savedInstanceState);
- ViewGroup contentRoot = (ViewGroup) getListView().getParent();
- View emptyView = getActivity().getLayoutInflater().inflate(
- R.layout.nfc_payment_empty, contentRoot, false);
- contentRoot.addView(emptyView);
- setEmptyView(emptyView);
PreferenceManager manager = getPreferenceManager();
PreferenceScreen screen = manager.createPreferenceScreen(getActivity());
- List<PaymentAppInfo> appInfos = mPaymentBackend.getPaymentAppInfos();
+ List<PaymentBackend.PaymentAppInfo> appInfos = mPaymentBackend.getPaymentAppInfos();
if (appInfos != null && appInfos.size() > 0) {
NfcPaymentPreference preference =
new NfcPaymentPreference(getPrefContext(), mPaymentBackend);
@@ -76,6 +64,16 @@
}
@Override
+ public void onViewCreated(View view, Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ ViewGroup contentRoot = (ViewGroup) getListView().getParent();
+ View emptyView = getActivity().getLayoutInflater().inflate(
+ R.layout.nfc_payment_empty, contentRoot, false);
+ contentRoot.addView(emptyView);
+ setEmptyView(emptyView);
+ }
+
+ @Override
public void onResume() {
super.onResume();
mPaymentBackend.onResume();