Skip to content

Commit

Permalink
- Better compatibility with app list mode in EdXposed 0.4.x.x
Browse files Browse the repository at this point in the history
- EdXposed 0.5.1.4+ support (configuration will be reset upon update)
- Place hidden/checked apps in lists on top
- Correctly update hidden state highlighting after returning to main list
- Minor UI fixes
  • Loading branch information
Mikanoshi committed Jan 18, 2021
1 parent 413979f commit 4cbff75
Show file tree
Hide file tree
Showing 21 changed files with 255 additions and 140 deletions.
18 changes: 1 addition & 17 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@ Experimental:
Beta:

Stable:
1.28.5 by Mikanoshi
- Better compatibility with app list mode in EdXposed 0.4.x.x
- EdXposed 0.5.1.4+ support (configuration will be reset upon update)
- Place hidden/checked apps in lists on top
- Correctly update hidden state highlighting after returning to main list
- Minor UI fixes

1.28.4 by Mikanoshi
- App list (black/white list) mode support

1.28.3 by Mikanoshi
- Fixed hiding from system apps

1.28.2 by Mikanoshi
- Fixed icons in lists for some apps
- Fixed light/dark UI colors
Expand Down
5 changes: 2 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apply plugin: 'com.android.application'

repositories {
jcenter()
maven { url 'http://repo1.maven.org/maven2' }
maven { url 'http://jcenter.bintray.com' }
maven { url "https://maven.google.com" }
}
Expand All @@ -22,10 +21,10 @@ android {
defaultConfig {
applicationId "com.sudocode.sudohide"
minSdkVersion 21
//noinspection OldTargetApi
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 27
versionCode 128
versionName "1.28.4"
versionName "1.28.5"
}
buildTypes {
release {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<meta-data android:name="xposedmodule" android:value="true" />
<meta-data android:name="xposeddescription" android:value="Hides specified applications from being seen by other specified applications." />
<meta-data android:name="xposedminversion" android:value="53" />
<meta-data android:name="xposedsharedprefs" android:value="true" />

<activity android:name="com.sudocode.sudohide.AppHideConfigurationActivity" />
</application>
Expand Down
20 changes: 14 additions & 6 deletions app/src/main/java/com/sudocode/sudoHideModule/XposedMain.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.sudocode.sudoHideModule;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
Expand All @@ -9,11 +10,14 @@

import com.sudocode.sudohide.BuildConfig;
import com.sudocode.sudohide.Constants;
import com.sudocode.sudohide.MainActivity;
import com.sudocode.sudohide.PrefMap;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.IXposedHookZygoteInit;
Expand All @@ -26,28 +30,32 @@
public class XposedMain implements IXposedHookLoadPackage, IXposedHookZygoteInit {

private static final String X_SUDOHIDE_TAG = "[XSudohide] ";
private static PrefMap<String, Object> mPrefs = new PrefMap<String, Object>();
private static final PrefMap<String, Object> mPrefs = new PrefMap<String, Object>();

private static void logDebug(String msg) {
if (BuildConfig.DEBUG) XposedBridge.log(X_SUDOHIDE_TAG + msg);
}

@Override
@SuppressLint("SdCardPath")
public void initZygote(StartupParam startupParam) {
if (mPrefs.size() == 0) {
XSharedPreferences pref = null;
try {

pref = new XSharedPreferences(BuildConfig.APPLICATION_ID);
if (XposedBridge.getXposedVersion() >= 93)
pref = new XSharedPreferences(BuildConfig.APPLICATION_ID);
else
pref = new XSharedPreferences(new File("/data/data/" + BuildConfig.APPLICATION_ID + "/shared_prefs/" + MainActivity.preferencesFileName + ".xml"));
pref.makeWorldReadable();
} catch (Throwable t) {
XposedBridge.log(t);
}

if (pref == null || pref.getAll().size() == 0)
Map<String, ?> allPrefs = pref == null ? null : pref.getAll();
if (allPrefs == null || allPrefs.size() == 0)
XposedBridge.log(X_SUDOHIDE_TAG + "Cannot read module's SharedPreferences! " + android.os.Process.myUid());
else
mPrefs.putAll(pref.getAll());
mPrefs.putAll(allPrefs);
}

try {
Expand Down Expand Up @@ -120,7 +128,7 @@ private boolean shouldBlock(Object thiz, String callingName, String queryName) {
return true;
}

String key_hide_from_system = queryName + Constants.KEY_HIDE_FROM_SYSTEM;
String key_hide_from_system = queryName + ":" + Constants.KEY_HIDE_FROM_SYSTEM;
if (mPrefs.getBoolean(key_hide_from_system)) {
// block system processes like android.uid.systemui:10015
if (callingName.contains(":")) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
package com.sudocode.sudohide.Adapters;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.preference.PreferenceManager;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.widget.BaseAdapter;
import android.widget.Filter;
Expand All @@ -17,32 +23,49 @@
abstract class AppListAdapter extends BaseAdapter implements Filterable {

private final boolean mShowSystemApps;
final SharedPreferences mPrefs;
List<ApplicationData> mDisplayItems = new ArrayList<>();
Context mContext;
LayoutInflater mInflater;
ThreadPoolExecutor mPool;
private Filter filter;
int mColorPrimary;
int mColorSecondary;
int mColorAccent;
Drawable mBackground;

AppListAdapter(Context context, final boolean mShowSystemApps) {
super();
this.mContext = context;
this.mPrefs = PreferenceManager.getDefaultSharedPreferences(mContext);
this.mShowSystemApps = mShowSystemApps;
this.mInflater = LayoutInflater.from(context);
this.obtainStyle();

final AppListGetter appListGetter = AppListGetter.getInstance(context);
int cpuCount = Runtime.getRuntime().availableProcessors();
mPool = new ThreadPoolExecutor(cpuCount + 1, cpuCount * 2 + 1, 2, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
}

public void obtainStyle() {
TypedArray a = mContext.obtainStyledAttributes(new TypedValue().data, new int[]{ android.R.attr.textColorPrimary, android.R.attr.textColorSecondary, android.R.attr.colorAccent, android.R.attr.background });
mColorPrimary = a.getColor(0, Color.BLACK);
mColorSecondary = a.getColor(1, Color.DKGRAY);
mColorAccent = a.getColor(2, Color.rgb(200, 44, 44));
mBackground = a.getDrawable(3);
a.recycle();
}

public void getAppList() {
final AppListGetter appListGetter = AppListGetter.getInstance(this.mContext);
appListGetter.setOnDataAvailableListener(new AppListGetter.OnDatAvailableListener() {
@Override
public void onDataAvailable() {
mDisplayItems = appListGetter.getAvailableData(mShowSystemApps);
sortList();
AppListAdapter.this.notifyDataSetChanged();
}
});

appListGetter.callOnDataAvailable();

this.mShowSystemApps = mShowSystemApps;
this.mInflater = LayoutInflater.from(context);

int cpuCount = Runtime.getRuntime().availableProcessors();
mPool = new ThreadPoolExecutor(cpuCount + 1, cpuCount * 2 + 1, 2, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
}

boolean isShowSystemApps() {
Expand All @@ -51,6 +74,7 @@ boolean isShowSystemApps() {

void setDisplayItems(List<ApplicationData> displayItems) {
this.mDisplayItems = displayItems;
sortList();
}

Context getContext() {
Expand All @@ -77,4 +101,7 @@ public Filter getFilter() {
if (filter == null) filter = new AppListFilter(this);
return filter;
}

public void sortList() {}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class AppListGetter extends AsyncTask<Void, Void, Void> {
private static AppListGetter instance = null;
private static List<ApplicationData> userApps = null;
private static List<ApplicationData> allApps = null;
private Context mContext;
private final Context mContext;
private OnDatAvailableListener mOnDatAvailableListener;
private PackageManager mPackageManager;
private List<ApplicationInfo> mInstalledApplications;
Expand Down
Loading

0 comments on commit 4cbff75

Please sign in to comment.