Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
import saarland.cispa.artist.artistgui.instrumentation.progress.ProgressPublisher;
import saarland.cispa.artist.artistgui.settings.config.ArtistConfigFactory;
import saarland.cispa.artist.artistgui.settings.manager.SettingsManager;
import saarland.cispa.artist.artistgui.system.FrameworkPackages;
import saarland.cispa.artist.artistgui.utils.ProcessExecutor;
import trikita.log.Log;

public class AppDetailsDialogPresenter implements AppDetailsDialogContract.Presenter {
Expand Down Expand Up @@ -85,6 +87,7 @@ public void loadAppIcon() {
DisplayMetrics.DENSITY_XHIGH, null);
mView.setAppIcon(appIcon);
} catch (PackageManager.NameNotFoundException | Resources.NotFoundException e) {
mView.setAppIcon(mContext.getDrawable(android.R.mipmap.sym_def_app_icon));
e.printStackTrace();
}
}
Expand Down Expand Up @@ -192,10 +195,15 @@ private void startInstrumentedAppIfWished() {
final boolean launchActivity = mSettingsManager.shouldLaunchActivityAfterCompilation();
if (launchActivity) {
String packageName = mSelectedPackage.packageName;
Log.d(TAG, "Starting compiled app: " + packageName);
final Intent launchIntent = mContext.getPackageManager()
.getLaunchIntentForPackage(packageName);
mContext.startActivity(launchIntent);
if (FrameworkPackages.shouldReboot(packageName)) {
Log.d(TAG, "Rebooting...");
ProcessExecutor.execute("reboot", true);
} else {
Log.d(TAG, "Starting compiled app: " + packageName);
final Intent launchIntent = mContext.getPackageManager()
.getLaunchIntentForPackage(packageName);
mContext.startActivity(launchIntent);
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import android.content.Context;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.util.DisplayMetrics;
import android.util.LruCache;
Expand Down Expand Up @@ -58,6 +59,8 @@ protected Drawable create(Package packageEntry) {

} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
} catch (Resources.NotFoundException e) {
return mContext.getDrawable(android.R.mipmap.sym_def_app_icon);
}

return appIcon;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import saarland.cispa.artist.artistgui.Application;
import saarland.cispa.artist.artistgui.database.Package;
import saarland.cispa.artist.artistgui.database.PackageDao;
import saarland.cispa.artist.artistgui.system.FrameworkPackages;

public class AppListLoader extends AsyncTaskLoader<List<Package>> {

Expand Down Expand Up @@ -114,6 +115,8 @@ private List<Package> buildSortedPackageList(List<PackageInfo> packageInfos) {
String appName;
int appIconId;

FrameworkPackages.addJarsToPackageList(packageList);

for (PackageInfo packageInfo : packageInfos) {
// Collect meta data
applicationInfo = packageInfo.applicationInfo;
Expand All @@ -132,6 +135,7 @@ private List<Package> buildSortedPackageList(List<PackageInfo> packageInfos) {
return packageList;
}


/**
* Fetches package details if present in db or return package without additional data.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class Package implements Parcelable {

// Non db fields
public static final Comparator<Package> sComparator =
(p1, p2) -> p1.appName.compareTo(p2.appName);
(p1, p2) -> (p1.appName.compareTo(p2.appName));

@Ignore
public String appName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class InstrumentationTask implements Runnable {
@Override
public void run() {
Log.i(TAG, "Run() compiling and starting " + mRunConfig.app_package_name);
Log.i(TAG, "> apkPath: " + mRunConfig.app_apk_file_path);
Log.i(TAG, "> Keystore: " + mRunConfig.keystore);

try {
Expand All @@ -69,8 +68,8 @@ public void run() {
mInstrumenationStages.mergeCodeLib();
ArtistThread.checkThreadCancellation();
mInstrumenationStages.backupMergedApk();

ArtistThread.checkThreadCancellation();

reportProgress(50, "Compiling: " + mRunConfig.app_package_name);
mInstrumenationStages.runDex2OatCompilation(pathDex2oat);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,97 @@

package saarland.cispa.artist.artistgui.instrumentation.config;

import android.content.Context;

import java.io.File;
import java.util.ArrayList;

import saarland.cispa.artist.artistgui.utils.AndroidUtils;

public class ArtistRunConfig {

public static class InputFiles {
private ArrayList<String> paths = new ArrayList<>();
private ArrayList<String> mergedpaths = new ArrayList<>();
private ArrayList<String> signedpaths = new ArrayList<>();


public InputFiles(String[] paths, final Context context) {
addFiles(paths, context);
}


public InputFiles() {
}


public void addFile(String filePath, final Context context) {
int i = paths.size();
paths.add(filePath);
mergedpaths.add(AndroidUtils.getFilesDirLocation(context, ArtistRunConfig.BASE_APK_MERGED+"_"+i+".apk"));
signedpaths.add(AndroidUtils.getFilesDirLocation(context, ArtistRunConfig.BASE_APK_SIGNED+"_"+i+".apk"));
}


public void addFiles(String[] paths, final Context context) {
for (String s :paths){
addFile(s, context);
}
}


public String getFilePath(int i) {
return paths.get(i);
}


public String getMergedPath(int i) {
return mergedpaths.get(i);
}


public String getSignedPath(int i) {
return signedpaths.get(i);
}


public String[] getPaths() {
return (String[]) paths.toArray();
}


public String[] getMergedPaths() {
return (String[]) mergedpaths.toArray();
}


public String[] getSignedPaths() {
return (String[]) signedpaths.toArray();
}


public int size(){
return paths.size();
}


@Override
public String toString() {
return "InputFiles{" +
"paths=" + paths +
", mergedpaths=" + mergedpaths +
", signedpaths=" + signedpaths +
'}';
}


}

public final static String KEYSTORE_NAME = "artist.bks";

public static final String BASE_APK_ALTERNATIVE = "base2.apk";
public static final String BASE_APK_MERGED = "base_merged.apk";
public static final String BASE_APK_SIGNED = "base_merged-signed.apk";
public static final String BASE_APK_MERGED = "base_merged";
public static final String BASE_APK_SIGNED = "base_merged-signed";

public final static String OAT_FILE = "base.odex";

Expand All @@ -38,9 +120,6 @@ public class ArtistRunConfig {
*/

public String app_folder_path = "";
public String app_apk_file_path = ""; // base.apk
public String app_apk_merged_file_path = ""; // base_merged.apk
public String app_apk_merged_signed_file_path = ""; // base_merged-signed.apk

public String app_apk_file_path_alternative = "";

Expand Down Expand Up @@ -83,14 +162,14 @@ public class ArtistRunConfig {
public String oatGroup = "";
public String oatPermissions = "";

public InputFiles input_files = new InputFiles();

@Override
public String toString() {
return "ArtistRunConfig {" + "\n" +
" api_level= '" + api_level + '\'' + "\n" +
", app_folder_path= '" + app_folder_path + '\'' + "\n" +
", app_apk_file_path= '" + app_apk_file_path + '\'' + "\n" +
", app_apk_merged_file_path= '" + app_apk_merged_file_path + '\'' + "\n" +
", app_apk_merged_signed_file_path= '" + app_apk_merged_signed_file_path + '\'' + "\n" +
", input_files= '" + input_files + '\'' + "\n" +
", app_apk_file_path_alternative= '" + app_apk_file_path_alternative + '\'' + "\n" +
", app_oat_folder_path= '" + app_oat_folder_path + '\'' + "\n" +
", app_oat_file_path= '" + app_oat_file_path + '\'' + "\n" +
Expand Down
Loading