From e8d08d35e528071f77c258b05e9aeca2834e2ea3 Mon Sep 17 00:00:00 2001 From: Schoumi Date: Wed, 20 Nov 2019 23:08:51 +0100 Subject: [PATCH] Full rework of report page. --- app/build.gradle | 2 +- .../exodusprivacy/ReportViewModel.java | 171 ++++++ .../adapters/PermissionListAdapter.java | 23 +- .../adapters/TrackerListAdapter.java | 28 +- .../fragments/ReportFragment.java | 162 ++--- .../manager/DatabaseManager.java | 2 + .../exodusprivacy/manager/NetworkManager.java | 2 + .../exodusprivacy/objects/Permission.java | 4 + .../exodusprivacy/objects/ReportDisplay.java | 89 +++ app/src/main/res/drawable/ic_danger.xml | 6 + app/src/main/res/layout/main.xml | 2 - app/src/main/res/layout/permission_item.xml | 73 ++- app/src/main/res/layout/report.xml | 561 +++++++++++++----- app/src/main/res/layout/tracker_item.xml | 28 +- app/src/main/res/values-fr/strings.xml | 22 +- app/src/main/res/values/colors.xml | 10 +- app/src/main/res/values/strings.xml | 19 +- build.gradle | 2 +- 18 files changed, 865 insertions(+), 341 deletions(-) create mode 100644 app/src/main/java/org/eu/exodus_privacy/exodusprivacy/ReportViewModel.java create mode 100644 app/src/main/java/org/eu/exodus_privacy/exodusprivacy/objects/ReportDisplay.java create mode 100644 app/src/main/res/drawable/ic_danger.xml diff --git a/app/build.gradle b/app/build.gradle index fbf4b10..65e98ed 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,7 +5,7 @@ android { buildToolsVersion "28.0.3" defaultConfig { applicationId "org.eu.exodus_privacy.exodusprivacy" - minSdkVersion 16 + minSdkVersion 17 targetSdkVersion 28 versionCode 7 versionName "1.2.0" diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/ReportViewModel.java b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/ReportViewModel.java new file mode 100644 index 0000000..9c3ebb0 --- /dev/null +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/ReportViewModel.java @@ -0,0 +1,171 @@ +package org.eu.exodus_privacy.exodusprivacy; + +import android.content.Context; +import android.graphics.drawable.Drawable; +import android.view.View; + +import androidx.databinding.BaseObservable; +import androidx.databinding.Bindable; + +import org.eu.exodus_privacy.exodusprivacy.objects.Permission; +import org.eu.exodus_privacy.exodusprivacy.objects.ReportDisplay; + +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; + + +public class ReportViewModel extends BaseObservable { + private ReportDisplay reportDisplay; + + public void setReportDisplay(ReportDisplay report){ + this.reportDisplay = report; + notifyChange(); + } + + @Bindable + public String getName() { + return reportDisplay.displayName; + } + + @Bindable + public Drawable getLogo() { + return reportDisplay.logo; + } + + + public int getPermissionNumber() { + return reportDisplay.permissions != null ? reportDisplay.permissions.size() : 0; + } + + @Bindable + public String getPermissionNumberStr() { + return String.valueOf(getPermissionNumber()); + } + + @Bindable + public int getPermissionColor() { + return getColor(getPermissionNumber()); + } + + @Bindable + public boolean getPermissionVisibility() { + return reportDisplay.permissions != null; + } + + @Bindable + public boolean getHasPermissionDangerous() { + for(Permission perm : reportDisplay.permissions) { + if(perm.dangerous) + return true; + } + return false; + } + + public int getTrackerNumber() { + return reportDisplay.trackers != null ? reportDisplay.trackers.size() : 0; + } + + @Bindable + public String getTrackerNumberStr() { + return String.valueOf(getTrackerNumber()); + } + + + @Bindable + public boolean getTrackerVisibility() { + return reportDisplay.trackers != null; + } + + @Bindable + public int getTrackerColor() { + return getColor(getTrackerNumber()); + } + + public String getCreator(Context context) { + String creator = reportDisplay.creator != null ? reportDisplay.creator : ""; + if (reportDisplay.report != null && !reportDisplay.report.downloads.isEmpty()) { + String download = reportDisplay.report.downloads; + download = download.replace("downloads",context.getString(R.string.downloads)); + creator += " (" + download + ")"; + } + return creator; + } + + @Bindable + public boolean getCreatorVisibility() { + return reportDisplay.creator != null; + } + + @Bindable + public String getInstalledVersion() { + return reportDisplay.versionName != null ? reportDisplay.versionName : String.valueOf(reportDisplay.versionCode); + } + + @Bindable + public String getReportVersion() { + if(reportDisplay.report != null) { + if (reportDisplay.versionName != null && !reportDisplay.report.version.equals(reportDisplay.versionName)) { + return reportDisplay.report.version; + } else if (reportDisplay.versionName == null && reportDisplay.report.versionCode != reportDisplay.versionCode) { + return String.valueOf(reportDisplay.report.versionCode); + } + } + return ""; + } + + @Bindable + public boolean getReportVersionVisibility() { + return !getReportVersion().isEmpty(); + } + + @Bindable + public boolean getReportVisibility() { + return reportDisplay.report != null; + } + + public String getReportDate(Context context) { + String reportDate = ""; + if(reportDisplay.report == null) + return reportDate; + + System.out.println("crea "+reportDisplay.report.creationDate.getTimeInMillis()+" up"+reportDisplay.report.updateDate.getTimeInMillis()); + + DateFormat dateFormat = SimpleDateFormat.getDateInstance(DateFormat.LONG); + reportDate = context.getString(R.string.created_date)+" "+dateFormat.format(reportDisplay.report.creationDate.getTime()); + if (reportDisplay.report.creationDate.getTime().compareTo(reportDisplay.report.updateDate.getTime())!=0) + reportDate += " "+context.getString(R.string.and_updated)+" "+dateFormat.format(reportDisplay.report.updateDate.getTime())+"."; + return reportDate; + } + + public String getCodeSignatureInfo(Context context) { + if(reportDisplay.trackers != null && reportDisplay.trackers.size() > 0) + return context.getString(R.string.code_signature_found); + else if(reportDisplay.trackers != null) + return context.getString(R.string.code_signature_not_found); + else + return ""; + } + + public String getCodePermissionInfo(Context context) { + if(reportDisplay.permissions != null && reportDisplay.permissions.size() > 0) + return context.getString(R.string.code_permission_found); + else if(reportDisplay.permissions != null) + return context.getString(R.string.code_permission_not_found); + else + return ""; + } + + + private int getColor(int number) { + if (number == 0) + return R.drawable.square_green; + else if(number < 5) + return R.drawable.square_yellow; + else + return R.drawable.square_red; + } + + + +} diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/adapters/PermissionListAdapter.java b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/adapters/PermissionListAdapter.java index 08a6857..fb0f884 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/adapters/PermissionListAdapter.java +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/adapters/PermissionListAdapter.java @@ -40,7 +40,7 @@ public class PermissionListAdapter extends RecyclerView.Adapter { if( permission.description != null && permission.description.trim().length() > 0) { @@ -78,6 +88,9 @@ public class PermissionListAdapter extends RecyclerView.Adapter 0 ) permissionItemBinding.arrow.setText("▶"); else - permissionItemBinding.arrow.setText("■"); + permissionItemBinding.arrow.setText(""); permissionItemBinding.permissionDescription.setVisibility(View.GONE); } diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/adapters/TrackerListAdapter.java b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/adapters/TrackerListAdapter.java index aedc4c8..31a12e2 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/adapters/TrackerListAdapter.java +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/adapters/TrackerListAdapter.java @@ -1,6 +1,9 @@ package org.eu.exodus_privacy.exodusprivacy.adapters; +import android.content.Intent; +import android.net.Uri; import android.view.LayoutInflater; +import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; @@ -12,11 +15,15 @@ import org.eu.exodus_privacy.exodusprivacy.R; import org.eu.exodus_privacy.exodusprivacy.databinding.TrackerItemBinding; import org.eu.exodus_privacy.exodusprivacy.objects.Tracker; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; import java.util.Set; public class TrackerListAdapter extends RecyclerView.Adapter{ - private Set trackersList; + private List trackersList; private int layout; public TrackerListAdapter(Set trackerList, int resource) { @@ -36,7 +43,7 @@ public class TrackerListAdapter extends RecyclerView.Adapter alphaTrackerComparator = (track1, track2) -> track1.name.compareToIgnoreCase(track2.name); + public void setTrackers(Set trackers) { - trackersList = trackers; + if(trackers != null) { + trackersList = new ArrayList<>(trackers); + Collections.sort(trackersList, alphaTrackerComparator); + } } class TrackerListViewHolder extends RecyclerView.ViewHolder { @@ -63,8 +75,14 @@ public class TrackerListAdapter extends RecyclerView.Adapter { + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse("https://reports.exodus-privacy.eu.org/trackers/" + tracker.id + "/")); + v.getContext().startActivity(intent); + }); + } else binding.trackerName.setText(R.string.no_trackers); } diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/ReportFragment.java b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/ReportFragment.java index b236b62..c976d0c 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/ReportFragment.java +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/fragments/ReportFragment.java @@ -20,10 +20,12 @@ package org.eu.exodus_privacy.exodusprivacy.fragments; import android.content.Context; +import android.content.Intent; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; -import android.content.pm.PermissionInfo; +import android.net.Uri; import android.os.Bundle; +import android.text.method.LinkMovementMethod; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; @@ -36,18 +38,11 @@ import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import org.eu.exodus_privacy.exodusprivacy.R; +import org.eu.exodus_privacy.exodusprivacy.ReportViewModel; import org.eu.exodus_privacy.exodusprivacy.adapters.PermissionListAdapter; import org.eu.exodus_privacy.exodusprivacy.adapters.TrackerListAdapter; import org.eu.exodus_privacy.exodusprivacy.databinding.ReportBinding; -import org.eu.exodus_privacy.exodusprivacy.manager.DatabaseManager; -import org.eu.exodus_privacy.exodusprivacy.objects.Permission; -import org.eu.exodus_privacy.exodusprivacy.objects.Report; -import org.eu.exodus_privacy.exodusprivacy.objects.Tracker; - -import java.util.ArrayList; -import java.util.List; -import java.util.Set; - +import org.eu.exodus_privacy.exodusprivacy.objects.ReportDisplay; public class ReportFragment extends Fragment { private PackageManager packageManager; @@ -86,136 +81,55 @@ public class ReportFragment extends Fragment { public void updateComplete() { Context context = reportBinding.getRoot().getContext(); - String packageName = packageInfo.packageName; - String versionName = packageInfo.versionName; - long versionCode = packageInfo.versionCode; - //setup logo - try { - reportBinding.logo.setImageDrawable(packageManager.getApplicationIcon(packageName)); - } catch (PackageManager.NameNotFoundException e) { - e.printStackTrace(); - } + ReportDisplay reportDisplay = ReportDisplay.buildReportDisplay(context,packageManager,packageInfo); + ReportViewModel viewModel = new ReportViewModel(); + viewModel.setReportDisplay(reportDisplay); + reportBinding.setReportInfo(viewModel); - //setup name - reportBinding.name.setText(packageManager.getApplicationLabel(packageInfo.applicationInfo)); - - //setup permissions number - if (packageInfo.requestedPermissions != null) { - reportBinding.permissionsNb.setText(String.valueOf(packageInfo.requestedPermissions.length)); - reportBinding.permissionsNb.setVisibility(View.VISIBLE); - } - else { - reportBinding.permissionsNb.setVisibility(View.GONE); - } - - if(packageInfo.requestedPermissions != null){ - if(packageInfo.requestedPermissions.length == 0) - reportBinding.permissionsNb.setBackgroundResource(R.drawable.square_green); - else if(packageInfo.requestedPermissions.length < 5) - reportBinding.permissionsNb.setBackgroundResource(R.drawable.square_yellow); - else - reportBinding.permissionsNb.setBackgroundResource(R.drawable.square_red); - } - - //setup permissions list - List requestedPermissions = null; - if (packageInfo.requestedPermissions != null && packageInfo.requestedPermissions.length > 0) { - requestedPermissions = new ArrayList<>(); - for(int i = 0; i < packageInfo.requestedPermissions.length; i++) { - Permission permission = new Permission(); - permission.fullName = packageInfo.requestedPermissions[i]; - try { - PermissionInfo permissionInfo = packageManager.getPermissionInfo(permission.fullName,PackageManager.GET_META_DATA); - if(permissionInfo.loadDescription(packageManager) != null) - permission.description = permissionInfo.loadDescription(packageManager).toString(); - if(permissionInfo.loadLabel(packageManager) != null) - permission.name = permissionInfo.loadLabel(packageManager).toString(); - } catch (PackageManager.NameNotFoundException e) { - e.printStackTrace(); - } - requestedPermissions.add(permission); - } - } reportBinding.permissions.setLayoutManager(new LinearLayoutManager(context)); - PermissionListAdapter permissionAdapter = new PermissionListAdapter(requestedPermissions); + PermissionListAdapter permissionAdapter = new PermissionListAdapter(reportDisplay.permissions); reportBinding.permissions.setNestedScrollingEnabled(false); reportBinding.permissions.setAdapter(permissionAdapter); - reportBinding.analysed.setVisibility(View.GONE); - reportBinding.trackerLayout.setVisibility(View.VISIBLE); - - //get trackers - Report report = null; - if(versionName != null) - report = DatabaseManager.getInstance(context).getReportFor(packageName,versionName); - else - report = DatabaseManager.getInstance(context).getReportFor(packageName,versionCode); - Set trackers = null; - if(report != null) { - trackers = DatabaseManager.getInstance(context).getTrackers(report.trackers); - } else { - reportBinding.analysed.setVisibility(View.VISIBLE); - reportBinding.trackerLayout.setVisibility(View.GONE); - } - //setup trackers report - if(trackers != null) { - reportBinding.trackersNb.setText(String.valueOf(trackers.size())); - reportBinding.trackersNb.setVisibility(View.VISIBLE); - } else { - reportBinding.trackersNb.setVisibility(View.GONE); - } - if(trackers != null){ - if(trackers.size() == 0) - reportBinding.trackersNb.setBackgroundResource(R.drawable.square_green); - else if(trackers.size() < 5) - reportBinding.trackersNb.setBackgroundResource(R.drawable.square_yellow); - else - reportBinding.trackersNb.setBackgroundResource(R.drawable.square_red); - } - //setup trackers lists reportBinding.trackers.setLayoutManager(new LinearLayoutManager(context)); - TrackerListAdapter trackerAdapter = new TrackerListAdapter(trackers,R.layout.tracker_item); + TrackerListAdapter trackerAdapter = new TrackerListAdapter(reportDisplay.trackers,R.layout.tracker_item); reportBinding.trackers.setNestedScrollingEnabled(false); reportBinding.trackers.setAdapter(trackerAdapter); - //setup creator - if(report != null) - reportBinding.creator.setText(DatabaseManager.getInstance(context).getCreator(report.appId)); - else - reportBinding.creator.setVisibility(View.GONE); + reportBinding.reportDate.setText(viewModel.getReportDate(context)); + reportBinding.creatorValue.setText(viewModel.getCreator(context)); + reportBinding.codeSignature.setText(viewModel.getCodeSignatureInfo(context)); + reportBinding.codePermission.setText(viewModel.getCodePermissionInfo(context)); - //setup installed - String installed_str = ""; - if(versionName != null) - installed_str = context.getString(R.string.installed) +" "+ versionName; - else - installed_str = context.getString(R.string.installed) +" "+ String.valueOf(versionCode); - reportBinding.installedVersion.setText(installed_str); + reportBinding.trackerExplanation.setText(getText(R.string.tracker_infos)); + reportBinding.trackerExplanation.setMovementMethod(LinkMovementMethod.getInstance()); + reportBinding.trackerExplanation.setClickable(true); - //setup reportversion - reportBinding.reportVersion.setVisibility(View.VISIBLE); - if(report != null) { - String report_str = ""; - if (versionName != null && !report.version.equals(versionName)) { - report_str = context.getString(R.string.report_version) + " " + report.version; - } else if (versionName == null && report.versionCode != versionCode) { - report_str = context.getString(R.string.report_version) + " " + report.versionCode; - } - if(!report_str.isEmpty()) - reportBinding.reportVersion.setText(report_str); - else - reportBinding.reportVersion.setVisibility(View.GONE); + reportBinding.permissionExplanationDangerous.setText(getText(R.string.permission_infos_dangerous)); + reportBinding.permissionExplanationDangerous.setMovementMethod(LinkMovementMethod.getInstance()); + reportBinding.permissionExplanationDangerous.setClickable(true); + + reportBinding.permissionExplanation.setText(getText(R.string.permission_infos)); + reportBinding.permissionExplanation.setMovementMethod(LinkMovementMethod.getInstance()); + reportBinding.permissionExplanation.setClickable(true); + + reportBinding.viewPlay.setOnClickListener(v -> { + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse("https://play.google.com/store/apps/details?id="+reportDisplay.packageName)); + startActivity(intent); + }); + + if(reportDisplay.report != null) { + reportBinding.reportUrl.setOnClickListener(v -> { + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse("https://reports.exodus-privacy.eu.org/reports/" + reportDisplay.report.id + "/")); + startActivity(intent); + }); } - else - reportBinding.reportVersion.setVisibility(View.GONE); - - //setup report url - if(report != null) - reportBinding.reportUrl.setText("https://reports.exodus-privacy.eu.org/reports/"+report.id+"/"); } public void setPackageManager(PackageManager packageManager) { diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/manager/DatabaseManager.java b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/manager/DatabaseManager.java index c6e813a..430ce64 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/manager/DatabaseManager.java +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/manager/DatabaseManager.java @@ -280,9 +280,11 @@ public class DatabaseManager extends SQLiteOpenHelper { long creation = cursor.getLong(col++); report.creationDate = Calendar.getInstance(); report.creationDate.setTimeInMillis(creation); + report.creationDate.set(Calendar.MILLISECOND,0); long update = cursor.getLong(col++); report.updateDate = Calendar.getInstance(); report.updateDate.setTimeInMillis(update); + report.updateDate.set(Calendar.MILLISECOND,0); report.downloads = cursor.getString(col++); report.version = cursor.getString(col++); report.versionCode = cursor.getLong(col++); diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/manager/NetworkManager.java b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/manager/NetworkManager.java index 2535a52..aa29cec 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/manager/NetworkManager.java +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/manager/NetworkManager.java @@ -340,10 +340,12 @@ public class NetworkManager { report.updateDate = Calendar.getInstance(); report.updateDate.setTimeZone(TimeZone.getTimeZone("UTC")); report.updateDate.setTime(dateFormat.parse(object.getString("updated_at"))); + report.updateDate.set(Calendar.MILLISECOND,0); report.creationDate = Calendar.getInstance(); report.creationDate.setTimeZone(TimeZone.getTimeZone("UTC")); report.creationDate.setTime(dateFormat.parse(object.getString("creation_date"))); + report.creationDate.set(Calendar.MILLISECOND,0); } catch (ParseException e) { e.printStackTrace(); } diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/objects/Permission.java b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/objects/Permission.java index bdb5f87..8b9b8fc 100644 --- a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/objects/Permission.java +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/objects/Permission.java @@ -1,8 +1,12 @@ package org.eu.exodus_privacy.exodusprivacy.objects; +import android.graphics.drawable.Drawable; + public class Permission { public String name; public String fullName; public String description; + public Drawable icon; + public boolean dangerous; public boolean expanded = false; } diff --git a/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/objects/ReportDisplay.java b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/objects/ReportDisplay.java new file mode 100644 index 0000000..2c1515b --- /dev/null +++ b/app/src/main/java/org/eu/exodus_privacy/exodusprivacy/objects/ReportDisplay.java @@ -0,0 +1,89 @@ +package org.eu.exodus_privacy.exodusprivacy.objects; + +import android.Manifest; +import android.content.Context; +import android.content.pm.PackageInfo; +import android.content.pm.PackageManager; +import android.content.pm.PermissionGroupInfo; +import android.content.pm.PermissionInfo; +import android.graphics.drawable.Drawable; +import android.os.Build; + +import org.eu.exodus_privacy.exodusprivacy.manager.DatabaseManager; + +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + +public class ReportDisplay { + public Report report; + public String packageName; + public String versionName; + public String displayName; + public String creator; + public long versionCode; + public Drawable logo; + public List permissions; + public Set trackers; + + + private ReportDisplay(){ + + } + + public static ReportDisplay buildReportDisplay(Context context, PackageManager manager, PackageInfo info) { + ReportDisplay reportDisplay = new ReportDisplay(); + reportDisplay.packageName = info.packageName; + reportDisplay.versionName = info.versionName; + reportDisplay.versionCode = info.versionCode; + reportDisplay.displayName = manager.getApplicationLabel(info.applicationInfo).toString(); + + if(reportDisplay.versionName != null) + reportDisplay.report = DatabaseManager.getInstance(context).getReportFor(reportDisplay.packageName,reportDisplay.versionName); + else + reportDisplay.report = DatabaseManager.getInstance(context).getReportFor(reportDisplay.packageName, reportDisplay.versionCode); + + if(reportDisplay.report != null) + reportDisplay.trackers = DatabaseManager.getInstance(context).getTrackers(reportDisplay.report.trackers); + + if (reportDisplay.report != null) + reportDisplay.creator = DatabaseManager.getInstance(context).getCreator(reportDisplay.report.appId); + + List requestedPermissions= new ArrayList<>(); + if (info.requestedPermissions != null) { + for(int i = 0; i < info.requestedPermissions.length; i++) { + Permission permission = new Permission(); + permission.fullName = info.requestedPermissions[i]; + try { + PermissionInfo permissionInfo = manager.getPermissionInfo(permission.fullName,PackageManager.GET_META_DATA); + if(permissionInfo.loadDescription(manager) != null) + permission.description = permissionInfo.loadDescription(manager).toString(); + if(permissionInfo.loadLabel(manager) != null) + permission.name = permissionInfo.loadLabel(manager).toString(); + permission.dangerous = permissionInfo.protectionLevel == PermissionInfo.PROTECTION_DANGEROUS; + if(permission.fullName.equals(Manifest.permission.WRITE_SETTINGS) || permission.fullName.equals(Manifest.permission.SYSTEM_ALERT_WINDOW)) //Special permissions + permission.dangerous = true; + + if (permissionInfo.group != null) { + PermissionGroupInfo permissionGroupInfo = manager.getPermissionGroupInfo(permissionInfo.group, PackageManager.GET_META_DATA); + if(permissionGroupInfo.loadIcon(manager) != null) + permission.icon = permissionGroupInfo.loadIcon(manager); + } + + } catch (PackageManager.NameNotFoundException e) { + e.getLocalizedMessage(); + } + requestedPermissions.add(permission); + } + } + reportDisplay.permissions = requestedPermissions; + + try { + reportDisplay.logo = manager.getApplicationIcon(reportDisplay.packageName); + } catch (PackageManager.NameNotFoundException e){ + e.printStackTrace(); + } + + return reportDisplay; + } +} diff --git a/app/src/main/res/drawable/ic_danger.xml b/app/src/main/res/drawable/ic_danger.xml new file mode 100644 index 0000000..7fe6430 --- /dev/null +++ b/app/src/main/res/drawable/ic_danger.xml @@ -0,0 +1,6 @@ + + + diff --git a/app/src/main/res/layout/main.xml b/app/src/main/res/layout/main.xml index 9735ecf..33f8b63 100644 --- a/app/src/main/res/layout/main.xml +++ b/app/src/main/res/layout/main.xml @@ -8,9 +8,7 @@ > - + - + + android:layout_height="wrap_content" + > + + + + + + - - + + android:layout_height="wrap_content" + android:layout_marginStart="66dp" + android:layout_marginEnd="20dp" + android:textStyle="italic" + /> \ No newline at end of file diff --git a/app/src/main/res/layout/report.xml b/app/src/main/res/layout/report.xml index 6ec7b91..a1019f9 100644 --- a/app/src/main/res/layout/report.xml +++ b/app/src/main/res/layout/report.xml @@ -1,180 +1,429 @@ - - + + + + + - - + android:layout_height="match_parent"> + android:layout_marginTop="20dp" + android:padding="10dp" + android:src="@{reportInfo.logo}" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toTopOf="parent"/> - + + + + + + + + + + + + + + + + + + + + + + + - + android:autoLink="web" + android:text="@string/view_on_exodus" + android:visibility="@{reportInfo.reportVisibility ? View.VISIBLE : View.GONE}" + app:layout_constraintEnd_toEndOf="parent" + android:textAlignment="textEnd" + app:layout_constraintTop_toBottomOf="@id/report_date" + android:layout_marginTop="5dp" + android:layout_marginStart="20dp" + android:layout_marginEnd="20dp" + android:textSize="16sp" + android:textColor="@color/colorPurple"/> - - - - - - - - - - - + android:layout_height="wrap_content" + android:autoLink="web" + android:text="@string/view_on_google_play" + android:textAlignment="textEnd" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintTop_toBottomOf="@id/report_url" + android:layout_marginTop="5dp" + android:layout_marginStart="20dp" + android:layout_marginEnd="20dp" + android:textSize="16sp" + android:textColor="@color/colorPurple"/> - - + - + - + - - - - - - + android:layout_height="wrap_content" + android:visibility="@{reportInfo.trackerVisibility ? View.VISIBLE : View.GONE}" + android:layout_marginTop="5dp" + android:layout_marginBottom="5dp" + android:layout_marginStart="20dp" + android:layout_marginEnd="20dp" + app:layout_constraintTop_toBottomOf="@id/code_signature" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintEnd_toEndOf="parent" + /> - - + - - - - - + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/tracker_item.xml b/app/src/main/res/layout/tracker_item.xml index b711715..1c6e24c 100644 --- a/app/src/main/res/layout/tracker_item.xml +++ b/app/src/main/res/layout/tracker_item.xml @@ -3,25 +3,11 @@ xmlns:android="http://schemas.android.com/apk/res/android" > - - - - + \ No newline at end of file diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 22bf788..c4cc1fa 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -10,8 +10,8 @@ Erreur JSON Version installée : Version testée : - Aucun pisteur testé n\'a été trouvé - Aucune autorisation n\'est demandée par cette application + L’application pourrait contenir un ou plusieurs pisteurs que nous n’avons pas encore identifiés. + Cette application ne demande aucun autorisation. Il n\'y a pas de rapport pour la version installée (%1$s), les informations affichées sont basées sur une autre version (%2$s) Cette application n\'a pas encore été analysée par Exodus Privacy. Votre système semble ne pas donner accès aux applications installées. @@ -22,7 +22,25 @@ Traitement des pisteurs : Récupération des pisteurs : en attente de connexion au serveur Récupération des pisteurs + Cette app n\'a pas de paramêtre + Logo de l\'application %1 + Crée par + Ce rapport a été créé le + et mis à jour le + Voir sur Exodus Privacy ➤ + Voir sur Google Play ➤ + téléchargements + Nous avons trouvé la signature des pisteurs suivants dans cette application : + Nous n’avons pas trouvé la signature de pisteurs que nous connaissons dans l’application. + Nous avons trouvé les permissions suivantes dans cette application: + Cette application ne demande aucune autorisation. + Un pisteur est une partie du logiciel dédiée à la collecte de données sur vous et vos usages. En savoir plus… + Les permissions sont les actions que l\'application peut effectuer sur votre téléphone. En savoir plus… + L\'icône ! indique un niveau \'Dangereux\' ou \'Spécial\' d\'après les niveaux de protection de Google. + Présent dans: %1 applications + Site web du pisteur➤ Filtrer + Paramètres de l\'application diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 55b346b..25d6de1 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -1,9 +1,13 @@ - #684971 - #3d2b43 - #684971 + #212529 + #212529 + #212529 #6fc384 #e46772 #ffdb66 + #684971 + #343A40 + #6C757D + #FFFFFF diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a2b2b20..c17d463 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -10,8 +10,8 @@ JSON Error Installed Version: Tested Version: - No tested trackers were found - No permissions are requested by this application + The application could contain tracker(s) we do not know yet. + This application doesn\'t require any permissions. There\'s no report for the installed version (%1$s), the information displayed is based on another (%2$s) version This app hasn\'t been analysed by Exodus Privacy yet. It appears that your system doesn\'t allow access to the list of installed apps. @@ -23,8 +23,23 @@ Getting trackers: Waiting for server connection Getting trackers This app doesn\'t have settings + %1 Application Logo + Created By + This report has been created the + and updated the + See on Exodus Privacy ➤ + See on Google Play ➤ + downloads + We have found code signature of the following trackers in the application: + We have not found code signature of any tracker we know in the application. + We have found the following permissions in the application: + This application doesn\'t require any permissions. + A tracker is a piece of software meant to collect data about you or your usages. Learn more… + Permissions are actions the application can do on your phone. Learn more… + The icon ! indicates a \'Dangerous\' or \'Special\' level according to Google\'s protection levels. Filter Application Settings + diff --git a/build.gradle b/build.gradle index 100e467..62051e5 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ buildscript { google() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.0' + classpath 'com.android.tools.build:gradle:3.5.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files