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
This commit is contained in:
Jeff Sharkey
2016-07-27 12:53:34 -06:00
parent fc86ca6f0d
commit 4a8136b51b
6 changed files with 170 additions and 41 deletions

View File

@@ -1150,5 +1150,14 @@ public final class Utils extends com.android.settingslib.Utils {
}
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;
}
}