diff options
| author | TreeHugger Robot <treehugger-gerrit@google.com> | 2020-01-22 00:17:32 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-01-22 00:17:32 +0000 |
| commit | 8c4aae3ea0d41feef63fbfc08a656eb10afbf451 (patch) | |
| tree | 30630fe123b08bd55c5f1c9492160a427c61da08 | |
| parent | 2d60a42904afd044ae8d0fc627c3f08286039df7 (diff) | |
| parent | 9401ffd7e3afaf3c54615a2c8fd2f0e6f43d44f3 (diff) | |
Merge "Use App Compability framework instead of targetSdkVersion."
| -rw-r--r-- | services/core/java/com/android/server/am/OomAdjuster.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/services/core/java/com/android/server/am/OomAdjuster.java b/services/core/java/com/android/server/am/OomAdjuster.java index be14b3b03923..5e24cf771ce0 100644 --- a/services/core/java/com/android/server/am/OomAdjuster.java +++ b/services/core/java/com/android/server/am/OomAdjuster.java @@ -71,6 +71,9 @@ import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_SWITCH; import android.app.ActivityManager; import android.app.ApplicationExitInfo; import android.app.usage.UsageEvents; +import android.compat.Compatibility; +import android.compat.annotation.ChangeId; +import android.compat.annotation.EnabledAfter; import android.content.Context; import android.content.pm.ServiceInfo; import android.os.Build; @@ -106,7 +109,6 @@ import java.util.Arrays; */ public final class OomAdjuster { private static final String TAG = "OomAdjuster"; - static final String OOM_ADJ_REASON_METHOD = "updateOomAdj"; static final String OOM_ADJ_REASON_NONE = OOM_ADJ_REASON_METHOD + "_meh"; static final String OOM_ADJ_REASON_ACTIVITY = OOM_ADJ_REASON_METHOD + "_activityChange"; @@ -123,6 +125,17 @@ public final class OomAdjuster { static final String OOM_ADJ_REASON_PROCESS_END = OOM_ADJ_REASON_METHOD + "_processEnd"; /** + * Flag {@link Context#BIND_INCLUDE_CAPABILITIES} is used + * to pass while-in-use capabilities from client process to bound service. In targetSdkVersion + * R and above, if client is a TOP activity, when this flag is present, bound service gets all + * while-in-use capabilities; when this flag is not present, bound service gets no while-in-use + * capabilitiy from client. + */ + @ChangeId + @EnabledAfter(targetSdkVersion=android.os.Build.VERSION_CODES.Q) + static final long PROCESS_CAPABILITY_CHANGE_ID = 136274596L; + + /** * For some direct access we need to power manager. */ PowerManagerInternal mLocalPowerManager; @@ -1631,7 +1644,7 @@ public final class OomAdjuster { // Go at most to BOUND_TOP, unless requested to elevate // to client's state. clientProcState = PROCESS_STATE_BOUND_TOP; - if (client.info.targetSdkVersion >= Build.VERSION_CODES.R) { + if (Compatibility.isChangeEnabled(PROCESS_CAPABILITY_CHANGE_ID)) { if (cr.hasFlag(Context.BIND_INCLUDE_CAPABILITIES)) { // TOP process passes all capabilities to the service. capability = PROCESS_CAPABILITY_ALL; |
