Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a5001b94 authored by Amith Yamasani's avatar Amith Yamasani
Browse files

Throw an exception if isValidFragment is not overridden for KK targets

Bug: 9901133
Change-Id: I8dfe43aa90546e351f25c94579a34bb87658bf08
parent 23e2bba4
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -894,14 +894,11 @@ public abstract class PreferenceActivity extends ListActivity implements
     */
    protected boolean isValidFragment(String fragmentName) {
        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()
                    + " 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 {
            Log.i(TAG, "PreferenceActivity built on pre-KLP launching fragment: " + fragmentName);
            return true;
        }
    }