Add ApplicationInfo.installed

Bug: 236346018
Test: Unit test & Manual with Settings App
Change-Id: I1a464c0046014b124a6d3feae4790155f4fc43e0
This commit is contained in:
Chaohui Wang
2022-10-27 19:18:01 +08:00
parent 27c8aa6b1c
commit 6b439ddadd

View File

@@ -35,6 +35,9 @@ val ApplicationInfo.userHandle: UserHandle
/** Checks whether a flag is associated with the application. */
fun ApplicationInfo.hasFlag(flag: Int): Boolean = (flags and flag) > 0
/** Checks whether the application is currently installed. */
val ApplicationInfo.installed: Boolean get() = hasFlag(ApplicationInfo.FLAG_INSTALLED)
/** Checks whether the application is disabled until used. */
val ApplicationInfo.isDisabledUntilUsed: Boolean
get() = enabledSetting == PackageManager.COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED