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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 package org.chromium.deconstructed;
2
3 import android.app.Application;
4 import android.content.Context;
5
6 import java.io.File;
7
8 public class DeconstructedApplication extends Application {
9 private static final String TAG = "org.chromium.deconstructed.DeconstructedA pplication";
10
11 private static Application realApplication;
12 private static final String realApplicationName = "org.chromium.simple.MainA pplication";
13 private static ClassLoader classLoader;
14
15 static {
16 android.util.Log.e(TAG, "<static>");
17 }
18
19 public DeconstructedApplication() {
20 }
21
22 @Override
23 public void attachBaseContext(Context context) {
24 super.attachBaseContext(context);
25 try {
26 File dexDir = new File("/sdcard/deconstructed/dex");
27 JavaInstaller.install(this, dexDir);
28 File nativeDir = new File("/sdcard/deconstructed/lib");
29 NativeInstaller.install(this, nativeDir);
30 File resources = new File("/sdcard/deconstructed/resources.ap_");
31 ResourceInstaller.install(resources);
32 realApplication = createRealApplication();
33 Reflect.invokeMethod(realApplication, "attachBaseContext", context);
34 } catch (Exception e) {
35 throw new RuntimeException(e);
36 }
37 }
38
39
40 @Override
41 public void onCreate() {
42 super.onCreate();
43 android.util.Log.e(TAG, "onCreate()");
44 try {
45 ApplicationInstaller.install(this, realApplication);
46 } catch (Exception e) {
47 throw new RuntimeException(e);
48 }
49 }
50
51 private Application createRealApplication() {
52 try {
53 return (Application) Reflect.newInstance(
54 DeconstructedApplication.class.getClassLoader(), realApplica tionName);
55 } catch (Exception e) {
56 throw new RuntimeException(e);
57 }
58 }
59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698