OSDN Git Service

Various small crash fixes and guards
authorJason Monk <jmonk@google.com>
Tue, 10 Nov 2015 20:22:57 +0000 (15:22 -0500)
committerJason Monk <jmonk@google.com>
Tue, 10 Nov 2015 20:43:54 +0000 (15:43 -0500)
Bug: 25501551
Bug: 25583654
Bug: 25510495
Bug: 23575961
Change-Id: Id0e7f6aacdf763bf95b49d281aa8755afcd2e5ef

AndroidManifest.xml
src/com/android/settings/accessibility/AccessibilitySettings.java
src/com/android/settings/dashboard/DashboardSummary.java
src/com/android/settings/nfc/PaymentSettings.java

index b71e964..774cb45 100644 (file)
                 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"
             </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"
index 870cb20..b2ccdd1 100644 (file)
@@ -22,7 +22,6 @@ import android.app.admin.DevicePolicyManager;
 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.text.TextUtils;
 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 @@ public class AccessibilitySettings extends SettingsPreferenceFragment implements
     private final Runnable mUpdateRunnable = new Runnable() {
         @Override
         public void run() {
-            updateServicesPreferences();
+            if (getActivity() != null) {
+                updateServicesPreferences();
+            }
         }
     };
 
index 6f10ac6..a771400 100644 (file)
@@ -88,6 +88,7 @@ public class DashboardSummary extends InstrumentedFragment {
     @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());
     }
index c0f3ff7..b03a9ef 100644 (file)
@@ -25,11 +25,9 @@ import android.view.MenuInflater;
 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 @@ public class PaymentSettings extends SettingsPreferenceFragment {
 
         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 @@ public class PaymentSettings extends SettingsPreferenceFragment {
     }
 
     @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();