Android进入setting-connected devices后,设备无响应,出现ANR。
报错的log提到了print,时候由于设备不支持打印功能导致,因此需屏蔽setting中的print。而在connected devices的xml中没有找到对应的print相关preference,因此判断是在AndroidManifest.xml中定义的。 com.android.settings.category.ia.device表示是在device下。
<activity android:name="Settings$PrintSettingsActivity"
android:label="@string/print_settings"
android:icon="@drawable/ic_settings_print"
android:taskAffinity="com.android.settings"
android:parentActivityName="Settings">
<intent-filter android:priority="1">
<action android:name="android.settings.ACTION_PRINT_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<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>
<intent-filter android:priority="2">
<action android:name="com.android.settings.action.SETTINGS" />
</intent-filter>
<meta-data android:name="com.android.settings.category"
android:value="com.android.settings.category.ia.device" />
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.print.PrintSettingsFragment" />
</activity>
解决办法,屏蔽intent-filter和meta-data等节点。
<activity android:name="Settings$PrintSettingsActivity"
android:label="@string/print_settings"
android:icon="@drawable/ic_settings_print"
android:taskAffinity="com.android.settings"
android:parentActivityName="Settings">
<!-- <intent-filter android:priority="1">
<action android:name="android.settings.ACTION_PRINT_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<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>
<intent-filter android:priority="2">
<action android:name="com.android.settings.action.SETTINGS" />
</intent-filter>
<meta-data android:name="com.android.settings.category"
android:value="com.android.settings.category.ia.device" />
<meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.print.PrintSettingsFragment" />-->
</activity>
网友评论