Merge "Don't allow users to set redaction on an insecure device." into lmp-dev
This commit is contained in:
@@ -36,6 +36,7 @@ import android.widget.ImageView;
|
|||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
import com.android.settings.R;
|
import com.android.settings.R;
|
||||||
import com.android.settings.SettingsPreferenceFragment;
|
import com.android.settings.SettingsPreferenceFragment;
|
||||||
import com.android.settings.notification.NotificationAppList.AppRow;
|
import com.android.settings.notification.NotificationAppList.AppRow;
|
||||||
@@ -134,6 +135,11 @@ public class AppNotificationSettings extends SettingsPreferenceFragment {
|
|||||||
mPriority = (SwitchPreference) findPreference(KEY_PRIORITY);
|
mPriority = (SwitchPreference) findPreference(KEY_PRIORITY);
|
||||||
mSensitive = (SwitchPreference) findPreference(KEY_SENSITIVE);
|
mSensitive = (SwitchPreference) findPreference(KEY_SENSITIVE);
|
||||||
|
|
||||||
|
final boolean secure = new LockPatternUtils(getActivity()).isSecure();
|
||||||
|
if (!secure) {
|
||||||
|
getPreferenceScreen().removePreference(mSensitive);
|
||||||
|
}
|
||||||
|
|
||||||
mAppRow = NotificationAppList.loadAppRow(pm, info, mBackend);
|
mAppRow = NotificationAppList.loadAppRow(pm, info, mBackend);
|
||||||
if (intent.hasExtra(EXTRA_HAS_SETTINGS_INTENT)) {
|
if (intent.hasExtra(EXTRA_HAS_SETTINGS_INTENT)) {
|
||||||
// use settings intent from extra
|
// use settings intent from extra
|
||||||
@@ -149,7 +155,9 @@ public class AppNotificationSettings extends SettingsPreferenceFragment {
|
|||||||
|
|
||||||
mBlock.setChecked(mAppRow.banned);
|
mBlock.setChecked(mAppRow.banned);
|
||||||
mPriority.setChecked(mAppRow.priority);
|
mPriority.setChecked(mAppRow.priority);
|
||||||
mSensitive.setChecked(mAppRow.sensitive);
|
if (mSensitive != null) {
|
||||||
|
mSensitive.setChecked(mAppRow.sensitive);
|
||||||
|
}
|
||||||
|
|
||||||
mBlock.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
mBlock.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
@@ -167,13 +175,15 @@ public class AppNotificationSettings extends SettingsPreferenceFragment {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
mSensitive.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
if (mSensitive != null) {
|
||||||
@Override
|
mSensitive.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
|
||||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
@Override
|
||||||
final boolean sensitive = (Boolean) newValue;
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
return mBackend.setSensitive(pkg, uid, sensitive);
|
final boolean sensitive = (Boolean) newValue;
|
||||||
}
|
return mBackend.setSensitive(pkg, uid, sensitive);
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void toastAndFinish() {
|
private void toastAndFinish() {
|
||||||
|
Reference in New Issue
Block a user