OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.incrementalinstall; | 5 package org.chromium.incrementalinstall; |
6 | 6 |
7 import android.app.Application; | 7 import android.app.Application; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.pm.ApplicationInfo; | 9 import android.content.pm.ApplicationInfo; |
10 import android.content.pm.PackageManager; | 10 import android.content.pm.PackageManager; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 try { | 44 try { |
45 mActivityThread = Reflect.invokeMethod(Class.forName("android.app.Ac
tivityThread"), | 45 mActivityThread = Reflect.invokeMethod(Class.forName("android.app.Ac
tivityThread"), |
46 "currentActivityThread"); | 46 "currentActivityThread"); |
47 mClassLoaderPatcher = new ClassLoaderPatcher(context); | 47 mClassLoaderPatcher = new ClassLoaderPatcher(context); |
48 | 48 |
49 boolean isFirstRun = LockFile.installerLockExists(firstRunLockFile); | 49 boolean isFirstRun = LockFile.installerLockExists(firstRunLockFile); |
50 if (isFirstRun) { | 50 if (isFirstRun) { |
51 if (mClassLoaderPatcher.mIsPrimaryProcess) { | 51 if (mClassLoaderPatcher.mIsPrimaryProcess) { |
52 // Wait for incremental_install.py to finish. | 52 // Wait for incremental_install.py to finish. |
53 LockFile.waitForInstallerLock(installLockFile, 20 * 1000); | 53 LockFile.waitForInstallerLock(installLockFile, 30 * 1000); |
54 } else { | 54 } else { |
55 // Wait for the browser process to create the optimized dex
files | 55 // Wait for the browser process to create the optimized dex
files |
56 // (and for M+, copy the library files). | 56 // and copy the library files. |
57 LockFile.waitForInstallerLock(firstRunLockFile, 30 * 1000); | 57 LockFile.waitForInstallerLock(firstRunLockFile, 60 * 1000); |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 mClassLoaderPatcher.importNativeLibs(libDir); | 61 mClassLoaderPatcher.importNativeLibs(libDir); |
62 mClassLoaderPatcher.loadDexFiles(dexDir); | 62 mClassLoaderPatcher.loadDexFiles(dexDir); |
63 | 63 |
64 if (isFirstRun && mClassLoaderPatcher.mIsPrimaryProcess) { | 64 if (isFirstRun && mClassLoaderPatcher.mIsPrimaryProcess) { |
65 LockFile.clearInstallerLock(firstRunLockFile); | 65 LockFile.clearInstallerLock(firstRunLockFile); |
66 } | 66 } |
67 | 67 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 for (Map.Entry<String, WeakReference<?>> entry : packageMap.entrySet
()) { | 158 for (Map.Entry<String, WeakReference<?>> entry : packageMap.entrySet
()) { |
159 Object loadedApk = entry.getValue().get(); | 159 Object loadedApk = entry.getValue().get(); |
160 if (loadedApk != null && Reflect.getField(loadedApk, "mApplicati
on") == this) { | 160 if (loadedApk != null && Reflect.getField(loadedApk, "mApplicati
on") == this) { |
161 Reflect.setField(loadedApk, "mApplication", mRealApplication
); | 161 Reflect.setField(loadedApk, "mApplication", mRealApplication
); |
162 Reflect.setField(mRealApplication, "mLoadedApk", loadedApk); | 162 Reflect.setField(mRealApplication, "mLoadedApk", loadedApk); |
163 } | 163 } |
164 } | 164 } |
165 } | 165 } |
166 } | 166 } |
167 } | 167 } |
OLD | NEW |