Merge commit 'a300625625feae9f7eb28694e4a31335442c420b' into eclair-mr2-plus-aosp * commit 'a300625625feae9f7eb28694e4a31335442c420b': Fix issue #2246723: Only one Application object gets onCreate called
This commit is contained in:
@@ -485,7 +485,8 @@ public final class ActivityThread {
|
|||||||
return mResources;
|
return mResources;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Application makeApplication(boolean forceDefaultAppClass) {
|
public Application makeApplication(boolean forceDefaultAppClass,
|
||||||
|
Instrumentation instrumentation) {
|
||||||
if (mApplication != null) {
|
if (mApplication != null) {
|
||||||
return mApplication;
|
return mApplication;
|
||||||
}
|
}
|
||||||
@@ -512,7 +513,21 @@ public final class ActivityThread {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
mActivityThread.mAllApplications.add(app);
|
mActivityThread.mAllApplications.add(app);
|
||||||
return mApplication = app;
|
mApplication = app;
|
||||||
|
|
||||||
|
if (instrumentation != null) {
|
||||||
|
try {
|
||||||
|
instrumentation.callApplicationOnCreate(app);
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (!instrumentation.onException(app, e)) {
|
||||||
|
throw new RuntimeException(
|
||||||
|
"Unable to create application " + app.getClass().getName()
|
||||||
|
+ ": " + e.toString(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeContextRegistrations(Context context,
|
public void removeContextRegistrations(Context context,
|
||||||
@@ -2378,7 +2393,7 @@ public final class ActivityThread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Application app = r.packageInfo.makeApplication(false);
|
Application app = r.packageInfo.makeApplication(false, mInstrumentation);
|
||||||
|
|
||||||
if (localLOGV) Log.v(TAG, "Performing launch of " + r);
|
if (localLOGV) Log.v(TAG, "Performing launch of " + r);
|
||||||
if (localLOGV) Log.v(
|
if (localLOGV) Log.v(
|
||||||
@@ -2576,7 +2591,7 @@ public final class ActivityThread {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Application app = packageInfo.makeApplication(false);
|
Application app = packageInfo.makeApplication(false, mInstrumentation);
|
||||||
|
|
||||||
if (localLOGV) Log.v(
|
if (localLOGV) Log.v(
|
||||||
TAG, "Performing receive of " + data.intent
|
TAG, "Performing receive of " + data.intent
|
||||||
@@ -2730,7 +2745,7 @@ public final class ActivityThread {
|
|||||||
ApplicationContext context = new ApplicationContext();
|
ApplicationContext context = new ApplicationContext();
|
||||||
context.init(packageInfo, null, this);
|
context.init(packageInfo, null, this);
|
||||||
|
|
||||||
Application app = packageInfo.makeApplication(false);
|
Application app = packageInfo.makeApplication(false, mInstrumentation);
|
||||||
context.setOuterContext(service);
|
context.setOuterContext(service);
|
||||||
service.attach(context, this, data.info.name, data.token, app,
|
service.attach(context, this, data.info.name, data.token, app,
|
||||||
ActivityManagerNative.getDefault());
|
ActivityManagerNative.getDefault());
|
||||||
@@ -3940,7 +3955,7 @@ public final class ActivityThread {
|
|||||||
|
|
||||||
// If the app is being launched for full backup or restore, bring it up in
|
// If the app is being launched for full backup or restore, bring it up in
|
||||||
// a restricted environment with the base application class.
|
// a restricted environment with the base application class.
|
||||||
Application app = data.info.makeApplication(data.restrictedBackupMode);
|
Application app = data.info.makeApplication(data.restrictedBackupMode, null);
|
||||||
mInitialApplication = app;
|
mInitialApplication = app;
|
||||||
|
|
||||||
List<ProviderInfo> providers = data.providers;
|
List<ProviderInfo> providers = data.providers;
|
||||||
|
|||||||
Reference in New Issue
Block a user