From d633c967ceb37f2bc91592b6aeb057383fb2f262 Mon Sep 17 00:00:00 2001
From: Parthipan Ramesh
Date: Thu, 7 Jun 2018 11:24:43 +0200
Subject: [PATCH 1/2] Update Room and Constraint layout dependencies
---
app/build.gradle | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/build.gradle b/app/build.gradle
index 1fbad1f..5113823 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -80,12 +80,12 @@ dependencies {
implementation project(':dexterous')
implementation "com.android.support:appcompat-v7:$supportLibVersion"
- implementation 'com.android.support.constraint:constraint-layout:1.0.2'
+ implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation "com.android.support:design:$supportLibVersion"
implementation "com.android.support:support-v13:$supportLibVersion"
- implementation "android.arch.persistence.room:runtime:1.0.0"
- annotationProcessor "android.arch.persistence.room:compiler:1.0.0"
+ implementation "android.arch.persistence.room:runtime:1.1.0"
+ annotationProcessor "android.arch.persistence.room:compiler:1.1.0"
api 'com.madgag.spongycastle:core:1.54.0.0'
api 'com.madgag.spongycastle:pkix:1.54.0.0'
From a1c018d18340bd6181ae15d27b0396df58eebcb3 Mon Sep 17 00:00:00 2001
From: Parthipan Ramesh
Date: Mon, 4 Jun 2018 16:15:43 +0200
Subject: [PATCH 2/2] Logging: Use LogA class from dexterous
We should call the logging methods from the LogA class which uses
trikita.log (uses internally android.util.log) while respecting
the user log level preference.
---
.../cispa/artist/artistgui/InfoFragment.java | 4 +-
.../appdetails/AppDetailsDialogPresenter.java | 4 +-
.../instrumentation/ArtistThread.java | 4 +-
.../InstrumentationService.java | 13 +-
.../instrumentation/InstrumentationTask.java | 10 +-
.../instrumentation/ServiceController.java | 6 +-
.../stages/InstrumentationStagesImpl.java | 118 +++++++++---------
.../artistgui/settings/SettingsActivity.java | 4 +-
.../artistgui/settings/SettingsPresenter.java | 9 +-
.../settings/config/ArtistConfigFactory.java | 8 +-
.../artist/artistgui/utils/AndroidUtils.java | 83 ++++++------
.../artist/artistgui/utils/ArtistUtils.java | 7 +-
.../artistgui/utils/ProcessExecutor.java | 35 +++---
.../artist/artistgui/utils/StringUtils.java | 5 +-
.../artist/artistgui/utils/UriUtils.java | 11 +-
dexterous | 2 +-
16 files changed, 163 insertions(+), 160 deletions(-)
diff --git a/app/src/main/java/saarland/cispa/artist/artistgui/InfoFragment.java b/app/src/main/java/saarland/cispa/artist/artistgui/InfoFragment.java
index 1e7c032..e97d504 100644
--- a/app/src/main/java/saarland/cispa/artist/artistgui/InfoFragment.java
+++ b/app/src/main/java/saarland/cispa/artist/artistgui/InfoFragment.java
@@ -33,7 +33,7 @@
import java.io.InputStream;
import saarland.cispa.artist.artistgui.utils.StringUtils;
-import trikita.log.Log;
+import saarland.cispa.utils.LogA;
public class InfoFragment extends Fragment {
@@ -88,7 +88,7 @@ private void setupTextView() {
}
} catch (final IOException e) {
- Log.e(TAG, "Could not read Artist Version files from assets.", e);
+ LogA.e(TAG, "Could not read Artist Version files from assets.", e);
}
mTextView.append("\n\n");
diff --git a/app/src/main/java/saarland/cispa/artist/artistgui/appdetails/AppDetailsDialogPresenter.java b/app/src/main/java/saarland/cispa/artist/artistgui/appdetails/AppDetailsDialogPresenter.java
index 6feb868..b9b13bb 100644
--- a/app/src/main/java/saarland/cispa/artist/artistgui/appdetails/AppDetailsDialogPresenter.java
+++ b/app/src/main/java/saarland/cispa/artist/artistgui/appdetails/AppDetailsDialogPresenter.java
@@ -45,7 +45,7 @@
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 trikita.log.Log;
+import saarland.cispa.utils.LogA;
public class AppDetailsDialogPresenter implements AppDetailsDialogContract.Presenter {
@@ -174,7 +174,7 @@ private void startInstrumentedAppIfWished() {
final boolean launchActivity = mSettingsManager.shouldLaunchActivityAfterCompilation();
if (launchActivity) {
String packageName = mSelectedPackage.packageName;
- Log.d(TAG, "Starting compiled app: " + packageName);
+ LogA.d(TAG, "Starting compiled app: " + packageName);
final Intent launchIntent = mContext.getPackageManager()
.getLaunchIntentForPackage(packageName);
mContext.startActivity(launchIntent);
diff --git a/app/src/main/java/saarland/cispa/artist/artistgui/instrumentation/ArtistThread.java b/app/src/main/java/saarland/cispa/artist/artistgui/instrumentation/ArtistThread.java
index c3fd236..6bb0d26 100644
--- a/app/src/main/java/saarland/cispa/artist/artistgui/instrumentation/ArtistThread.java
+++ b/app/src/main/java/saarland/cispa/artist/artistgui/instrumentation/ArtistThread.java
@@ -1,7 +1,7 @@
package saarland.cispa.artist.artistgui.instrumentation;
import saarland.cispa.artist.artistgui.instrumentation.exceptions.ArtistInterruptedException;
-import trikita.log.Log;
+import saarland.cispa.utils.LogA;
/**
* The ARTist Project (https://artist.cispa.saarland)
@@ -30,7 +30,7 @@ class ArtistThread {
static void checkThreadCancellation() throws ArtistInterruptedException {
if (Thread.currentThread().isInterrupted()) {
- Log.d(TAG, String.format("checkThreadCancellation() interrupted[%b]",
+ LogA.d(TAG, String.format("checkThreadCancellation() interrupted[%b]",
Thread.currentThread().isInterrupted()));
throw new ArtistInterruptedException("Thread is interrupted.");
}
diff --git a/app/src/main/java/saarland/cispa/artist/artistgui/instrumentation/InstrumentationService.java b/app/src/main/java/saarland/cispa/artist/artistgui/instrumentation/InstrumentationService.java
index 06088fc..a4cb730 100644
--- a/app/src/main/java/saarland/cispa/artist/artistgui/instrumentation/InstrumentationService.java
+++ b/app/src/main/java/saarland/cispa/artist/artistgui/instrumentation/InstrumentationService.java
@@ -31,7 +31,6 @@
import saarland.cispa.artist.artistgui.instrumentation.progress.ProgressPublisher;
import saarland.cispa.utils.LogA;
-import trikita.log.Log;
public class InstrumentationService extends Service {
@@ -76,7 +75,7 @@ public InstrumentationService() {
@Override
public void onCreate() {
super.onCreate();
- Log.i(TAG, "CompilationService()");
+ LogA.i(TAG, "CompilationService()");
LogA.setUserLogLevel(getApplicationContext());
mServiceController = new ServiceController(this);
@@ -87,11 +86,11 @@ public void onCreate() {
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
- Log.d(TAG, "onStartCommand()");
+ LogA.d(TAG, "onStartCommand()");
if (intent != null) {
final String packageName = intent.getStringExtra(INTENT_KEY_APP_NAME);
if (packageName != null && !packageName.isEmpty()) {
- Log.d(TAG, "onStartCommand() Extra: " + packageName);
+ LogA.d(TAG, "onStartCommand() Extra: " + packageName);
instrumentApp(packageName);
}
}
@@ -112,7 +111,7 @@ public IBinder onBind(Intent intent) {
@Override
public void onRebind(Intent intent) {
- Log.d(TAG, "onRebind()");
+ LogA.d(TAG, "onRebind()");
// A client is binding to the service with bindService(),
// after onUnbind() has already been called
mClientsBoundToService = true;
@@ -120,7 +119,7 @@ public void onRebind(Intent intent) {
@Override
public boolean onUnbind(Intent intent) {
- Log.d(TAG, "onUnbind()");
+ LogA.d(TAG, "onUnbind()");
mClientsBoundToService = false;
stopIfNothingToDo();
return ALLOW_REBIND;
@@ -129,7 +128,7 @@ public boolean onUnbind(Intent intent) {
@Override
public void onDestroy() {
super.onDestroy();
- Log.i(TAG, "onDestroy()");
+ LogA.i(TAG, "onDestroy()");
LocalBroadcastManager.getInstance(this).unregisterReceiver(mResultReceiver);
}
diff --git a/app/src/main/java/saarland/cispa/artist/artistgui/instrumentation/InstrumentationTask.java b/app/src/main/java/saarland/cispa/artist/artistgui/instrumentation/InstrumentationTask.java
index ee6e4be..2f10432 100644
--- a/app/src/main/java/saarland/cispa/artist/artistgui/instrumentation/InstrumentationTask.java
+++ b/app/src/main/java/saarland/cispa/artist/artistgui/instrumentation/InstrumentationTask.java
@@ -30,7 +30,7 @@
import saarland.cispa.artist.artistgui.instrumentation.stages.InstrumentationStages;
import saarland.cispa.artist.artistgui.instrumentation.stages.InstrumentationStagesImpl;
import saarland.cispa.artist.artistgui.instrumentation.exceptions.ArtistInterruptedException;
-import trikita.log.Log;
+import saarland.cispa.utils.LogA;
class InstrumentationTask implements Runnable {
@@ -50,10 +50,10 @@ 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, "> codeLibName: " + mRunConfig.codeLibName);
- Log.i(TAG, "> Keystore: " + mRunConfig.keystore);
+ LogA.i(TAG, "Run() compiling and starting " + mRunConfig.app_package_name);
+ LogA.i(TAG, "> apkPath: " + mRunConfig.app_apk_file_path);
+ LogA.i(TAG, "> codeLibName: " + mRunConfig.codeLibName);
+ LogA.i(TAG, "> Keystore: " + mRunConfig.keystore);
try {
ArtistThread.checkThreadCancellation();
diff --git a/app/src/main/java/saarland/cispa/artist/artistgui/instrumentation/ServiceController.java b/app/src/main/java/saarland/cispa/artist/artistgui/instrumentation/ServiceController.java
index 70a7d39..b516047 100644
--- a/app/src/main/java/saarland/cispa/artist/artistgui/instrumentation/ServiceController.java
+++ b/app/src/main/java/saarland/cispa/artist/artistgui/instrumentation/ServiceController.java
@@ -37,7 +37,7 @@
import saarland.cispa.artist.artistgui.instrumentation.progress.ProgressPublisher;
import saarland.cispa.artist.artistgui.settings.config.ArtistConfigFactory;
import saarland.cispa.artist.artistgui.utils.ProcessExecutor;
-import trikita.log.Log;
+import saarland.cispa.utils.LogA;
class ServiceController implements IServiceController {
@@ -67,7 +67,7 @@ public void moveToForeground(Service service) {
@Override
public void instrument(String packageName) {
- Log.d(TAG, String.format("instrument(%s)", packageName));
+ LogA.d(TAG, String.format("instrument(%s)", packageName));
InstrumentationTask task = createInstrumentationTask(packageName);
if (!mInstrumentationQueue.contains(task)) {
createOrRestartThreadPool();
@@ -90,7 +90,7 @@ private void createOrRestartThreadPool() {
@Override
public void cancel() {
- Log.d(TAG, "cancel()");
+ LogA.d(TAG, "cancel()");
mInstrumentationQueue.clear();
if (mThreadPool != null) {
mThreadPool.shutdownNow();
diff --git a/app/src/main/java/saarland/cispa/artist/artistgui/instrumentation/stages/InstrumentationStagesImpl.java b/app/src/main/java/saarland/cispa/artist/artistgui/instrumentation/stages/InstrumentationStagesImpl.java
index c25fd07..a93d60f 100644
--- a/app/src/main/java/saarland/cispa/artist/artistgui/instrumentation/stages/InstrumentationStagesImpl.java
+++ b/app/src/main/java/saarland/cispa/artist/artistgui/instrumentation/stages/InstrumentationStagesImpl.java
@@ -36,7 +36,7 @@
import saarland.cispa.artist.artistgui.utils.ProcessExecutor;
import saarland.cispa.dexterous.Dexterous;
import saarland.cispa.dexterous.MergeConfig;
-import trikita.log.Log;
+import saarland.cispa.utils.LogA;
public class InstrumentationStagesImpl implements InstrumentationStages {
@@ -87,7 +87,7 @@ private void cleanOldBuildFiles() {
}
private void setupKeystore() {
- Log.d(TAG, "setupKeystore()");
+ LogA.d(TAG, "setupKeystore()");
reportProgressDetails("KeyStore: " + mRunConfig.keystore);
AndroidUtils.copyAsset(mContext, mRunConfig.asset_path_keystore,
mRunConfig.keystore.getAbsolutePath());
@@ -97,8 +97,8 @@ private String extractDex2Oat() throws InstrumentationException {
final String pathDex2oat = copyAssetToFilesDir(mContext,
mRunConfig.asset_path_dex2oat,
mRunConfig.artist_exec_path_dex2oat);
- Log.i(TAG, "> pathDex2oat: " + pathDex2oat);
- Log.i(TAG, " > config: " + mRunConfig.artist_exec_path_dex2oat);
+ LogA.i(TAG, "> pathDex2oat: " + pathDex2oat);
+ LogA.i(TAG, " > config: " + mRunConfig.artist_exec_path_dex2oat);
if (pathDex2oat.isEmpty()) {
throw new InstrumentationException("Artist: Dex2oat Setup failed");
@@ -122,7 +122,7 @@ private String copyAssetToFilesDir(final Context context,
}
private void setupArtistLibraries() {
- Log.d(TAG, "setupArtistLibraries()");
+ LogA.d(TAG, "setupArtistLibraries()");
reportProgressDetails("Copying Libraries to: " + mRunConfig.artist_exec_path_libs_dir);
// Example Permissions: /data/app/com.deepinc.arte360-1/lib/arm/
// -rwxr-xr-x 1 system system 511044 2016-05-05 17:30 libTBAudioEngine.so
@@ -140,7 +140,7 @@ public void probePermissionAndDeleteOatFile() {
mRunConfig.oatGroup = AndroidUtils.getFileGroupId(mRunConfig.app_oat_file_path);
mRunConfig.oatPermissions = AndroidUtils.getFilePermissions(mRunConfig.app_oat_file_path);
mRunConfig.stats.oatFileSizeOriginal = new File(mRunConfig.app_oat_file_path).length();
- Log.d(TAG, String.format("base.odex UID: %s GID: %s Permissions: %s Size: %s",
+ LogA.d(TAG, String.format("base.odex UID: %s GID: %s Permissions: %s Size: %s",
mRunConfig.oatOwner,
mRunConfig.oatGroup,
mRunConfig.oatPermissions,
@@ -149,7 +149,7 @@ public void probePermissionAndDeleteOatFile() {
reportProgressDetails("Deleting existing oat file: " + mRunConfig.app_oat_file_path);
boolean success = deleteRootFile(mRunConfig.app_oat_file_path);
if (!success) {
- Log.d(TAG, String.format("Failed to delete old base oat: %s - Continue", mRunConfig.app_oat_file_path));
+ LogA.d(TAG, String.format("Failed to delete old base oat: %s - Continue", mRunConfig.app_oat_file_path));
}
}
@@ -161,7 +161,7 @@ private boolean deleteRootFile(final String filePath) {
@Override
public void mergeCodeLib() throws InstrumentationException {
- Log.d(TAG, "MergeCodeLib into: " + mRunConfig.app_apk_file_path);
+ LogA.d(TAG, "MergeCodeLib into: " + mRunConfig.app_apk_file_path);
String pathToApkSigned;
// deactivate injection upon user wish or if no code lib is provided
@@ -180,44 +180,44 @@ public void mergeCodeLib() throws InstrumentationException {
dexterous.mergeCodeLib();
final String pathToApk = dexterous.buildApk();
reportProgressDetails("Resigning APK");
- Log.d(TAG, String.format("MergeCodeLib DONE (%s)", pathToApk));
+ LogA.d(TAG, String.format("MergeCodeLib DONE (%s)", pathToApk));
pathToApkSigned = resignApk(pathToApk);
- Log.d(TAG, String.format("MergeCodeLib Signing DONE (%s)", pathToApkSigned));
+ LogA.d(TAG, String.format("MergeCodeLib Signing DONE (%s)", pathToApkSigned));
if (pathToApkSigned.isEmpty()) {
throw new InstrumentationException("Codelib Merge Failed");
}
} else {
reportProgressDetails("Not Injecting CodeLib");
- Log.i(TAG, "Skip CodeLib Injection");
- Log.d(TAG, "MergeCodeLib SKIPPED");
+ LogA.i(TAG, "Skip CodeLib Injection");
+ LogA.d(TAG, "MergeCodeLib SKIPPED");
}
}
private void setupCodeLib() {
if (mRunConfig.codeLibName.startsWith(ArtistUtils.CODELIB_ASSET)) {
- Log.d(TAG, "setupCodeLib() " + mRunConfig.codeLibName);
+ LogA.d(TAG, "setupCodeLib() " + mRunConfig.codeLibName);
final String assetName = mRunConfig.codeLibName.replaceFirst(ArtistUtils.CODELIB_ASSET, "");
AndroidUtils.copyAsset(mContext, "codelib" + File.separator + assetName,
mRunConfig.codeLib.getAbsolutePath());
if (!mRunConfig.codeLib.exists()) {
- Log.e(TAG, " setupCodeLib: " + mRunConfig.codeLib + " FAILED");
+ LogA.e(TAG, " setupCodeLib: " + mRunConfig.codeLib + " FAILED");
} else {
- Log.d(TAG, " setupCodeLib: " + mRunConfig.codeLib + " READY");
+ LogA.d(TAG, " setupCodeLib: " + mRunConfig.codeLib + " READY");
}
}
}
private String resignApk(final String unsignedApkPath) {
- Log.d(TAG, "resignApk() " + unsignedApkPath);
+ LogA.d(TAG, "resignApk() " + unsignedApkPath);
String signedApkPath;
final ApkSigner apkSir = new ApkZipSir(mRunConfig.app_apk_merged_signed_file_path);
try {
signedApkPath = apkSir.signApk(mRunConfig.keystore.getAbsolutePath(), unsignedApkPath);
} catch (final IllegalArgumentException e) {
- Log.e(TAG, "> Signing of APK Failed", e);
+ LogA.e(TAG, "> Signing of APK Failed", e);
signedApkPath = "";
}
return signedApkPath;
@@ -225,7 +225,7 @@ private String resignApk(final String unsignedApkPath) {
@Override
public void backupMergedApk() {
- Log.v(TAG, "backupMergedApk()");
+ LogA.v(TAG, "backupMergedApk()");
final File externalStorage = mContext.getExternalFilesDir(null);
if (externalStorage != null) {
final String mergedApkBackupPath = externalStorage.getAbsolutePath() + File.separator
@@ -240,9 +240,9 @@ public void backupMergedApk() {
ProcessExecutor.processName(mRunConfig.app_package_name, "cp_backup_merged"));
if (success) {
- Log.d(TAG, "backupMergedApk() Success: " + mergedApkBackupPath);
+ LogA.d(TAG, "backupMergedApk() Success: " + mergedApkBackupPath);
} else {
- Log.e(TAG, "backupMergedApk() Failed: " + mergedApkBackupPath);
+ LogA.e(TAG, "backupMergedApk() Failed: " + mergedApkBackupPath);
}
}
}
@@ -251,28 +251,28 @@ public void backupMergedApk() {
public void runDex2OatCompilation(String pathDex2oat) throws InstrumentationException {
final String cmd_dex2oat_compile = setupDex2oatCommand(pathDex2oat);
- Log.d(TAG, "dex2oat command:");
- Log.d(TAG, cmd_dex2oat_compile);
- Log.d(TAG, "Starting the compilation process!");
- Log.d(TAG, "> Result will get placed at: " + mRunConfig.app_oat_file_path);
+ LogA.d(TAG, "dex2oat command:");
+ LogA.d(TAG, cmd_dex2oat_compile);
+ LogA.d(TAG, "Starting the compilation process!");
+ LogA.d(TAG, "> Result will get placed at: " + mRunConfig.app_oat_file_path);
final String divider = "########################################################";
- Log.d(TAG, divider);
- Log.d(TAG, divider);
- Log.d(TAG, divider);
+ LogA.d(TAG, divider);
+ LogA.d(TAG, divider);
+ LogA.d(TAG, divider);
boolean success = ProcessExecutor.execute(cmd_dex2oat_compile, true,
ProcessExecutor.processName(mRunConfig.app_package_name, "dex2artist"));
- Log.d(TAG, divider);
- Log.d(TAG, divider);
- Log.d(TAG, divider);
+ LogA.d(TAG, divider);
+ LogA.d(TAG, divider);
+ LogA.d(TAG, divider);
if (success) {
- Log.d(TAG, "Compilation was successfull");
+ LogA.d(TAG, "Compilation was successfull");
} else {
- Log.d(TAG, "Compilation failed...");
+ LogA.d(TAG, "Compilation failed...");
throw new InstrumentationException("Artist Injection Failed");
}
}
@@ -300,25 +300,25 @@ private String setupDex2oatCommand(final String pathDex2oat) {
if (mRunConfig.COMPILER_THREADS != -1) {
cmd_dex2oat_compile += " -j" + mRunConfig.COMPILER_THREADS;
- Log.d(TAG, "Dex2oat: Compiler Threads: " + mRunConfig.COMPILER_THREADS);
+ LogA.d(TAG, "Dex2oat: Compiler Threads: " + mRunConfig.COMPILER_THREADS);
} else {
- Log.d(TAG, "Dex2oat: Compiler Threads: ");
+ LogA.d(TAG, "Dex2oat: Compiler Threads: ");
}
- Log.d(TAG, "Dex2oat: app_oat_architecture: " + mRunConfig.app_oat_architecture);
+ LogA.d(TAG, "Dex2oat: app_oat_architecture: " + mRunConfig.app_oat_architecture);
if (mRunConfig.app_oat_architecture.contains("x86_64")) {
- Log.d(TAG, "Dex2oat: Architecture: x86_64");
+ LogA.d(TAG, "Dex2oat: Architecture: x86_64");
// @FYI: ARTist only compiles on the x86_64 emulator with: " --instruction-set=x86"
// but doesn't start the instrumented app
cmd_dex2oat_compile += " --instruction-set=x86_64";
cmd_dex2oat_compile += " --instruction-set-variant=atom";
} else if (mRunConfig.app_oat_architecture.contains("x86")
&& !mRunConfig.app_oat_architecture.contains("x86_64")) {
- Log.d(TAG, "Dex2oat: Architecture: x86");
+ LogA.d(TAG, "Dex2oat: Architecture: x86");
cmd_dex2oat_compile += " --instruction-set=x86";
cmd_dex2oat_compile += " --instruction-set-variant=atom";
} else if (mRunConfig.app_oat_architecture.contains("arm64")) {
- Log.d(TAG, "Dex2oat: Architecture: arm64");
+ LogA.d(TAG, "Dex2oat: Architecture: arm64");
// ARM64 Special Flags
cmd_dex2oat_compile += " --instruction-set=arm64";
if (PIXEL_PHONE_ANDROID_8) {
@@ -327,16 +327,16 @@ private String setupDex2oatCommand(final String pathDex2oat) {
cmd_dex2oat_compile += " --instruction-set-variant=denver64";
}
// ARM64 Special Flags END
- Log.d(TAG, "Compiling for 64bit Architecture!");
+ LogA.d(TAG, "Compiling for 64bit Architecture!");
} else {
- Log.w(TAG, "Dex2oat: Architecture: ");
+ LogA.w(TAG, "Dex2oat: Architecture: ");
}
// ////////////////////////////////////////////
//
// smp does not exist anymore on Android 8.0 Oreo !
//
if (Build.HARDWARE.equals("ranchu")) {
- Log.d(TAG, "Dex2oat: InstructionSet: ");
+ LogA.d(TAG, "Dex2oat: InstructionSet: ");
// cmd_dex2oat_compile += " --instruction-set-features=smp";
cmd_dex2oat_compile += " --instruction-set-features=default";
//
@@ -351,21 +351,21 @@ private String setupDex2oatCommand(final String pathDex2oat) {
// cmd_dex2oat_compile += " --instruction-set-features=smp,ssse3,sse4.1,sse4.2,-avx,-avx2";
// cmd_dex2oat_compile += " --instruction-set-features=default";
} else if (mRunConfig.app_oat_architecture.contains("x86")) {
- Log.d(TAG, "Dex2oat: InstructionSet: x86*");
+ LogA.d(TAG, "Dex2oat: InstructionSet: x86*");
cmd_dex2oat_compile += " --instruction-set-features=smp,ssse3,sse4.1,sse4.2,-avx,-avx2";
cmd_dex2oat_compile += " --instruction-set-features=default";
} else if (mRunConfig.app_oat_architecture.contains("arm64") && PIXEL_PHONE_ANDROID_8) {
- Log.d(TAG, "Dex2oat: InstructionSet: arm64 (Pixel Phone)");
+ LogA.d(TAG, "Dex2oat: InstructionSet: arm64 (Pixel Phone)");
// ARM64 Special Flags
cmd_dex2oat_compile += " --instruction-set-features=default";
} else if (mRunConfig.app_oat_architecture.contains("arm64")) {
- Log.d(TAG, "Dex2oat: InstructionSet: arm64*");
+ LogA.d(TAG, "Dex2oat: InstructionSet: arm64*");
// smp does not exist anymore on Android 8.0 Oreo
cmd_dex2oat_compile += " --instruction-set-features=smp,a53";
cmd_dex2oat_compile += " --instruction-set-features=default";
- Log.d(TAG, "Dex2oat: ranchu (emulator)");
+ LogA.d(TAG, "Dex2oat: ranchu (emulator)");
} else {
- Log.w(TAG, "Dex2oat: InstructionSet: ");
+ LogA.w(TAG, "Dex2oat: InstructionSet: ");
cmd_dex2oat_compile += " --instruction-set-features=default";
}
return cmd_dex2oat_compile;
@@ -376,47 +376,47 @@ public boolean setOatFilePermissions() {
boolean success = false;
final File oatFile = new File(this.mRunConfig.app_oat_file_path);
if (oatFile.exists() && !oatFile.isDirectory()) {
- Log.d(TAG, "Success! Oat file created.");
+ LogA.d(TAG, "Success! Oat file created.");
reportProgressDetails("Fixing oat file permissions");
mRunConfig.stats.oatFileSizeRecompiled = oatFile.length();
reportProgressDetails("odex OLD size: " + mRunConfig.stats.oatFileSizeOriginal);
- Log.d(TAG, "odex OLD size: " + mRunConfig.stats.oatFileSizeOriginal);
+ LogA.d(TAG, "odex OLD size: " + mRunConfig.stats.oatFileSizeOriginal);
reportProgressDetails("odex NEW size: " + mRunConfig.stats.oatFileSizeRecompiled);
- Log.d(TAG, "odex NEW size: " + mRunConfig.stats.oatFileSizeRecompiled);
+ LogA.d(TAG, "odex NEW size: " + mRunConfig.stats.oatFileSizeRecompiled);
- Log.d(TAG, "Changing the owner of the oat file to " + mRunConfig.oatOwner);
+ LogA.d(TAG, "Changing the owner of the oat file to " + mRunConfig.oatOwner);
final String cmd_chown_oat = "chown " + mRunConfig.oatOwner + " " + this.mRunConfig.app_oat_file_path;
success = ProcessExecutor.execute(cmd_chown_oat, true, ProcessExecutor.processName(mRunConfig.app_package_name, "chown_oatfile"));
if (!success) {
- Log.d(TAG, "Could not change oat owner to " + mRunConfig.oatOwner + "... ");
- Log.d(TAG, "... for path " + this.mRunConfig.app_oat_file_path);
+ LogA.d(TAG, "Could not change oat owner to " + mRunConfig.oatOwner + "... ");
+ LogA.d(TAG, "... for path " + this.mRunConfig.app_oat_file_path);
return success;
}
- Log.d(TAG, "Changing the group of the oat file to " + mRunConfig.oatGroup);
+ LogA.d(TAG, "Changing the group of the oat file to " + mRunConfig.oatGroup);
final String cmd_chgrp_oat = "chgrp " + mRunConfig.oatGroup + " " + this.mRunConfig.app_oat_file_path;
success = ProcessExecutor.execute(cmd_chgrp_oat, true, ProcessExecutor.processName(mRunConfig.app_package_name, "chgrp_oatfile"));
if (!success) {
- Log.d(TAG, "Could not change oat group to " + mRunConfig.oatGroup + "... ");
- Log.d(TAG, "... for path " + this.mRunConfig.app_oat_file_path);
+ LogA.d(TAG, "Could not change oat group to " + mRunConfig.oatGroup + "... ");
+ LogA.d(TAG, "... for path " + this.mRunConfig.app_oat_file_path);
return success;
}
success = AndroidUtils.chmodExecutable(this.mRunConfig.app_oat_file_path);
if (!success) {
- Log.d(TAG, "Could not change oat permissions to 777");
- Log.d(TAG, "... for path " + this.mRunConfig.app_oat_file_path);
+ LogA.d(TAG, "Could not change oat permissions to 777");
+ LogA.d(TAG, "... for path " + this.mRunConfig.app_oat_file_path);
return success;
}
- Log.d(TAG, "Everything worked out as expected!!!");
+ LogA.d(TAG, "Everything worked out as expected!!!");
} else {
- Log.d(TAG, "Fail! Oat file not created.");
+ LogA.d(TAG, "Fail! Oat file not created.");
}
return success;
}
diff --git a/app/src/main/java/saarland/cispa/artist/artistgui/settings/SettingsActivity.java b/app/src/main/java/saarland/cispa/artist/artistgui/settings/SettingsActivity.java
index 15f577e..a8132ce 100644
--- a/app/src/main/java/saarland/cispa/artist/artistgui/settings/SettingsActivity.java
+++ b/app/src/main/java/saarland/cispa/artist/artistgui/settings/SettingsActivity.java
@@ -26,7 +26,7 @@
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
-import trikita.log.Log;
+import saarland.cispa.utils.LogA;
public class SettingsActivity extends Activity {
@@ -66,7 +66,7 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis
@Override
public void onActivityResult(final int requestCode, final int resultCode,
final Intent resultData) {
- Log.d(TAG, "SettingsActivity.onActivityResult()");
+ LogA.d(TAG, "SettingsActivity.onActivityResult()");
if (requestCode == SettingsPresenter.READ_EXTERNAL_STORAGE_REQUEST_CODE
&& resultCode == Activity.RESULT_OK) {
diff --git a/app/src/main/java/saarland/cispa/artist/artistgui/settings/SettingsPresenter.java b/app/src/main/java/saarland/cispa/artist/artistgui/settings/SettingsPresenter.java
index 5cb79a9..a0df705 100644
--- a/app/src/main/java/saarland/cispa/artist/artistgui/settings/SettingsPresenter.java
+++ b/app/src/main/java/saarland/cispa/artist/artistgui/settings/SettingsPresenter.java
@@ -42,7 +42,6 @@
import saarland.cispa.artist.artistgui.utils.ArtistUtils;
import saarland.cispa.utils.LogA;
import saarland.cispa.artist.artistgui.utils.UriUtils;
-import trikita.log.Log;
class SettingsPresenter implements SettingsContract.Presenter {
@@ -139,13 +138,13 @@ public void setupCodeLibSelection(ListPreference codeLibSelection) {
public void setupCodeLibImport(final Activity activity, Preference codeLibPref) {
codeLibPref.setOnPreferenceClickListener((Preference preference) ->
{
- Log.d(TAG, "performFileSearch()");
+ LogA.d(TAG, "performFileSearch()");
final int permissionCheck = activity
.checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE);
if (permissionCheck != PackageManager.PERMISSION_GRANTED) {
- Log.d(TAG, "Requesting Permission: " + Manifest.permission.READ_EXTERNAL_STORAGE);
+ LogA.d(TAG, "Requesting Permission: " + Manifest.permission.READ_EXTERNAL_STORAGE);
activity.requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
READ_EXTERNAL_STORAGE_REQUEST_CODE);
} else {
@@ -181,7 +180,7 @@ public void processChosenCodeLib(Intent resultData) {
final String pathToCodeLib =
AndroidUtils.copyUriToFilesystem(mContext, uri, toPath);
if (!pathToCodeLib.isEmpty()) {
- Log.i(TAG, "CodeLib copied: " + pathToCodeLib);
+ LogA.i(TAG, "CodeLib copied: " + pathToCodeLib);
}
}
}
@@ -203,7 +202,7 @@ private String[] listAssetCodeLibs() {
}
} catch (final IOException e) {
- Log.e(TAG, "Could not open assetfolder: ", e);
+ LogA.e(TAG, "Could not open assetfolder: ", e);
}
return cleanedAssetCodeLibs.toArray(new String[0]);
diff --git a/app/src/main/java/saarland/cispa/artist/artistgui/settings/config/ArtistConfigFactory.java b/app/src/main/java/saarland/cispa/artist/artistgui/settings/config/ArtistConfigFactory.java
index 86cbff5..8f8c989 100644
--- a/app/src/main/java/saarland/cispa/artist/artistgui/settings/config/ArtistConfigFactory.java
+++ b/app/src/main/java/saarland/cispa/artist/artistgui/settings/config/ArtistConfigFactory.java
@@ -35,7 +35,7 @@
import saarland.cispa.artist.artistgui.instrumentation.config.ArtistRunConfig;
import saarland.cispa.artist.artistgui.utils.AndroidUtils;
import saarland.cispa.artist.artistgui.utils.ArtistUtils;
-import trikita.log.Log;
+import saarland.cispa.utils.LogA;
/**
* @author Sebastian Weisgerber (weisgerber@cispa.saarland)
@@ -110,9 +110,9 @@ public static ArtistRunConfig buildArtistRunConfig(final Context context, final
Field fieldSecondaryCpuAbi = ApplicationInfo.class.getDeclaredField("secondaryCpuAbi");
artistConfig.secondaryCpuAbi = (String) fieldSecondaryCpuAbi.get(context.getApplicationInfo());
} catch (final NoSuchFieldException | IllegalAccessException e) {
- Log.e(TAG, "Getting ApplicationInfo FAILED", e);
+ LogA.e(TAG, "Getting ApplicationInfo FAILED", e);
}
- Log.i(TAG, artistConfig.toString());
+ LogA.i(TAG, artistConfig.toString());
return artistConfig;
}
@@ -141,7 +141,7 @@ private static PackageInfo getPackageInfo(final Context context, final String ap
try {
packageInfo = context.getPackageManager().getPackageInfo(app_name, 0);
} catch (PackageManager.NameNotFoundException e) {
- Log.e(TAG, "Could not find packge: " + app_name);
+ LogA.e(TAG, "Could not find packge: " + app_name);
}
return packageInfo;
}
diff --git a/app/src/main/java/saarland/cispa/artist/artistgui/utils/AndroidUtils.java b/app/src/main/java/saarland/cispa/artist/artistgui/utils/AndroidUtils.java
index 917c3ba..1e4b776 100644
--- a/app/src/main/java/saarland/cispa/artist/artistgui/utils/AndroidUtils.java
+++ b/app/src/main/java/saarland/cispa/artist/artistgui/utils/AndroidUtils.java
@@ -30,7 +30,8 @@
import java.io.IOException;
import java.io.InputStream;
-import trikita.log.Log;
+import saarland.cispa.utils.LogA;
+
public class AndroidUtils {
@@ -51,7 +52,7 @@ public static void copyAssetFolderContent(final Context context,
final String toFolderPath) {
final String cleanedAssetFolderPath = prepareAssetFolderPath(assetFolderPath);
- Log.d(TAG, "copyAssetFolderContent " + cleanedAssetFolderPath + " -> " + toFolderPath);
+ LogA.d(TAG, "copyAssetFolderContent " + cleanedAssetFolderPath + " -> " + toFolderPath);
final String filesDirFolder = createFoldersInFilesDir(context, toFolderPath);
try {
final String[] assetFiles = context.getAssets().list(cleanedAssetFolderPath);
@@ -60,7 +61,7 @@ public static void copyAssetFolderContent(final Context context,
copyAsset(context, assetFilePath, filesDirFolder + File.separator + assetFile);
}
} catch (final IOException e) {
- Log.e(TAG, "copyAssetFolderContent " + cleanedAssetFolderPath + " -> " + toFolderPath + " FAILED");
+ LogA.e(TAG, "copyAssetFolderContent " + cleanedAssetFolderPath + " -> " + toFolderPath + " FAILED");
}
}
@@ -70,7 +71,7 @@ public static String createFoldersInFilesDir(final Context context, final String
}
public static String createFolders(final String toFolderPath) {
- Log.d(TAG, "Create Folder(s): " + toFolderPath);
+ LogA.d(TAG, "Create Folder(s): " + toFolderPath);
final File toFolderFile = new File(toFolderPath);
if (!toFolderFile.exists()) {
toFolderFile.mkdirs();
@@ -108,7 +109,7 @@ public static void copyAsset(final Context context,
final String assetPath,
final String toPath,
final boolean rootCopy) {
- Log.d(TAG, "copyAsset() " + assetPath + " -> " + toPath);
+ LogA.d(TAG, "copyAsset() " + assetPath + " -> " + toPath);
deleteExistingFile(toPath);
@@ -121,9 +122,9 @@ public static void copyAsset(final Context context,
while ((read = in.read(buffer)) > 0) {
out.write(buffer, 0, read);
}
- Log.d(TAG, "copyAsset() " + assetPath + " -> " + toPath + " Done");
+ LogA.d(TAG, "copyAsset() " + assetPath + " -> " + toPath + " Done");
} catch (final IOException e) {
- Log.e(TAG, "copyAsset() " + assetPath + " -> " + toPath + " ERROR", e);
+ LogA.e(TAG, "copyAsset() " + assetPath + " -> " + toPath + " ERROR", e);
}
}
@@ -134,7 +135,7 @@ public static String getFileOwnerUid(final String path) {
final boolean success = ProcessExecutor.execute(cmd_stat_uid, true, returnValue);
if (!success) {
- Log.e(TAG, "ERROR with command: " + cmd_stat_uid);
+ LogA.e(TAG, "ERROR with command: " + cmd_stat_uid);
return "";
}
return removeAllWhitespaces(returnValue);
@@ -155,7 +156,7 @@ public static String getFileGroupId(final String path) {
final boolean success = ProcessExecutor.execute(cmd_stat_gid, true, returnValue);
if (!success) {
- Log.e(TAG, "ERROR with command: " + cmd_stat_gid);
+ LogA.e(TAG, "ERROR with command: " + cmd_stat_gid);
return "";
}
return removeAllWhitespaces(returnValue);
@@ -168,7 +169,7 @@ public static String getFilePermissions(final String path) {
final boolean success = ProcessExecutor.execute(cmd_stat_perms, true, returnValue);
if (!success) {
- Log.e(TAG, "ERROR with command: " + cmd_stat_perms);
+ LogA.e(TAG, "ERROR with command: " + cmd_stat_perms);
return "";
}
return removeAllWhitespaces(returnValue);
@@ -179,8 +180,8 @@ public static String getArchitectureFolderName() {
final String os_arch_property = System.getProperty("os.arch");
final String ro_product_cpu_abi_property = System.getProperty("ro.product.cpu.abi");
- Log.e(TAG, "SystemProperty os.arch: " + os_arch_property);
- Log.e(TAG, "SystemProperty ro.product.cpu.abi: " + ro_product_cpu_abi_property);
+ LogA.e(TAG, "SystemProperty os.arch: " + os_arch_property);
+ LogA.e(TAG, "SystemProperty ro.product.cpu.abi: " + ro_product_cpu_abi_property);
final String architecture;
@@ -206,7 +207,7 @@ public static String getArchitectureFolderName() {
|| os_arch_property.compareTo("mips") == 0) {
architecture = os_arch_property;
} else {
- Log.e(TAG, "Unrecognized architecture: " + os_arch_property);
+ LogA.e(TAG, "Unrecognized architecture: " + os_arch_property);
throw new RuntimeException("Unrecognized architecture: " + os_arch_property);
}
return architecture;
@@ -232,9 +233,9 @@ public static void setFilePermissions(final String path, final String octalForma
final boolean success = ProcessExecutor.execute(cmd_chmod_octal, true);
if (!success) {
- Log.e(TAG, "Command FAILED " + cmd_chmod_octal);
+ LogA.e(TAG, "Command FAILED " + cmd_chmod_octal);
} else {
- Log.d(TAG, "PERM Set " + path + " to: " + octalFormatPerms);
+ LogA.d(TAG, "PERM Set " + path + " to: " + octalFormatPerms);
}
}
@@ -245,9 +246,9 @@ public static void setFileGid(final String path, final String baseApkGid) {
final boolean success = ProcessExecutor.execute(cmd_chown_gid, true);
if (!success) {
- Log.e(TAG, "Command FAILED " + cmd_chown_gid);
+ LogA.e(TAG, "Command FAILED " + cmd_chown_gid);
} else {
- Log.d(TAG, "GID Set " + path + " to: " + baseApkGid);
+ LogA.d(TAG, "GID Set " + path + " to: " + baseApkGid);
}
}
@@ -258,9 +259,9 @@ public static void setFileUid(final String path, final String baseApkUid) {
final boolean success = ProcessExecutor.execute(cmd_chown_uid, true);
if (!success) {
- Log.e(TAG, "Command FAILED " + cmd_chown_uid);
+ LogA.e(TAG, "Command FAILED " + cmd_chown_uid);
} else {
- Log.d(TAG, "UID Set " + path + " to: " + baseApkUid);
+ LogA.d(TAG, "UID Set " + path + " to: " + baseApkUid);
}
}
@@ -270,14 +271,14 @@ public static boolean chmodExecutable(final String pathToFile) {
boolean success = ProcessExecutor.execute(cmd_chmod777, true);
if (!success) {
- Log.e(TAG, "Command Failed: " + cmd_chmod777);
+ LogA.e(TAG, "Command Failed: " + cmd_chmod777);
}
return success;
}
public static void deleteExistingFile(final File absoluteFile) {
if (absoluteFile.exists()) {
- Log.d(TAG, "delete() -> " + absoluteFile.getAbsolutePath());
+ LogA.d(TAG, "delete() -> " + absoluteFile.getAbsolutePath());
absoluteFile.delete();
}
}
@@ -287,7 +288,7 @@ public static void deleteExistingFile(final String filePath) {
}
public static String copyUriToFilesystem(final Context context, final Uri uri, final String toPathAbsolute) {
- Log.d(TAG, "copyUriToFilesystem() " + uri + " -> " + toPathAbsolute);
+ LogA.d(TAG, "copyUriToFilesystem() " + uri + " -> " + toPathAbsolute);
try (
InputStream in = context.getContentResolver().openInputStream(uri);
FileOutputStream out = new FileOutputStream(toPathAbsolute);
@@ -297,10 +298,10 @@ public static String copyUriToFilesystem(final Context context, final Uri uri, f
while ((read = in.read(buffer)) > 0) {
out.write(buffer, 0, read);
}
- Log.d(TAG, "copyUriToFilesystem() " + uri + " -> " + toPathAbsolute + " Done");
+ LogA.d(TAG, "copyUriToFilesystem() " + uri + " -> " + toPathAbsolute + " Done");
return toPathAbsolute;
} catch (final IOException e) {
- Log.e(TAG, "copyUriToFilesystem() " + uri + " -> " + toPathAbsolute + " ERROR", e);
+ LogA.e(TAG, "copyUriToFilesystem() " + uri + " -> " + toPathAbsolute + " ERROR", e);
//Convert your stream to data here
return "";
}
@@ -314,34 +315,34 @@ public static void suKill(final Process process) {
//
// 7481 root 20 0 25% R 2 506728K 122772K fg /data/user/0/de.infsec.artist.saarland.cispa.artist.artistgui/files/artist/dex2oat
final String processInfo = process.toString();
- Log.d(TAG, String.format("sukill(%s)", processInfo));
+ LogA.d(TAG, String.format("sukill(%s)", processInfo));
try {
final String[] parts = processInfo.split("pid=");
final String pid = parts[1].split(", hasExited")[0];
- Log.d(TAG, String.format("sukill(PID %s)", pid));
+ LogA.d(TAG, String.format("sukill(PID %s)", pid));
final String cmd_kill = "kill -9 " + pid;
- Log.d(TAG, String.format("sukill() Command: <%s>", cmd_kill));
+ LogA.d(TAG, String.format("sukill() Command: <%s>", cmd_kill));
ProcessExecutor.execute(cmd_kill, true, "kill_process");
} catch (final NullPointerException|ArrayIndexOutOfBoundsException e) {
- Log.d(TAG, String.format("sukill(%s) FAILED", processInfo));
+ LogA.d(TAG, String.format("sukill(%s) FAILED", processInfo));
}
- Log.d(TAG, String.format("sukill(%s) DONE", processInfo));
+ LogA.d(TAG, String.format("sukill(%s) DONE", processInfo));
}
public static void logBuildInformation() {
- Log.d(TAG, "Dex2oat: Build.BOOTLOADER: " + Build.BOOTLOADER);
- Log.d(TAG, "Dex2oat: Build.BRAND: " + Build.BRAND);
- Log.d(TAG, "Dex2oat: Build.DEVICE: " + Build.DEVICE);
- Log.d(TAG, "Dex2oat: Build.FINGERPRINT: " + Build.FINGERPRINT);
- Log.d(TAG, "Dex2oat: Build.HARDWARE: " + Build.HARDWARE);
- Log.d(TAG, "Dex2oat: Build.HOST: " + Build.HOST);
- Log.d(TAG, "Dex2oat: Build.ID: " + Build.ID);
- Log.d(TAG, "Dex2oat: Build.MANUFACTURER: " + Build.MANUFACTURER);
- Log.d(TAG, "Dex2oat: Build.MODEL: " + Build.MODEL);
- Log.d(TAG, "Dex2oat: Build.PRODUCT: " + Build.PRODUCT);
- Log.d(TAG, "Dex2oat: Build.SUPPORTED_64_BIT_ABIS: ");
+ LogA.d(TAG, "Dex2oat: Build.BOOTLOADER: " + Build.BOOTLOADER);
+ LogA.d(TAG, "Dex2oat: Build.BRAND: " + Build.BRAND);
+ LogA.d(TAG, "Dex2oat: Build.DEVICE: " + Build.DEVICE);
+ LogA.d(TAG, "Dex2oat: Build.FINGERPRINT: " + Build.FINGERPRINT);
+ LogA.d(TAG, "Dex2oat: Build.HARDWARE: " + Build.HARDWARE);
+ LogA.d(TAG, "Dex2oat: Build.HOST: " + Build.HOST);
+ LogA.d(TAG, "Dex2oat: Build.ID: " + Build.ID);
+ LogA.d(TAG, "Dex2oat: Build.MANUFACTURER: " + Build.MANUFACTURER);
+ LogA.d(TAG, "Dex2oat: Build.MODEL: " + Build.MODEL);
+ LogA.d(TAG, "Dex2oat: Build.PRODUCT: " + Build.PRODUCT);
+ LogA.d(TAG, "Dex2oat: Build.SUPPORTED_64_BIT_ABIS: ");
for (final String abi : Build.SUPPORTED_64_BIT_ABIS) {
- Log.d(TAG, " - ABI: " + abi);
+ LogA.d(TAG, " - ABI: " + abi);
}
}
}
diff --git a/app/src/main/java/saarland/cispa/artist/artistgui/utils/ArtistUtils.java b/app/src/main/java/saarland/cispa/artist/artistgui/utils/ArtistUtils.java
index 5918099..3227cff 100644
--- a/app/src/main/java/saarland/cispa/artist/artistgui/utils/ArtistUtils.java
+++ b/app/src/main/java/saarland/cispa/artist/artistgui/utils/ArtistUtils.java
@@ -29,7 +29,8 @@
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
-import trikita.log.Log;
+import saarland.cispa.utils.LogA;
+
public class ArtistUtils {
@@ -51,12 +52,12 @@ public static boolean isMultiDex(final String apkPath) {
while ((apkContent = zipInput.getNextEntry()) != null) {
if (apkContent.getName().endsWith(".dex")) {
++dexFileCount;
- Log.d(TAG, apkPath + " DexFile: " + dexFileCount);
+ LogA.d(TAG, apkPath + " DexFile: " + dexFileCount);
}
}
}
} catch (IOException e) {
- Log.e(TAG, "Copying Could not find APK: " + apkPath);
+ LogA.e(TAG, "Copying Could not find APK: " + apkPath);
}
if (dexFileCount > 1) {
isMultidexApk = true;
diff --git a/app/src/main/java/saarland/cispa/artist/artistgui/utils/ProcessExecutor.java b/app/src/main/java/saarland/cispa/artist/artistgui/utils/ProcessExecutor.java
index 87195f3..545d9f3 100644
--- a/app/src/main/java/saarland/cispa/artist/artistgui/utils/ProcessExecutor.java
+++ b/app/src/main/java/saarland/cispa/artist/artistgui/utils/ProcessExecutor.java
@@ -27,7 +27,7 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import trikita.log.Log;
+import saarland.cispa.utils.LogA;
public enum ProcessExecutor {
INSTANCE;
@@ -72,10 +72,10 @@ public static boolean execute(final String command,
try {
ProcessBuilder pb = new ProcessBuilder();
if (rootExecution) {
- Log.d(TAG, String.format("execute() SU [`%s`]", command));
+ LogA.d(TAG, String.format("execute() SU [`%s`]", command));
pb.command("su", "-c", command);
} else {
- Log.d(TAG, String.format("execute() [`%s`]", command));
+ LogA.d(TAG, String.format("execute() [`%s`]", command));
pb.command(command);
}
@@ -83,13 +83,13 @@ public static boolean execute(final String command,
Process process = pb.start();
// ["Process[pid=18546, hasExited=false]"]
- Log.d(TAG, String.format("> execute() ProcessInfos: [%s]", process.toString()));
+ LogA.d(TAG, String.format("> execute() ProcessInfos: [%s]", process.toString()));
PROCESSES.put(processName, process);
-
- Log.d(TAG, String.format("> execute() Waiting: %s", processName));
+
+ LogA.d(TAG, String.format("> execute() Waiting: %s", processName));
process.waitFor();
- Log.d(TAG, String.format("> execute() Waiting: %s DONE", processName));
+ LogA.d(TAG, String.format("> execute() Waiting: %s DONE", processName));
final BufferedReader reader =
new BufferedReader(new InputStreamReader(process.getInputStream()));
@@ -104,17 +104,18 @@ public static boolean execute(final String command,
}
reader.close();
- Log.d(TAG, "> $ " + output.toString());
+ LogA.d(TAG, "> $ " + output.toString());
if (output != null && outputBuffer != null) {
outputBuffer.append(output);
}
final boolean SUCCESS = process.exitValue() == 0;
PROCESSES.remove(processName);
- Log.d(TAG, String.format("> execute() [`%s`] SUCCESS", command));
+ LogA.d(TAG, String.format("> execute() [`%s`] SUCCESS", command));
return SUCCESS;
} catch (final IOException|InterruptedException e) {
- Log.d(TAG, String.format("> execute() [`%s`] FAILED", command), e);
+ LogA.d(TAG, String.format("> execute() [`%s`] FAILED", command));
+ e.printStackTrace();
return false;
}
}
@@ -124,9 +125,9 @@ public static void killDefaultExecutorProcess() {
}
public static void killAllExecutorProcesses() {
- Log.d(TAG, String.format("killAllExecutorProcesses() [count: %d]", PROCESSES.size()));
+ LogA.d(TAG, String.format("killAllExecutorProcesses() [count: %d]", PROCESSES.size()));
for (final String processName : PROCESSES.keySet()) {
- Log.i(TAG, String.format("Killing Process %s", processName));
+ LogA.i(TAG, String.format("Killing Process %s", processName));
final Process process = PROCESSES.remove(processName);
AndroidUtils.suKill(process);
killSystemProcessDex2oat();
@@ -135,24 +136,24 @@ public static void killAllExecutorProcesses() {
}
public static void killExecutorProcess(final String processName) {
- Log.d(TAG, String.format("killDefaultExecutorProcess() %s", processName));
+ LogA.d(TAG, String.format("killDefaultExecutorProcess() %s", processName));
final Process process = PROCESSES.remove(processName);
if (process != null) {
- Log.d(TAG, String.format("killDefaultExecutorProcess() %s FOUND -> EXTERMINATE!", processName));
+ LogA.d(TAG, String.format("killDefaultExecutorProcess() %s FOUND -> EXTERMINATE!", processName));
AndroidUtils.suKill(process);
killSystemProcessDex2oat();
process.destroy();
}
- Log.d(TAG, String.format("killDefaultExecutorProcess() %s DONE", processName));
+ LogA.d(TAG, String.format("killDefaultExecutorProcess() %s DONE", processName));
}
public static void killSystemProcessDex2oat() {
killSystemProcess(DEX2OAT_PROCESS_NAME);
}
public static void killSystemProcess(final String processName) {
- Log.d(TAG, String.format("killSystemProcess()"));
+ LogA.d(TAG, String.format("killSystemProcess()"));
execute("pgrep -f \"" + processName + "\" | xargs kill -9", true, "pgrep_dex2oat");
- Log.d(TAG, String.format("killSystemProcess() DONE"));
+ LogA.d(TAG, String.format("killSystemProcess() DONE"));
}
}
diff --git a/app/src/main/java/saarland/cispa/artist/artistgui/utils/StringUtils.java b/app/src/main/java/saarland/cispa/artist/artistgui/utils/StringUtils.java
index 1800fc1..5f50524 100644
--- a/app/src/main/java/saarland/cispa/artist/artistgui/utils/StringUtils.java
+++ b/app/src/main/java/saarland/cispa/artist/artistgui/utils/StringUtils.java
@@ -28,7 +28,8 @@
import java.util.Collections;
import java.util.List;
-import trikita.log.Log;
+import saarland.cispa.utils.LogA;
+
/** String manipulation utilities
*
@@ -61,7 +62,7 @@ public static String readIntoString(final InputStream inputStream) {
}
returnString = result.toString("UTF-8");
} catch (final IOException e) {
- Log.e(TAG, "Could not read supplied InputStream: " + inputStream, e);
+ LogA.e(TAG, "Could not read supplied InputStream: " + inputStream, e);
}
return returnString;
}
diff --git a/app/src/main/java/saarland/cispa/artist/artistgui/utils/UriUtils.java b/app/src/main/java/saarland/cispa/artist/artistgui/utils/UriUtils.java
index e83ca0f..802496f 100644
--- a/app/src/main/java/saarland/cispa/artist/artistgui/utils/UriUtils.java
+++ b/app/src/main/java/saarland/cispa/artist/artistgui/utils/UriUtils.java
@@ -25,19 +25,20 @@
import java.io.File;
-import trikita.log.Log;
+import saarland.cispa.utils.LogA;
+
public class UriUtils {
private static final String TAG = "UriUtils";
public static String getFilenameFromUri(final Uri uri) {
- Log.v(TAG, "Uri: " + uri.toString());
- Log.v(TAG, "Uri Path: " + uri.getPath());
- Log.v(TAG, "Uri LastPathSegment: " + uri.getLastPathSegment());
+ LogA.v(TAG, "Uri: " + uri.toString());
+ LogA.v(TAG, "Uri Path: " + uri.getPath());
+ LogA.v(TAG, "Uri LastPathSegment: " + uri.getLastPathSegment());
final File fileFromUri = new File(uri.getPath());
- Log.v(TAG, "Uri File Name: " + fileFromUri.getName());
+ LogA.v(TAG, "Uri File Name: " + fileFromUri.getName());
String filename = fileFromUri.getName();
filename = cleanUriFilename(filename);
return filename;
diff --git a/dexterous b/dexterous
index 1641929..3ae3612 160000
--- a/dexterous
+++ b/dexterous
@@ -1 +1 @@
-Subproject commit 1641929b29fd0298f73d7bedaf38c04e87e1ad67
+Subproject commit 3ae3612502a70945f27ecd5cfe947c47950df6ca