Skip to content
This repository was archived by the owner on Mar 24, 2023. It is now read-only.

Commit 17ff9a9

Browse files
About Kernel: Show menu only if it is provided by the developer
Signed-off-by: sunilpaulmathew <sunil.kde@gmail.com>
1 parent 18d072e commit 17ff9a9

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

app/src/main/java/com/smartpack/kernelprofiler/MainActivity.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@ private void settingsMenu() {
141141
Menu menu = popupMenu.getMenu();
142142
menu.add(Menu.NONE, 1, Menu.NONE, getString(R.string.dark_theme)).setCheckable(true).setChecked(
143143
Prefs.getBoolean("dark_theme", true, this));
144-
if (KP.supported()) {
144+
if (KP.supported() && KP.isCustomSettingsAvailable()) {
145145
SubMenu kernel = menu.addSubMenu(Menu.NONE, 0, Menu.NONE, getString(R.string.kernel_about));
146-
if (KP.getSupport() != null) {
146+
if (KP.getSupport() != null && !KP.getSupport().isEmpty()) {
147147
kernel.add(Menu.NONE, 2, Menu.NONE, getString(R.string.support));
148148
}
149-
if (KP.getDonation() != null) {
149+
if (KP.getDonation() != null && !KP.getDonation().isEmpty()) {
150150
kernel.add(Menu.NONE, 3, Menu.NONE, getString(R.string.donations));
151151
}
152152
}

app/src/main/java/com/smartpack/kernelprofiler/utils/KP.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,10 @@ public static boolean isKPProfile(String file) {
131131
return Utils.getExtension(file).equals("sh") && readProfile(file).startsWith("#!/system/bin/sh");
132132
}
133133

134+
public static boolean isCustomSettingsAvailable() {
135+
return getSupport() != null && !getSupport().isEmpty() || getDonation() != null && !getDonation().isEmpty();
136+
}
137+
134138
public static boolean supported() {
135139
return Utils.existFile(KP_CONFIG) && getCustomTitle() != null &&
136140
RootUtils.runAndGetOutput("uname -a").contains(getCustomTitle());

0 commit comments

Comments
 (0)