Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1841)

Unified Diff: apk/hijack/org/chromium/deconstructed/DeconstructedApplication.java

Issue 949803002: Deconstructed APK prototyping Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: apk/hijack/org/chromium/deconstructed/DeconstructedApplication.java
diff --git a/apk/hijack/org/chromium/deconstructed/DeconstructedApplication.java b/apk/hijack/org/chromium/deconstructed/DeconstructedApplication.java
new file mode 100644
index 0000000000000000000000000000000000000000..e29f963f9c1b7e0097c4246356ad9a6f0d2e0445
--- /dev/null
+++ b/apk/hijack/org/chromium/deconstructed/DeconstructedApplication.java
@@ -0,0 +1,59 @@
+package org.chromium.deconstructed;
+
+import android.app.Application;
+import android.content.Context;
+
+import java.io.File;
+
+public class DeconstructedApplication extends Application {
+ private static final String TAG = "org.chromium.deconstructed.DeconstructedApplication";
+
+ private static Application realApplication;
+ private static final String realApplicationName = "org.chromium.simple.MainApplication";
+ private static ClassLoader classLoader;
+
+ static {
+ android.util.Log.e(TAG, "<static>");
+ }
+
+ public DeconstructedApplication() {
+ }
+
+ @Override
+ public void attachBaseContext(Context context) {
+ super.attachBaseContext(context);
+ try {
+ File dexDir = new File("/sdcard/deconstructed/dex");
+ JavaInstaller.install(this, dexDir);
+ File nativeDir = new File("/sdcard/deconstructed/lib");
+ NativeInstaller.install(this, nativeDir);
+ File resources = new File("/sdcard/deconstructed/resources.ap_");
+ ResourceInstaller.install(resources);
+ realApplication = createRealApplication();
+ Reflect.invokeMethod(realApplication, "attachBaseContext", context);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+
+ @Override
+ public void onCreate() {
+ super.onCreate();
+ android.util.Log.e(TAG, "onCreate()");
+ try {
+ ApplicationInstaller.install(this, realApplication);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private Application createRealApplication() {
+ try {
+ return (Application) Reflect.newInstance(
+ DeconstructedApplication.class.getClassLoader(), realApplicationName);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698