Skip to content

Commit

Permalink
Fix provider trackers not included in the global tracker scanner
Browse files Browse the repository at this point in the history
  • Loading branch information
Hamza417 committed Dec 21, 2024
1 parent 4b474a8 commit b7b07ad
Show file tree
Hide file tree
Showing 10 changed files with 220 additions and 48 deletions.
2 changes: 2 additions & 0 deletions .idea/dictionaries/Hamza.xml

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

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import app.simple.inure.decorations.toggles.CheckBox
import app.simple.inure.decorations.typeface.TypeFaceTextView
import app.simple.inure.decorations.views.AppIconImageView
import app.simple.inure.glide.util.ImageLoader.loadIconFromActivityInfo
import app.simple.inure.glide.util.ImageLoader.loadIconFromProviderInfo
import app.simple.inure.glide.util.ImageLoader.loadIconFromServiceInfo
import app.simple.inure.models.Tracker
import app.simple.inure.preferences.ConfigurationPreferences
Expand Down Expand Up @@ -41,6 +42,9 @@ class AdapterBatchTracker(private val trackers: ArrayList<Tracker>, private val
trackers[position].isReceiver -> {
holder.icon.loadIconFromActivityInfo(trackers[position].receiverInfo)
}
trackers[position].isProvider -> {
holder.icon.loadIconFromProviderInfo(trackers[position].providerInfo)
}
}

holder.name.text = trackers[position].componentName.substringAfterLast(".")
Expand All @@ -57,6 +61,9 @@ class AdapterBatchTracker(private val trackers: ArrayList<Tracker>, private val
trackers[position].isReceiver -> {
appendFlag(holder.itemView.context.getString(R.string.receiver))
}
trackers[position].isProvider -> {
appendFlag(holder.itemView.context.getString(R.string.provider))
}
}

trackers[position].categories.forEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import app.simple.inure.decorations.toggles.Switch
import app.simple.inure.decorations.typeface.TypeFaceTextView
import app.simple.inure.decorations.views.AppIconImageView
import app.simple.inure.glide.util.ImageLoader.loadIconFromActivityInfo
import app.simple.inure.glide.util.ImageLoader.loadIconFromProviderInfo
import app.simple.inure.glide.util.ImageLoader.loadIconFromServiceInfo
import app.simple.inure.models.Tracker
import app.simple.inure.preferences.ConfigurationPreferences
Expand All @@ -25,7 +26,8 @@ class AdapterTrackers(private val list: ArrayList<Tracker>, private val keyword:
private var isRoot = ConfigurationPreferences.isUsingRoot()

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): Holder {
return Holder(LayoutInflater.from(parent.context).inflate(R.layout.adapter_trackers, parent, false))
return Holder(LayoutInflater.from(parent.context)
.inflate(R.layout.adapter_trackers, parent, false))
}

