Merge "Fix issue #5253941: ICS ignoring provider's android:process flag"
This commit is contained in:
committed by
Android (Google) Code Review
commit
04ef5b8dd7
@@ -1631,8 +1631,8 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
}
|
}
|
||||||
if (app.conProviders.size() > 0) {
|
if (app.conProviders.size() > 0) {
|
||||||
for (ContentProviderRecord cpr : app.conProviders.keySet()) {
|
for (ContentProviderRecord cpr : app.conProviders.keySet()) {
|
||||||
if (cpr.app != null && cpr.app.lruSeq != mLruSeq) {
|
if (cpr.proc != null && cpr.proc.lruSeq != mLruSeq) {
|
||||||
updateLruProcessInternalLocked(cpr.app, oomAdj,
|
updateLruProcessInternalLocked(cpr.proc, oomAdj,
|
||||||
updateActivityTime, i+1);
|
updateActivityTime, i+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3373,7 +3373,24 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
for (i=0; i<N; i++) {
|
for (i=0; i<N; i++) {
|
||||||
bringDownServiceLocked(services.get(i), true);
|
bringDownServiceLocked(services.get(i), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ArrayList<ContentProviderRecord> providers = new ArrayList<ContentProviderRecord>();
|
||||||
|
for (ContentProviderRecord provider : mProvidersByClass.values()) {
|
||||||
|
if (provider.info.packageName.equals(name)
|
||||||
|
&& (provider.proc == null || evenPersistent || !provider.proc.persistent)) {
|
||||||
|
if (!doit) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
didSomething = true;
|
||||||
|
providers.add(provider);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
N = providers.size();
|
||||||
|
for (i=0; i<N; i++) {
|
||||||
|
removeDyingProviderLocked(null, providers.get(i));
|
||||||
|
}
|
||||||
|
|
||||||
if (doit) {
|
if (doit) {
|
||||||
if (purgeCache) {
|
if (purgeCache) {
|
||||||
AttributeCache ac = AttributeCache.instance();
|
AttributeCache ac = AttributeCache.instance();
|
||||||
@@ -5485,7 +5502,7 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
ComponentName comp = new ComponentName(cpi.packageName, cpi.name);
|
ComponentName comp = new ComponentName(cpi.packageName, cpi.name);
|
||||||
ContentProviderRecord cpr = mProvidersByClass.get(comp);
|
ContentProviderRecord cpr = mProvidersByClass.get(comp);
|
||||||
if (cpr == null) {
|
if (cpr == null) {
|
||||||
cpr = new ContentProviderRecord(cpi, app.info);
|
cpr = new ContentProviderRecord(cpi, app.info, comp);
|
||||||
mProvidersByClass.put(comp, cpr);
|
mProvidersByClass.put(comp, cpr);
|
||||||
}
|
}
|
||||||
app.pubProviders.put(cpi.name, cpr);
|
app.pubProviders.put(cpi.name, cpr);
|
||||||
@@ -5643,25 +5660,25 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
// return it right away.
|
// return it right away.
|
||||||
final boolean countChanged = incProviderCount(r, cpr);
|
final boolean countChanged = incProviderCount(r, cpr);
|
||||||
if (countChanged) {
|
if (countChanged) {
|
||||||
if (cpr.app != null && r.setAdj <= ProcessList.PERCEPTIBLE_APP_ADJ) {
|
if (cpr.proc != null && r.setAdj <= ProcessList.PERCEPTIBLE_APP_ADJ) {
|
||||||
// If this is a perceptible app accessing the provider,
|
// If this is a perceptible app accessing the provider,
|
||||||
// make sure to count it as being accessed and thus
|
// make sure to count it as being accessed and thus
|
||||||
// back up on the LRU list. This is good because
|
// back up on the LRU list. This is good because
|
||||||
// content providers are often expensive to start.
|
// content providers are often expensive to start.
|
||||||
updateLruProcessLocked(cpr.app, false, true);
|
updateLruProcessLocked(cpr.proc, false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cpr.app != null) {
|
if (cpr.proc != null) {
|
||||||
if (false) {
|
if (false) {
|
||||||
if (cpr.name.flattenToShortString().equals(
|
if (cpr.name.flattenToShortString().equals(
|
||||||
"com.android.providers.calendar/.CalendarProvider2")) {
|
"com.android.providers.calendar/.CalendarProvider2")) {
|
||||||
Slog.v(TAG, "****************** KILLING "
|
Slog.v(TAG, "****************** KILLING "
|
||||||
+ cpr.name.flattenToShortString());
|
+ cpr.name.flattenToShortString());
|
||||||
Process.killProcess(cpr.app.pid);
|
Process.killProcess(cpr.proc.pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
boolean success = updateOomAdjLocked(cpr.app);
|
boolean success = updateOomAdjLocked(cpr.proc);
|
||||||
if (DEBUG_PROVIDER) Slog.i(TAG, "Adjust success: " + success);
|
if (DEBUG_PROVIDER) Slog.i(TAG, "Adjust success: " + success);
|
||||||
// NOTE: there is still a race here where a signal could be
|
// NOTE: there is still a race here where a signal could be
|
||||||
// pending on the process even though we managed to update its
|
// pending on the process even though we managed to update its
|
||||||
@@ -5676,7 +5693,7 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
"Existing provider " + cpr.name.flattenToShortString()
|
"Existing provider " + cpr.name.flattenToShortString()
|
||||||
+ " is crashing; detaching " + r);
|
+ " is crashing; detaching " + r);
|
||||||
boolean lastRef = decProviderCount(r, cpr);
|
boolean lastRef = decProviderCount(r, cpr);
|
||||||
appDiedLocked(cpr.app, cpr.app.pid, cpr.app.thread);
|
appDiedLocked(cpr.proc, cpr.proc.pid, cpr.proc.thread);
|
||||||
if (!lastRef) {
|
if (!lastRef) {
|
||||||
// This wasn't the last ref our process had on
|
// This wasn't the last ref our process had on
|
||||||
// the provider... we have now been killed, bail.
|
// the provider... we have now been killed, bail.
|
||||||
@@ -5729,7 +5746,7 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
+ cpi.name);
|
+ cpi.name);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
cpr = new ContentProviderRecord(cpi, ai);
|
cpr = new ContentProviderRecord(cpi, ai, comp);
|
||||||
} catch (RemoteException ex) {
|
} catch (RemoteException ex) {
|
||||||
// pm is in same process, this will never happen.
|
// pm is in same process, this will never happen.
|
||||||
}
|
}
|
||||||
@@ -5864,7 +5881,7 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
//update content provider record entry info
|
//update content provider record entry info
|
||||||
ComponentName comp = new ComponentName(cpr.info.packageName, cpr.info.name);
|
ComponentName comp = new ComponentName(cpr.info.packageName, cpr.info.name);
|
||||||
ContentProviderRecord localCpr = mProvidersByClass.get(comp);
|
ContentProviderRecord localCpr = mProvidersByClass.get(comp);
|
||||||
if (localCpr.app == r) {
|
if (localCpr.proc == r) {
|
||||||
//should not happen. taken care of as a local provider
|
//should not happen. taken care of as a local provider
|
||||||
Slog.w(TAG, "removeContentProvider called on local provider: "
|
Slog.w(TAG, "removeContentProvider called on local provider: "
|
||||||
+ cpr.info.name + " in process " + r.processName);
|
+ cpr.info.name + " in process " + r.processName);
|
||||||
@@ -5940,7 +5957,7 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
}
|
}
|
||||||
synchronized (dst) {
|
synchronized (dst) {
|
||||||
dst.provider = src.provider;
|
dst.provider = src.provider;
|
||||||
dst.app = r;
|
dst.proc = r;
|
||||||
dst.notifyAll();
|
dst.notifyAll();
|
||||||
}
|
}
|
||||||
updateOomAdjLocked(r);
|
updateOomAdjLocked(r);
|
||||||
@@ -8706,9 +8723,9 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
r.dump(pw, " ");
|
r.dump(pw, " ");
|
||||||
} else {
|
} else {
|
||||||
pw.print(" * "); pw.print(e.getKey().flattenToShortString());
|
pw.print(" * "); pw.print(e.getKey().flattenToShortString());
|
||||||
if (r.app != null) {
|
if (r.proc != null) {
|
||||||
pw.println(":");
|
pw.println(":");
|
||||||
pw.print(" "); pw.println(r.app);
|
pw.print(" "); pw.println(r.proc);
|
||||||
} else {
|
} else {
|
||||||
pw.println();
|
pw.println();
|
||||||
}
|
}
|
||||||
@@ -9440,7 +9457,7 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
cpr.notifyAll();
|
cpr.notifyAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
mProvidersByClass.remove(cpr.info.name);
|
mProvidersByClass.remove(cpr.name);
|
||||||
String names[] = cpr.info.authority.split(";");
|
String names[] = cpr.info.authority.split(";");
|
||||||
for (int j = 0; j < names.length; j++) {
|
for (int j = 0; j < names.length; j++) {
|
||||||
mProvidersByName.remove(names[j]);
|
mProvidersByName.remove(names[j]);
|
||||||
@@ -9454,9 +9471,10 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
&& capp.pid != MY_PID) {
|
&& capp.pid != MY_PID) {
|
||||||
Slog.i(TAG, "Kill " + capp.processName
|
Slog.i(TAG, "Kill " + capp.processName
|
||||||
+ " (pid " + capp.pid + "): provider " + cpr.info.name
|
+ " (pid " + capp.pid + "): provider " + cpr.info.name
|
||||||
+ " in dying process " + proc.processName);
|
+ " in dying process " + (proc != null ? proc.processName : "??"));
|
||||||
EventLog.writeEvent(EventLogTags.AM_KILL, capp.pid,
|
EventLog.writeEvent(EventLogTags.AM_KILL, capp.pid,
|
||||||
capp.processName, capp.setAdj, "dying provider " + proc.processName);
|
capp.processName, capp.setAdj, "dying provider "
|
||||||
|
+ cpr.name.toShortString());
|
||||||
Process.killProcessQuiet(capp.pid);
|
Process.killProcessQuiet(capp.pid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9515,7 +9533,7 @@ public final class ActivityManagerService extends ActivityManagerNative
|
|||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
ContentProviderRecord cpr = it.next();
|
ContentProviderRecord cpr = it.next();
|
||||||
cpr.provider = null;
|
cpr.provider = null;
|
||||||
cpr.app = null;
|
cpr.proc = null;
|
||||||
|
|
||||||
// See if someone is waiting for this provider... in which
|
// See if someone is waiting for this provider... in which
|
||||||
// case we don't remove it, but just let it restart.
|
// case we don't remove it, but just let it restart.
|
||||||
|
|||||||
@@ -32,15 +32,15 @@ class ContentProviderRecord extends ContentProviderHolder {
|
|||||||
final ApplicationInfo appInfo;
|
final ApplicationInfo appInfo;
|
||||||
final ComponentName name;
|
final ComponentName name;
|
||||||
int externals; // number of non-framework processes supported by this provider
|
int externals; // number of non-framework processes supported by this provider
|
||||||
ProcessRecord app; // if non-null, hosting application
|
ProcessRecord proc; // if non-null, hosting process.
|
||||||
ProcessRecord launchingApp; // if non-null, waiting for this app to be launched.
|
ProcessRecord launchingApp; // if non-null, waiting for this app to be launched.
|
||||||
String stringName;
|
String stringName;
|
||||||
|
|
||||||
public ContentProviderRecord(ProviderInfo _info, ApplicationInfo ai) {
|
public ContentProviderRecord(ProviderInfo _info, ApplicationInfo ai, ComponentName _name) {
|
||||||
super(_info);
|
super(_info);
|
||||||
uid = ai.uid;
|
uid = ai.uid;
|
||||||
appInfo = ai;
|
appInfo = ai;
|
||||||
name = new ComponentName(_info.packageName, _info.name);
|
name = _name;
|
||||||
noReleaseNeeded = uid == 0 || uid == Process.SYSTEM_UID;
|
noReleaseNeeded = uid == 0 || uid == Process.SYSTEM_UID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ class ContentProviderRecord extends ContentProviderHolder {
|
|||||||
pw.print(prefix); pw.print("package=");
|
pw.print(prefix); pw.print("package=");
|
||||||
pw.print(info.applicationInfo.packageName);
|
pw.print(info.applicationInfo.packageName);
|
||||||
pw.print(" process="); pw.println(info.processName);
|
pw.print(" process="); pw.println(info.processName);
|
||||||
pw.print(prefix); pw.print("app="); pw.println(app);
|
pw.print(prefix); pw.print("proc="); pw.println(proc);
|
||||||
if (launchingApp != null) {
|
if (launchingApp != null) {
|
||||||
pw.print(prefix); pw.print("launchingApp="); pw.println(launchingApp);
|
pw.print(prefix); pw.print("launchingApp="); pw.println(launchingApp);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user