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

@@ -24,22 +24,27 @@ import android.telecom.TelecomManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.AttributeSet;
import com.android.settings.AppListPreference;
import com.android.settings.R;
import com.android.settings.SelfAvailablePreference;
import com.android.settings.Utils;
import java.util.List;
import java.util.Objects;
public class DefaultPhonePreference extends AppListPreference implements SelfAvailablePreference {
private final Context mContext;
public DefaultPhonePreference(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context.getApplicationContext();
loadDialerApps();
}
@Override
protected CharSequence getConfirmationMessage(String value) {
return Utils.isPackageDirectBootAware(getContext(), value) ? null
: getContext().getText(R.string.direct_boot_unaware_dialog_message);
}
@Override
protected boolean persistString(String value) {
if (!TextUtils.isEmpty(value) && !Objects.equals(value, getDefaultPackage())) {