override fun onBindViewHolder(holder: Holder, position: Int) {
Expand All @@ -39,6 +41,9 @@ class AdapterTrackers(private val list: ArrayList<Tracker>, private val keyword:
list[position].isReceiver -> {
holder.icon.loadIconFromActivityInfo(list[position].receiverInfo)
}
list[position].isProvider -> {
holder.icon.loadIconFromProviderInfo(list[position].providerInfo)
}
}

holder.name.text = list[position].componentName.substringAfterLast(".")
Expand All @@ -55,6 +60,9 @@ class AdapterTrackers(private val list: ArrayList<Tracker>, private val keyword:
list[position].isReceiver -> {
appendFlag(holder.itemView.context.getString(R.string.receiver))
}
list[position].isProvider -> {
appendFlag(holder.itemView.context.getString(R.string.provider))
}
}

list[position].categories.forEach {
Expand Down
51 changes: 48 additions & 3 deletions app/src/main/java/app/simple/inure/models/Tracker.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package app.simple.inure.models;

import android.content.pm.ActivityInfo;
import android.content.pm.ProviderInfo;
import android.content.pm.ServiceInfo;
import android.os.Parcel;
import android.os.Parcelable;
Expand Down Expand Up @@ -29,11 +30,13 @@ public class Tracker implements Parcelable {
private boolean isActivity = false;
private boolean isService = false;
private boolean isReceiver = false;
private boolean isProvider = false;
private boolean isBlocked = false;
private boolean isEnabled = true;
private ActivityInfo activityInfo = null;
private ActivityInfo receiverInfo = null;
private ServiceInfo serviceInfo = null;
private ProviderInfo providerInfo = null;
private String componentName;
public boolean isLogged = false; // I don't know why I added this

Expand All @@ -49,15 +52,17 @@ protected Tracker(Parcel in) {
website = in.readString();
categories = in.createStringArray();
documentation = in.createStringArray();
componentName = in.readString();
isActivity = in.readByte() != 0;
isService = in.readByte() != 0;
isReceiver = in.readByte() != 0;
isProvider = in.readByte() != 0;
isBlocked = in.readByte() != 0;
isEnabled = in.readByte() != 0;
activityInfo = in.readParcelable(ActivityInfo.class.getClassLoader());
receiverInfo = in.readParcelable(ActivityInfo.class.getClassLoader());
serviceInfo = in.readParcelable(ServiceInfo.class.getClassLoader());
providerInfo = in.readParcelable(ProviderInfo.class.getClassLoader());
componentName = in.readString();
isLogged = in.readByte() != 0;
}

Expand All @@ -71,15 +76,17 @@ public void writeToParcel(Parcel dest, int flags) {
dest.writeString(website);
dest.writeStringArray(categories);
dest.writeStringArray(documentation);
dest.writeString(componentName);
dest.writeByte((byte) (isActivity ? 1 : 0));
dest.writeByte((byte) (isService ? 1 : 0));
dest.writeByte((byte) (isReceiver ? 1 : 0));
dest.writeByte((byte) (isProvider ? 1 : 0));
dest.writeByte((byte) (isBlocked ? 1 : 0));
dest.writeByte((byte) (isEnabled ? 1 : 0));
dest.writeParcelable(activityInfo, flags);
dest.writeParcelable(receiverInfo, flags);
dest.writeParcelable(serviceInfo, flags);
dest.writeParcelable(providerInfo, flags);
dest.writeString(componentName);
dest.writeByte((byte) (isLogged ? 1 : 0));
}

Expand All @@ -88,7 +95,7 @@ public int describeContents() {
return 0;
}

public static final Creator <Tracker> CREATOR = new Creator <>() {
public static final Creator <Tracker> CREATOR = new Creator <Tracker>() {
@Override
public Tracker createFromParcel(Parcel in) {
return new Tracker(in);
Expand Down Expand Up @@ -162,6 +169,11 @@ public boolean isActivity() {

public void setActivity(boolean activity) {
isActivity = activity;
if (isActivity) {
isService = false;
isReceiver = false;
isProvider = false;
}
}

public boolean isService() {
Expand All @@ -170,6 +182,11 @@ public boolean isService() {

public void setService(boolean service) {
isService = service;
if (isService) {
isProvider = false;
isActivity = false;
isReceiver = false;
}
}

public boolean isReceiver() {
Expand All @@ -178,6 +195,11 @@ public boolean isReceiver() {

public void setReceiver(boolean receiver) {
isReceiver = receiver;
if (isReceiver) {
isProvider = false;
isActivity = false;
isService = false;
}
}

public boolean isBlocked() {
Expand Down Expand Up @@ -244,6 +266,27 @@ public void setComponentName(String componentName) {
this.componentName = componentName;
}

public ProviderInfo getProviderInfo() {
return providerInfo;
}

public void setProviderInfo(ProviderInfo providerInfo) {
this.providerInfo = providerInfo;
}

public boolean isProvider() {
return isProvider;
}

public void setProvider(boolean provider) {
isProvider = provider;
if (isProvider) {
isActivity = false;
isService = false;
isReceiver = false;
}
}

@NonNull
@Override
public String toString() {
Expand Down Expand Up @@ -309,11 +352,13 @@ public void copyComponentInfo(Tracker tracker) {
tracker.setActivity(isActivity());
tracker.setService(isService());
tracker.setReceiver(isReceiver());
tracker.setProvider(isProvider());
tracker.setBlocked(isBlocked());
tracker.setEnabled(isEnabled());
tracker.setActivityInfo(getActivityInfo());
tracker.setReceiverInfo(getReceiverInfo());
tracker.setServiceInfo(getServiceInfo());
tracker.setProviderInfo(getProviderInfo());
tracker.setLogged(isLogged());
}

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/app/simple/inure/ui/panels/AppInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ import app.simple.inure.ui.subpanels.TaggedApps
import app.simple.inure.ui.viewers.Activities
import app.simple.inure.ui.viewers.Boot
import app.simple.inure.ui.viewers.Certificate
import app.simple.inure.ui.viewers.Dexs
import app.simple.inure.ui.viewers.DexClasses
import app.simple.inure.ui.viewers.Extras
import app.simple.inure.ui.viewers.Features
import app.simple.inure.ui.viewers.Graphics
Expand Down Expand Up @@ -333,7 +333,7 @@ class AppInfo : ScopedFragment() {
}

R.string.dex_classes -> {
openFragmentArc(Dexs.newInstance(packageInfo), icon, Dexs.TAG)
openFragmentArc(DexClasses.newInstance(packageInfo), icon, DexClasses.TAG)
}

R.string.trackers -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import app.simple.inure.decorations.typeface.TypeFaceTextView
import app.simple.inure.decorations.views.AppIconImageView
import app.simple.inure.extensions.fragments.ScopedFragment
import app.simple.inure.glide.util.ImageLoader.loadIconFromActivityInfo
import app.simple.inure.glide.util.ImageLoader.loadIconFromProviderInfo
import app.simple.inure.glide.util.ImageLoader.loadIconFromServiceInfo
import app.simple.inure.interfaces.parsers.LinkCallbacks
import app.simple.inure.models.Tracker
Expand Down Expand Up @@ -79,6 +80,9 @@ class TrackerInfo : ScopedFragment() {
tracker?.isReceiver == true -> {
icon.loadIconFromActivityInfo(tracker?.receiverInfo!!)
}
tracker?.isProvider == true -> {
icon.loadIconFromProviderInfo(tracker?.providerInfo!!)
}
}

tags.text = buildString {
Expand All @@ -92,6 +96,9 @@ class TrackerInfo : ScopedFragment() {
tracker?.isReceiver == true -> {
appendFlag(getString(R.string.receiver))
}
tracker?.isProvider == true -> {
appendFlag(getString(R.string.provider))
}
}

tracker?.categories?.forEach {
Expand Down
Loading

0 comments on commit b7b07ad

Please sign in to comment.