Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dbb902d4 authored by riddle_hsu's avatar riddle_hsu Committed by Wale Ogunwale
Browse files

Also restart provider if there is external handle.

e.g. ContentResolver.getType will call
ActivityManagerService.getProviderMimeType
that will not have connection but increase
externalProcessNoHandleCount.

Change-Id: I649c0b2390a749c77c6be5e7dfadc1acb689ec4c
parent 0c72f4f9
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -15089,7 +15089,7 @@ public final class ActivityManagerService extends ActivityManagerNative
            ContentProviderRecord cpr = app.pubProviders.valueAt(i);
            final boolean always = app.bad || !allowRestart;
            boolean inLaunching = removeDyingProviderLocked(app, cpr, always);
            if ((inLaunching || always) && !cpr.connections.isEmpty()) {
            if ((inLaunching || always) && cpr.hasConnectionOrHandle()) {
                // We left the provider in the launching list, need to
                // restart it.
                restart = true;
@@ -15233,7 +15233,7 @@ public final class ActivityManagerService extends ActivityManagerNative
        for (int i = mLaunchingProviders.size() - 1; i >= 0; i--) {
            ContentProviderRecord cpr = mLaunchingProviders.get(i);
            if (cpr.launchingApp == app) {
                if (!alwaysBad && !app.bad && !cpr.connections.isEmpty()) {
                if (!alwaysBad && !app.bad && cpr.hasConnectionOrHandle()) {
                    restart = true;
                } else {
                    removeDyingProviderLocked(app, cpr, true);
+4 −0
Original line number Diff line number Diff line
@@ -139,6 +139,10 @@ final class ContentProviderRecord {
        return (externalProcessTokenToHandle != null || externalProcessNoHandleCount > 0);
    }

    public boolean hasConnectionOrHandle() {
        return !connections.isEmpty() || hasExternalProcessHandles();
    }

    void dump(PrintWriter pw, String prefix, boolean full) {
        if (full) {
            pw.print(prefix); pw.print("package=");