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

Commit 6bf70fdc authored by Zhu Youhua's avatar Zhu Youhua Committed by Gerrit - the friendly Code Review server
Browse files

Settings: Fix Diagnostics setting crash issue.

Diagnostics will crash when tmo account apk have been removed.

Check tmo acount package whether it is exist.

Change-Id: Id7b54abf1766ffaf246bca99efdb483abcb99630
CRs-Fixed: 1062717
parent 0b417d6b
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -298,6 +298,15 @@ public class PrivacySettings extends SettingsPreferenceFragment implements Index
    }

    private static boolean collectDiagnosticsEnabled(Context context) {
        return context.getResources().getBoolean(R.bool.config_collect_diagnostics_enabled);
        if (!context.getResources().getBoolean(R.bool.config_collect_diagnostics_enabled)) {
            return false;
        }

        try {
            return context.getPackageManager().getPackageInfo(
                    "com.tmobile.pr.mytmobile", 0) != null;
        } catch(PackageManager.NameNotFoundException e) {
            return false;
        }
    }
}