android – 为什么Kit Kat需要使用isValidFragment?

前端之家收集整理的这篇文章主要介绍了android – 为什么Kit Kat需要使用isValidFragment?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
自从KitKat发布以来,我注意到我的一些应用程序更新了“修复Kit Kat的崩溃”.最近,当我发布自己的应用程序时,我发现可能的来源是使用偏好活动的新的“isValidFragment”要求.然而,我无法让任何人解释为什么这个新课程突然需要验证片段.任何人都可以提供一个解释为什么需要这样做?

解决方法

子类应该覆盖此方法,并验证给定的片段是否附加到此活动的有效类型.对于为KITKAT之前的 android:targetSdkVersion构建的应用程序,默认实现为true.对于以后的版本,它会抛出异常.

A New Vulnerability in the Android Framework: Fragment Injection
We have recently disclosed a new vulnerability to the Android Security
Team. The vulnerability affected many apps,including Settings (the
one that is found on every Android device),Gmail,Google Now,DropBox
and Evernote. To be more accurate,any App which extended the
PreferenceActivity class using an exported activity was automatically
vulnerable. A patch has been provided in Android KitKat. If you
wondered why your code is now broken,it is due to the Android KitKat
patch which requires applications to override the new method,
PreferenceActivity.isValidFragment,which has been added to the
Android Framework.

http://securityintelligence.com/new-vulnerability-android-framework-fragment-injection/
http://securityintelligence.com/wp-content/uploads/2013/12/android-collapses-into-fragments.pdf

原文链接:https://www.f2er.com/android/311547.html

猜你在找的Android相关文章