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

@@ -16,7 +16,6 @@
package com.android.settings.applications;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
@@ -30,9 +29,11 @@ import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.ArraySet;
import android.util.AttributeSet;
import com.android.internal.telephony.SmsApplication;
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;
@@ -56,6 +57,12 @@ public class DefaultEmergencyPreference extends AppListPreference
load();
}
@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) {
String previousValue = Settings.Secure.getString(mContentResolver,

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())) {

View File

@@ -22,19 +22,20 @@ import android.os.UserManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.AttributeSet;
import com.android.internal.telephony.SmsApplication;
import com.android.internal.telephony.SmsApplication.SmsApplicationData;
import com.android.settings.AppListPreference;
import com.android.settings.R;
import com.android.settings.SelfAvailablePreference;
import com.android.settings.Utils;
import java.util.Collection;
import java.util.Objects;
public class DefaultSmsPreference extends AppListPreference implements SelfAvailablePreference {
public DefaultSmsPreference(Context context, AttributeSet attrs) {
super(context, attrs);
loadSmsApps();
}
@@ -59,6 +60,12 @@ public class DefaultSmsPreference extends AppListPreference implements SelfAvail
return null;
}
@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())) {