Fix incorrect icon greying on pre-N system
The flag we check for package suspension is reused by a hidden constant
prior to N, so the flag should only be checked on N or later system.
Bug: 28390176
Change-Id: Ia28f62991cc2cd1b5d2cc27a5f11f7edca0ba02b
(cherry picked from commit 3ee9080fb4)
This commit is contained in:
@@ -19,6 +19,8 @@ package com.android.launcher3.util;
|
|||||||
import android.content.pm.ApplicationInfo;
|
import android.content.pm.ApplicationInfo;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
|
|
||||||
|
import com.android.launcher3.Utilities;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility methods using package manager
|
* Utility methods using package manager
|
||||||
*/
|
*/
|
||||||
@@ -57,6 +59,13 @@ public class PackageManagerHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isAppSuspended(ApplicationInfo info) {
|
public static boolean isAppSuspended(ApplicationInfo info) {
|
||||||
return (info.flags & FLAG_SUSPENDED) != 0;
|
// The value of FLAG_SUSPENDED was reused by a hidden constant
|
||||||
|
// ApplicationInfo.FLAG_PRIVILEGED prior to N, so only check for suspended flag on N
|
||||||
|
// or later.
|
||||||
|
if (Utilities.isNycOrAbove()) {
|
||||||
|
return (info.flags & FLAG_SUSPENDED) != 0;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user