Loading core/java/android/app/ActivityThread.java +26 −4 Original line number Diff line number Diff line Loading @@ -8301,8 +8301,19 @@ public final class ActivityThread extends ClientTransactionHandler Slog.v(TAG, "incProviderRef: Now unstable - " + prc.holder.info.name); } if (Flags.skipRefContentProvider()) { // If the provider is persistent process and has unstable // connection, then we don't need to increment the ref count // in the activity manager. if (prc != null && prc.holder != null && !prc.holder.noReleaseNeededIfUnstable) { ActivityManager.getService().refContentProvider( prc.holder.connection, 0, 1); } } else { ActivityManager.getService().refContentProvider( prc.holder.connection, 0, 1); } } catch (RemoteException e) { //do nothing content provider object is dead any way } Loading Loading @@ -8401,8 +8412,19 @@ public final class ActivityThread extends ClientTransactionHandler Slog.v(TAG, "releaseProvider: No longer unstable - " + prc.holder.info.name); } if (Flags.skipRefContentProvider()) { // If the provider is persistent process and has unstable // connection, then we don't need to decrement the ref count // in the activity manager. if (prc != null && prc.holder != null && !prc.holder.noReleaseNeededIfUnstable) { ActivityManager.getService().refContentProvider( prc.holder.connection, 0, -1); } } else { ActivityManager.getService().refContentProvider( prc.holder.connection, 0, -1); } } catch (RemoteException e) { //do nothing content provider object is dead any way } Loading core/java/android/app/ContentProviderHolder.java +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ public class ContentProviderHolder implements Parcelable { public IBinder connection; @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) public boolean noReleaseNeeded; public boolean noReleaseNeededIfUnstable; /** * Whether the provider here is a local provider or not. Loading core/java/android/app/activity_manager.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -197,3 +197,11 @@ flag { description: "Enable ProcessObserver's onProcessStarted callbacks." bug: "323959187" } flag { namespace: "backstage_power" name: "skip_ref_content_provider" description: "Skip refContentProvider calls for unstable connections" bug: "395544023" is_fixed_read_only: true } services/core/java/com/android/server/am/ContentProviderHelper.java +4 −0 Original line number Diff line number Diff line Loading @@ -912,6 +912,10 @@ public class ContentProviderHelper { (conn.provider != null && conn.provider.info != null ? conn.provider.info.authority : "")); try { if (android.app.Flags.skipRefContentProvider() && unstable <= 0 && conn.unstableCount() <= 0) { return false; } conn.adjustCounts(stable, unstable); return !conn.dead; } finally { Loading services/core/java/com/android/server/am/ContentProviderRecord.java +14 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.server.am; import static android.app.ActivityManager.PROCESS_STATE_PERSISTENT; import static android.app.ActivityManager.PROCESS_STATE_PERSISTENT_UI; import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import android.app.ContentProviderHolder; Loading Loading @@ -92,6 +95,17 @@ final class ContentProviderRecord implements ComponentName.WithComponentName { holder.noReleaseNeeded = noReleaseNeeded; holder.connection = conn; holder.mLocal = local; if (android.app.Flags.skipRefContentProvider()) { if (conn == null || conn.provider == null || conn.provider.proc == null) { return holder; } final int procState = conn.provider.proc.getCurProcState(); if (procState == PROCESS_STATE_PERSISTENT || procState == PROCESS_STATE_PERSISTENT_UI) { holder.noReleaseNeededIfUnstable = true; } } return holder; } Loading Loading
core/java/android/app/ActivityThread.java +26 −4 Original line number Diff line number Diff line Loading @@ -8301,8 +8301,19 @@ public final class ActivityThread extends ClientTransactionHandler Slog.v(TAG, "incProviderRef: Now unstable - " + prc.holder.info.name); } if (Flags.skipRefContentProvider()) { // If the provider is persistent process and has unstable // connection, then we don't need to increment the ref count // in the activity manager. if (prc != null && prc.holder != null && !prc.holder.noReleaseNeededIfUnstable) { ActivityManager.getService().refContentProvider( prc.holder.connection, 0, 1); } } else { ActivityManager.getService().refContentProvider( prc.holder.connection, 0, 1); } } catch (RemoteException e) { //do nothing content provider object is dead any way } Loading Loading @@ -8401,8 +8412,19 @@ public final class ActivityThread extends ClientTransactionHandler Slog.v(TAG, "releaseProvider: No longer unstable - " + prc.holder.info.name); } if (Flags.skipRefContentProvider()) { // If the provider is persistent process and has unstable // connection, then we don't need to decrement the ref count // in the activity manager. if (prc != null && prc.holder != null && !prc.holder.noReleaseNeededIfUnstable) { ActivityManager.getService().refContentProvider( prc.holder.connection, 0, -1); } } else { ActivityManager.getService().refContentProvider( prc.holder.connection, 0, -1); } } catch (RemoteException e) { //do nothing content provider object is dead any way } Loading
core/java/android/app/ContentProviderHolder.java +1 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ public class ContentProviderHolder implements Parcelable { public IBinder connection; @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.P, trackingBug = 115609023) public boolean noReleaseNeeded; public boolean noReleaseNeededIfUnstable; /** * Whether the provider here is a local provider or not. Loading
core/java/android/app/activity_manager.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -197,3 +197,11 @@ flag { description: "Enable ProcessObserver's onProcessStarted callbacks." bug: "323959187" } flag { namespace: "backstage_power" name: "skip_ref_content_provider" description: "Skip refContentProvider calls for unstable connections" bug: "395544023" is_fixed_read_only: true }
services/core/java/com/android/server/am/ContentProviderHelper.java +4 −0 Original line number Diff line number Diff line Loading @@ -912,6 +912,10 @@ public class ContentProviderHelper { (conn.provider != null && conn.provider.info != null ? conn.provider.info.authority : "")); try { if (android.app.Flags.skipRefContentProvider() && unstable <= 0 && conn.unstableCount() <= 0) { return false; } conn.adjustCounts(stable, unstable); return !conn.dead; } finally { Loading
services/core/java/com/android/server/am/ContentProviderRecord.java +14 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,9 @@ package com.android.server.am; import static android.app.ActivityManager.PROCESS_STATE_PERSISTENT; import static android.app.ActivityManager.PROCESS_STATE_PERSISTENT_UI; import static com.android.server.am.ActivityManagerDebugConfig.TAG_AM; import android.app.ContentProviderHolder; Loading Loading @@ -92,6 +95,17 @@ final class ContentProviderRecord implements ComponentName.WithComponentName { holder.noReleaseNeeded = noReleaseNeeded; holder.connection = conn; holder.mLocal = local; if (android.app.Flags.skipRefContentProvider()) { if (conn == null || conn.provider == null || conn.provider.proc == null) { return holder; } final int procState = conn.provider.proc.getCurProcState(); if (procState == PROCESS_STATE_PERSISTENT || procState == PROCESS_STATE_PERSISTENT_UI) { holder.noReleaseNeededIfUnstable = true; } } return holder; } Loading