diff options
| author | Makoto Onuki <omakoto@google.com> | 2017-04-27 20:03:16 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2017-04-27 20:03:22 +0000 |
| commit | 301663a61bda0e2eb863d6518de882cf805abcf7 (patch) | |
| tree | f42314ab617d2912654e2288b7e63defc859eeae /core/java/android | |
| parent | 54e534d6e73387b0411c5cc448412907e2f52fcf (diff) | |
| parent | e92f79450a0e3a55586eb2992577d09fc997761a (diff) | |
Merge "Change IMPORTANCE_PERCEPTIBLE_DEPRECATED to IMPORTANCE_PERCEPTIBLE_PRE_26" into oc-dev
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/app/ActivityManager.java | 39 | ||||
| -rw-r--r-- | core/java/android/content/pm/PackageManagerInternal.java | 5 |
2 files changed, 35 insertions, 9 deletions
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java index 6e7b7504d4f3..223047241480 100644 --- a/core/java/android/app/ActivityManager.java +++ b/core/java/android/app/ActivityManager.java @@ -3143,10 +3143,15 @@ public class ActivityManager { * before {@link Build.VERSION_CODES#O}. Since the {@link Build.VERSION_CODES#O} SDK, * the value of {@link #IMPORTANCE_PERCEPTIBLE} has been fixed. * - * @deprecated Use {@link #IMPORTANCE_PERCEPTIBLE} instead. + * <p>The system will return this value instead of {@link #IMPORTANCE_PERCEPTIBLE} + * on Android versions below {@link Build.VERSION_CODES#O}. + * + * <p>On Android version {@link Build.VERSION_CODES#O} and later, this value will still be + * returned for apps with the target API level below {@link Build.VERSION_CODES#O}. + * For apps targeting version {@link Build.VERSION_CODES#O} and later, + * the correct value {@link #IMPORTANCE_PERCEPTIBLE} will be returned. */ - @Deprecated - public static final int IMPORTANCE_PERCEPTIBLE_DEPRECATED = 130; + public static final int IMPORTANCE_PERCEPTIBLE_PRE_26 = 130; /** * Constant for {@link #importance}: This process is not something the user @@ -3160,11 +3165,17 @@ public class ActivityManager { * before {@link Build.VERSION_CODES#O}. Since the {@link Build.VERSION_CODES#O} SDK, * the value of {@link #IMPORTANCE_CANT_SAVE_STATE} has been fixed. * - * @deprecated Use {@link #IMPORTANCE_CANT_SAVE_STATE} instead. + * <p>The system will return this value instead of {@link #IMPORTANCE_CANT_SAVE_STATE} + * on Android versions below {@link Build.VERSION_CODES#O}. + * + * <p>On Android version {@link Build.VERSION_CODES#O} after, this value will still be + * returned for apps with the target API level below {@link Build.VERSION_CODES#O}. + * For apps targeting version {@link Build.VERSION_CODES#O} and later, + * the correct value {@link #IMPORTANCE_CANT_SAVE_STATE} will be returned. + * * @hide */ - @Deprecated - public static final int IMPORTANCE_CANT_SAVE_STATE_DEPRECATED = 170; + public static final int IMPORTANCE_CANT_SAVE_STATE_PRE_26 = 170; /** * Constant for {@link #importance}: This process is running an @@ -3244,15 +3255,25 @@ public class ActivityManager { */ public static @Importance int procStateToImportanceForClient(int procState, Context clientContext) { + return procStateToImportanceForTargetSdk(procState, + clientContext.getApplicationInfo().targetSdkVersion); + } + + /** + * See {@link #procStateToImportanceForClient}. + * @hide + */ + public static @Importance int procStateToImportanceForTargetSdk(int procState, + int targetSdkVersion) { final int importance = procStateToImportance(procState); // For pre O apps, convert to the old, wrong values. - if (clientContext.getApplicationInfo().targetSdkVersion < VERSION_CODES.O) { + if (targetSdkVersion < VERSION_CODES.O) { switch (importance) { case IMPORTANCE_PERCEPTIBLE: - return IMPORTANCE_PERCEPTIBLE_DEPRECATED; + return IMPORTANCE_PERCEPTIBLE_PRE_26; case IMPORTANCE_CANT_SAVE_STATE: - return IMPORTANCE_CANT_SAVE_STATE_DEPRECATED; + return IMPORTANCE_CANT_SAVE_STATE_PRE_26; } } return importance; diff --git a/core/java/android/content/pm/PackageManagerInternal.java b/core/java/android/content/pm/PackageManagerInternal.java index 8e34728efcb1..426f3cf792aa 100644 --- a/core/java/android/content/pm/PackageManagerInternal.java +++ b/core/java/android/content/pm/PackageManagerInternal.java @@ -336,4 +336,9 @@ public abstract class PackageManagerInternal { * @param isolatedUid isolated uid that is no longer being used. */ public abstract void removeIsolatedUid(int isolatedUid); + + /** + * Return the taget SDK version for the app with the given UID. + */ + public abstract int getUidTargetSdkVersion(int uid); } |
