| 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.app.Instrumentation; | 8 import android.app.Instrumentation; |
| 9 import android.content.ComponentName; | 9 import android.content.ComponentName; |
| 10 import android.content.Context; | 10 import android.content.Context; |
| 11 import android.content.pm.ApplicationInfo; | 11 import android.content.pm.ApplicationInfo; |
| 12 import android.content.pm.PackageManager; | 12 import android.content.pm.PackageManager; |
| 13 import android.content.pm.PackageManager.NameNotFoundException; | 13 import android.content.pm.PackageManager.NameNotFoundException; |
| 14 import android.os.Bundle; | 14 import android.os.Bundle; |
| 15 import android.util.Log; | 15 import android.util.Log; |
| 16 | 16 |
| 17 import org.chromium.base.Reflect; |
| 18 |
| 17 import java.io.File; | 19 import java.io.File; |
| 18 import java.lang.ref.WeakReference; | 20 import java.lang.ref.WeakReference; |
| 19 import java.util.List; | 21 import java.util.List; |
| 20 import java.util.Map; | 22 import java.util.Map; |
| 21 | 23 |
| 22 /** | 24 /** |
| 23 * An Application that replaces itself with another Application (as defined in | 25 * An Application that replaces itself with another Application (as defined in |
| 24 * an AndroidManifext.xml meta-data tag). It loads the other application only | 26 * an AndroidManifext.xml meta-data tag). It loads the other application only |
| 25 * after side-loading its .so and .dex files from /data/local/tmp. | 27 * after side-loading its .so and .dex files from /data/local/tmp. |
| 26 * | 28 * |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 for (Map.Entry<String, WeakReference<?>> entry : packageMap.entrySet
()) { | 275 for (Map.Entry<String, WeakReference<?>> entry : packageMap.entrySet
()) { |
| 274 Object loadedApk = entry.getValue().get(); | 276 Object loadedApk = entry.getValue().get(); |
| 275 if (loadedApk != null && Reflect.getField(loadedApk, "mApplicati
on") == this) { | 277 if (loadedApk != null && Reflect.getField(loadedApk, "mApplicati
on") == this) { |
| 276 Reflect.setField(loadedApk, "mApplication", mRealApplication
); | 278 Reflect.setField(loadedApk, "mApplication", mRealApplication
); |
| 277 Reflect.setField(mRealApplication, "mLoadedApk", loadedApk); | 279 Reflect.setField(mRealApplication, "mLoadedApk", loadedApk); |
| 278 } | 280 } |
| 279 } | 281 } |
| 280 } | 282 } |
| 281 } | 283 } |
| 282 } | 284 } |
| OLD | NEW |