am 910adb11: Merge "Throw an exception if isValidFragment is not overridden for KK targets" into klp-dev

* commit '910adb11abc84bf4a113ac130c3998082cc84294':
  Throw an exception if isValidFragment is not overridden for KK targets
This commit is contained in:
Amith Yamasani
2013-09-09 09:45:10 -07:00
committed by Android Git Automerger

View File

@@ -894,14 +894,11 @@ public abstract class PreferenceActivity extends ListActivity implements
*/ */
protected boolean isValidFragment(String fragmentName) { protected boolean isValidFragment(String fragmentName) {
if (getApplicationInfo().targetSdkVersion >= android.os.Build.VERSION_CODES.KITKAT) { if (getApplicationInfo().targetSdkVersion >= android.os.Build.VERSION_CODES.KITKAT) {
Log.w(TAG, "Subclasses of PreferenceActivity must override isValidFragment(String)" throw new RuntimeException(
"Subclasses of PreferenceActivity must override isValidFragment(String)"
+ " to verify that the Fragment class is valid! " + this.getClass().getName() + " to verify that the Fragment class is valid! " + this.getClass().getName()
+ " has not checked if fragment " + fragmentName + " is valid."); + " has not checked if fragment " + fragmentName + " is valid.");
// Return true for now, but will eventually return false when all bundled apps
// have been modified. TODO: change to return false
return true;
} else { } else {
Log.i(TAG, "PreferenceActivity built on pre-KLP launching fragment: " + fragmentName);
return true; return true;
} }
} }