Skip to content

Commit

Permalink
Change hook methods
Browse files Browse the repository at this point in the history
  • Loading branch information
MlgmXyysd committed Feb 3, 2021
1 parent ee43dad commit 517c097
Show file tree
Hide file tree
Showing 11 changed files with 139 additions and 273 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ android {
minSdkVersion 24
//noinspection OldTargetApi
targetSdkVersion 27
versionCode 45761
versionName "4.6.0-pre"
versionCode 46000
versionName "4.6.0"
}

applicationVariants.all { variant ->
Expand Down
58 changes: 0 additions & 58 deletions app/src/main/java/de/robv/android/xposed/installer/XposedApp.java

This file was deleted.

This file was deleted.

66 changes: 66 additions & 0 deletions app/src/main/java/org/meowcat/edxposed/manager/Constants.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package org.meowcat.edxposed.manager;

import android.util.Log;

import org.meowcat.annotation.NotProguard;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

import static org.meowcat.edxposed.manager.MeowCatApplication.TAG;

@NotProguard
public class Constants {

public static int getActiveXposedVersion() {
Log.d(TAG, "Not Active");
return -1;
}

public static String getInstalledXposedVersion() {
return null;
}

public static String getBaseDir() {
return XposedApp.getInstance().getApplicationInfo().deviceProtectedDataDir + "/";
}

public static String getEnabledModulesListFile() {
return getBaseDir() + "conf/enabled_modules.list";
}

public static String getModulesListFile() {
return getBaseDir() + "conf/modules.list";
}

public static boolean isSELinuxEnforced() {
boolean result = false;
final File SELINUX_STATUS_FILE = new File("/sys/fs/selinux/enforce");
if (SELINUX_STATUS_FILE.exists()) {
try {
FileInputStream fis = new FileInputStream(SELINUX_STATUS_FILE);
int status = fis.read();
switch (status) {
case 49:
result = true;
break;
case 48:
result = false;
break;
default:
Log.e(TAG, "Unexpected byte " + status + " in /sys/fs/selinux/enforce");
}
fis.close();
} catch (IOException e) {
if (e.getMessage().contains("Permission denied")) {
result = true;
} else {
Log.e(TAG, "Failed to read SELinux status: " + e.getMessage());
result = false;
}
}
}
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import java.util.Objects;

import static android.app.Activity.RESULT_OK;
import static org.meowcat.edxposed.manager.Constants.getBaseDir;
import static org.meowcat.edxposed.manager.MeowCatApplication.TAG;
import static org.meowcat.edxposed.manager.adapter.LogsHelper.isMainUser;

Expand All @@ -59,7 +60,7 @@ public class LogsFragment extends Fragment {
private final String LOG_SUFFIX = ".log";
@SuppressWarnings("FieldCanBeLocal")
private final String LOG_OLD_SUFFIX = ".log.old";
private final String LOG_PATH = XposedApp.BASE_DIR + "log/";
private final String LOG_PATH = getBaseDir() + "log/";
private RecyclerView mRecyclerView;
private TabLayout mTabLayout;
private LogsAdapter adapter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@

import static android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS;
import static androidx.constraintlayout.widget.Constraints.TAG;
import static de.robv.android.xposed.installer.XposedApp.getActiveXposedVersion;
import static org.meowcat.edxposed.manager.Constants.getActiveXposedVersion;
import static org.meowcat.edxposed.manager.Constants.getEnabledModulesListFile;
import static org.meowcat.edxposed.manager.XposedApp.WRITE_EXTERNAL_PERMISSION;
import static org.meowcat.edxposed.manager.XposedApp.createFolder;

Expand Down Expand Up @@ -220,7 +221,7 @@ private void filter(String constraint) {
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
installedXposedVersion = XposedApp.getActiveXposedVersion();
installedXposedVersion = getActiveXposedVersion();
if (installedXposedVersion <= 0) {
addHeader();
}
Expand Down Expand Up @@ -339,7 +340,7 @@ public boolean onOptionsItemSelected(@NonNull MenuItem item) {
boolean refresh = false;
File enabledModulesPath = new File(createFolder(), "enabled_modules.list");
File installedModulesPath = new File(createFolder(), "installed_modules.list");
File listModules = new File(XposedApp.ENABLED_MODULES_LIST_FILE);
File listModules = new File(getEnabledModulesListFile());

mClickedMenuItem = item;

Expand Down Expand Up @@ -584,7 +585,7 @@ private void showMenu(@NonNull Context context,
appMenu.getMenu().removeItem(R.id.menu_support);
}
if (getActiveXposedVersion() < 92 || installedModule.packageName.equals(BuildConfig.APPLICATION_ID)) {
// appMenu.getMenu().removeItem(R.id.menu_activation_scope);
appMenu.getMenu().removeItem(R.id.menu_activation_scope);
}
if (getSettingsIntent(installedModule.packageName) == null) {
appMenu.getMenu().removeItem(R.id.menu_launch);
Expand Down
Loading

0 comments on commit 517c097

Please sign in to comment.