Merge pull request #1 from Exodus-Privacy/master

Update structure
This commit is contained in:
Ivan Amaro 2019-11-15 08:09:06 -03:00 committed by GitHub
commit f88b085a2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 106 additions and 65 deletions

View File

@ -12,7 +12,9 @@
android:roundIcon="@mipmap/ic_launcher_round" android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true" android:supportsRtl="true"
android:theme="@style/AppTheme" android:theme="@style/AppTheme"
tools:ignore="GoogleAppIndexingWarning"> tools:ignore="GoogleAppIndexingWarning"
android:largeHeap="true"
>
<activity android:name=".MainActivity" <activity android:name=".MainActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
> >
@ -23,4 +25,4 @@
</activity> </activity>
</application> </application>
</manifest> </manifest>

View File

@ -46,6 +46,7 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
import java.util.Set;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.concurrent.Semaphore; import java.util.concurrent.Semaphore;
@ -201,8 +202,14 @@ public class NetworkManager {
JSONObject tracker = trackers.getJSONObject(trackerId); JSONObject tracker = trackers.getJSONObject(trackerId);
Tracker track = parseTracker(tracker,trackerId); Tracker track = parseTracker(tracker,trackerId);
trackersList.add(track); trackersList.add(track);
if (trackersList.size() == 20) {
DatabaseManager.getInstance(mes.context).insertOrUpdateTrackers(trackersList);
trackersList.clear();
}
} }
DatabaseManager.getInstance(mes.context).insertOrUpdateTrackers(trackersList); if(!trackersList.isEmpty())
DatabaseManager.getInstance(mes.context).insertOrUpdateTrackers(trackersList);
trackersList.clear();
} catch (JSONException e) { } catch (JSONException e) {
mes.listener.onError(mes.context.getString(R.string.json_error)); mes.listener.onError(mes.context.getString(R.string.json_error));
} }
@ -225,40 +232,55 @@ public class NetworkManager {
if(object != null) { if(object != null) {
Map<String,String> handles = new HashMap<>(); Map<String,String> handles = new HashMap<>();
ArrayList<String> packages = mes.args.getStringArrayList("packages");
if (packages == null)
return;
try { try {
JSONArray applications = object.getJSONArray("applications"); JSONArray applications = object.getJSONArray("applications");
//manage handles map (handle,UAID)
for(int i = 0; i<applications.length(); i++) { for(int i = 0; i<applications.length(); i++) {
JSONObject app = applications.getJSONObject(i); JSONObject app = applications.getJSONObject(i);
String handle = app.getString("handle"); String handle = app.getString("handle");
String auid = app.getString("app_uid"); String auid = app.getString("app_uid");
handles.put(handle,auid); app.remove("id");
app.remove("name");
app.remove("creator");
app.remove("icon_phash");
app.remove("downloads");
if (packages.contains(handle))
handles.put(handle,auid);
app.remove("app_uid");
} }
//remove app not analyzed by Exodus
packages.retainAll(handles.keySet());
// Add some random packages to avoid tracking
Random rand = new Random(Thread.currentThread().getId());
int alea = rand.nextInt(120) % 10 + 11;
for(int i = 0 ; i < alea; i++) {
int val = rand.nextInt(applications.length());
JSONObject app = applications.getJSONObject(val);
String handle = app.getString("handle");
packages.add(handle);
}
//shuffle the list
Collections.shuffle(packages);
object.remove("applications");
} catch (JSONException e) { } catch (JSONException e) {
e.printStackTrace();
mes.listener.onError(mes.context.getString(R.string.json_error)); mes.listener.onError(mes.context.getString(R.string.json_error));
} }
getReports(mes,handles); object = null;
getReports(mes,handles,packages);
} }
mes.listener.onSuccess(); mes.listener.onSuccess();
} }
private void getReports(Message mes, Map<String,String> handles) { private void getReports(Message mes, Map<String, String> handles, ArrayList<String> packages) {
ArrayList<String> packages = mes.args.getStringArrayList("packages");
if(packages == null)
return;
packages.retainAll(handles.keySet());
// Add some random packages to avoid tracking
Random rand = new Random(Thread.currentThread().getId());
int alea = rand.nextInt(120) % 10 + 11;
List<String> handleList = new ArrayList<>(handles.keySet());
for(int i = 0 ; i < alea; i++) {
int val = rand.nextInt(handleList.size());
packages.add(handleList.get(val));
}
Collections.shuffle(packages);
for(int i = 0; i < packages.size(); i++) { for(int i = 0; i < packages.size(); i++) {
mes.listener.onProgress(R.string.parse_application,i+1,packages.size()); mes.listener.onProgress(R.string.parse_application,i+1,packages.size());
getReport(mes,packages.get(i),handles.get(packages.get(i))); getReport(mes,packages.get(i),handles.get(packages.get(i)));

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#6fc384"/> <solid android:color="@color/colorGreen"/>
<corners android:radius="5dp"/> <corners android:radius="5dp"/>
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" /> <padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
</shape> </shape>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/colorPrimary"/>
<corners android:radius="5dp"/>
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
</shape>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#e46772"/> <solid android:color="@color/colorRed"/>
<corners android:radius="5dp"/> <corners android:radius="5dp"/>
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" /> <padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
</shape> </shape>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#ffdb66"/> <solid android:color="@color/colorYellow"/>
<corners android:radius="5dp"/> <corners android:radius="5dp"/>
<padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" /> <padding android:left="0dp" android:top="0dp" android:right="0dp" android:bottom="0dp" />
</shape> </shape>

View File

@ -19,6 +19,7 @@
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<ImageView <ImageView
android:id="@+id/logo" android:id="@+id/logo"
android:padding="10dp"
android:layout_width="100dp" android:layout_width="100dp"
android:layout_height="100dp" android:layout_height="100dp"
/> />
@ -33,25 +34,27 @@
<TextView <TextView
android:id="@+id/name" android:id="@+id/name"
android:text="test" android:text="test"
android:layout_marginTop="10dp"
android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView <TextView
android:text="Creator"
android:id="@+id/creator" android:id="@+id/creator"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content"
android:text="Creator"
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
<TextView <TextView
android:text="installed version" android:text="installed version"
android:id="@+id/installed_version" android:id="@+id/installed_version"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView <TextView
android:text="Report version" android:text="Report version"
android:id="@+id/report_version" android:id="@+id/report_version"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textAppearance="@style/TextAppearance.AppCompat.Small"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView <TextView
@ -59,17 +62,20 @@
android:autoLink="web" android:autoLink="web"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="wrap_content" />
<TextView
android:id="@+id/analysed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/analysed"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
/>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
<LinearLayout
<TextView
android:id="@+id/analysed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/base_info" android:layout_below="@id/base_info"
android:text="@string/analysed"
android:textAlignment="center"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
/>
<LinearLayout
android:layout_below="@id/analysed"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -88,29 +94,30 @@
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/colorPrimary" android:background="@drawable/square_purple"
> android:paddingLeft="8dp"
android:paddingStart="8dp"
android:paddingTop="2dp"
android:paddingBottom="3dp">
<TextView <TextView
android:id="@+id/trackers_title" android:id="@+id/trackers_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textAlignment="center"
android:text="@string/trackers_pct" android:text="@string/trackers_pct"
android:textAppearance="@style/TextAppearance.AppCompat.Large" android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textColor="@android:color/white" /> android:textColor="@android:color/white" />
<TextView <TextView
android:id="@+id/trackers_nb" android:id="@+id/trackers_nb"
android:text="99"
android:background="@drawable/square_green"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_marginBottom="2dp"
android:layout_marginTop="2dp"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
/> android:background="@drawable/square_green"
android:text="99"
android:textAlignment="center"
android:textSize="20sp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp" />
</LinearLayout> </LinearLayout>
@ -131,7 +138,11 @@
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@color/colorPrimary" android:background="@drawable/square_purple"
android:paddingLeft="8dp"
android:paddingStart="8dp"
android:paddingTop="2dp"
android:paddingBottom="3dp"
> >
<TextView <TextView
android:id="@+id/permissions_title" android:id="@+id/permissions_title"
@ -144,16 +155,14 @@
<TextView <TextView
android:id="@+id/permissions_nb" android:id="@+id/permissions_nb"
android:text="99"
android:background="@drawable/square_green"
android:layout_marginStart="5dp"
android:layout_marginLeft="5dp"
android:layout_marginBottom="2dp"
android:layout_marginTop="2dp"
android:textAppearance="@style/TextAppearance.AppCompat.Large"
android:textAlignment="center"
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/square_green"
android:text="99"
android:textAlignment="center"
android:textSize="20sp"
android:layout_marginLeft="10dp"
android:layout_marginStart="10dp"
/> />
</LinearLayout> </LinearLayout>

View File

@ -3,4 +3,7 @@
<color name="colorPrimary">#684971</color> <color name="colorPrimary">#684971</color>
<color name="colorPrimaryDark">#3d2b43</color> <color name="colorPrimaryDark">#3d2b43</color>
<color name="colorAccent">#684971</color> <color name="colorAccent">#684971</color>
<color name="colorGreen">#6fc384</color>
<color name="colorRed">#e46772</color>
<color name="colorYellow">#ffdb66</color>
</resources> </resources>

View File

@ -1,4 +1,4 @@
- Améliration de la vitesse de navigation (grâce à borsini) - Amélioration de la vitesse de navigation (grâce à borsini)
- Ajout d'un raccourci vers les paramètres des applications - Ajout d'un raccourci vers les paramètres des applications
- Ajout du numéro de version lorsque la version de l'application ne correspond pas (grâce à tdelmas) - Ajout du numéro de version lorsque la version de l'application ne correspond pas (grâce à tdelmas)
- Correction de bug - Correction de bug

View File

@ -1,7 +1,6 @@
#Mon May 20 19:52:15 CEST 2019 #Tue Oct 01 11:13:40 CEST 2019
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionSha256Sum=14cd15fc8cc8705bd69dcfa3c8fefb27eb7027f5de4b47a8b279218f76895a91