Warn users when selecting non-Direct Boot apps.
Certain apps like Phone, SMS, Emergency Info, and IME are critical
enough that they ideally need to be runnable before the device is
unlocked after a reboot. Users can still pick non-Direct Boot aware
apps, but this change now warns users that the selected app won't be
runnable until after unlocking.
Bug: 27196876
Change-Id: I0498904d2f664fb41e8c1e6bb30d1cbf437cf4b9
diff --git a/src/com/android/settings/Utils.java b/src/com/android/settings/Utils.java
index 90dd9e0..0725386 100644
--- a/src/com/android/settings/Utils.java
+++ b/src/com/android/settings/Utils.java
@@ -1150,5 +1150,14 @@
}
return false;
}
-}
+ public static boolean isPackageDirectBootAware(Context context, String packageName) {
+ try {
+ final ApplicationInfo ai = context.getPackageManager().getApplicationInfo(
+ packageName, 0);
+ return ai.isDirectBootAware() || ai.isPartiallyDirectBootAware();
+ } catch (NameNotFoundException ignored) {
+ }
+ return false;
+ }
+}