Revert "Add test options for DPM.setTrustAgentFeaturesEnabled()" until the new API is ready.
This reverts commit d6df7362ab.
Change-Id: Ie5c8e139450923374d235ea9d85f015b87851d06
This commit is contained in:
@@ -787,10 +787,6 @@
|
|||||||
<string name="require_encryption">Require encryption</string>
|
<string name="require_encryption">Require encryption</string>
|
||||||
<string name="activate_encryption">Activate encryption</string>
|
<string name="activate_encryption">Activate encryption</string>
|
||||||
|
|
||||||
<string name="trust_agent_category">Trust Agent Features</string>
|
|
||||||
<string name="set_trust_agent_component_name">Enabled Component Name</string>
|
|
||||||
<string name="set_trust_agent_feature_list">Enabled Features (comma-separated)</string>
|
|
||||||
|
|
||||||
<!-- Strings used by DeviceAdminSample controller code -->
|
<!-- Strings used by DeviceAdminSample controller code -->
|
||||||
<string name="password_sufficient">Current password meets policy requirements</string>
|
<string name="password_sufficient">Current password meets policy requirements</string>
|
||||||
<string name="password_insufficient">Current password does not meet policy requirements</string>
|
<string name="password_insufficient">Current password does not meet policy requirements</string>
|
||||||
|
|||||||
@@ -57,19 +57,4 @@
|
|||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
<PreferenceCategory
|
|
||||||
android:title="@string/trust_agent_category" >
|
|
||||||
|
|
||||||
<EditTextPreference
|
|
||||||
android:key="key_trust_agent_component"
|
|
||||||
android:title="@string/set_trust_agent_component_name"
|
|
||||||
android:dialogTitle="@string/set_trust_agent_component_name" />
|
|
||||||
|
|
||||||
<EditTextPreference
|
|
||||||
android:key="key_trust_agent_features"
|
|
||||||
android:title="@string/set_trust_agent_feature_list"
|
|
||||||
android:dialogTitle="@string/set_trust_agent_feature_list" />
|
|
||||||
|
|
||||||
</PreferenceCategory>
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ import android.content.ComponentName;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
import android.preference.EditTextPreference;
|
import android.preference.EditTextPreference;
|
||||||
@@ -42,8 +41,6 @@ import android.text.TextUtils;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -74,8 +71,6 @@ public class DeviceAdminSample extends PreferenceActivity {
|
|||||||
private static final String KEY_DISABLE_NOTIFICATIONS = "key_disable_notifications";
|
private static final String KEY_DISABLE_NOTIFICATIONS = "key_disable_notifications";
|
||||||
private static final String KEY_DISABLE_UNREDACTED = "key_disable_unredacted";
|
private static final String KEY_DISABLE_UNREDACTED = "key_disable_unredacted";
|
||||||
private static final String KEY_DISABLE_TRUST_AGENTS = "key_disable_trust_agents";
|
private static final String KEY_DISABLE_TRUST_AGENTS = "key_disable_trust_agents";
|
||||||
private static final String KEY_TRUST_AGENT_COMPONENT = "key_trust_agent_component";
|
|
||||||
private static final String KEY_TRUST_AGENT_FEATURES = "key_trust_agent_features";
|
|
||||||
private static final String KEY_DISABLE_KEYGUARD_WIDGETS = "key_disable_keyguard_widgets";
|
private static final String KEY_DISABLE_KEYGUARD_WIDGETS = "key_disable_keyguard_widgets";
|
||||||
private static final String KEY_DISABLE_KEYGUARD_SECURE_CAMERA
|
private static final String KEY_DISABLE_KEYGUARD_SECURE_CAMERA
|
||||||
= "key_disable_keyguard_secure_camera";
|
= "key_disable_keyguard_secure_camera";
|
||||||
@@ -279,8 +274,6 @@ public class DeviceAdminSample extends PreferenceActivity {
|
|||||||
private CheckBoxPreference mDisableKeyguardNotificationCheckbox;
|
private CheckBoxPreference mDisableKeyguardNotificationCheckbox;
|
||||||
private CheckBoxPreference mDisableKeyguardTrustAgentCheckbox;
|
private CheckBoxPreference mDisableKeyguardTrustAgentCheckbox;
|
||||||
private CheckBoxPreference mDisableKeyguardUnredactedCheckbox;
|
private CheckBoxPreference mDisableKeyguardUnredactedCheckbox;
|
||||||
private EditTextPreference mTrustAgentComponent;
|
|
||||||
private EditTextPreference mTrustAgentFeatures;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -311,14 +304,6 @@ public class DeviceAdminSample extends PreferenceActivity {
|
|||||||
mDisableKeyguardTrustAgentCheckbox =
|
mDisableKeyguardTrustAgentCheckbox =
|
||||||
(CheckBoxPreference) findPreference(KEY_DISABLE_TRUST_AGENTS);
|
(CheckBoxPreference) findPreference(KEY_DISABLE_TRUST_AGENTS);
|
||||||
mDisableKeyguardTrustAgentCheckbox.setOnPreferenceChangeListener(this);
|
mDisableKeyguardTrustAgentCheckbox.setOnPreferenceChangeListener(this);
|
||||||
|
|
||||||
mTrustAgentComponent =
|
|
||||||
(EditTextPreference) findPreference(KEY_TRUST_AGENT_COMPONENT);
|
|
||||||
mTrustAgentComponent.setOnPreferenceChangeListener(this);
|
|
||||||
|
|
||||||
mTrustAgentFeatures =
|
|
||||||
(EditTextPreference) findPreference(KEY_TRUST_AGENT_FEATURES);
|
|
||||||
mTrustAgentFeatures.setOnPreferenceChangeListener(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// At onResume time, reload UI with current values as required
|
// At onResume time, reload UI with current values as required
|
||||||
@@ -355,8 +340,8 @@ public class DeviceAdminSample extends PreferenceActivity {
|
|||||||
if (super.onPreferenceChange(preference, newValue)) {
|
if (super.onPreferenceChange(preference, newValue)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
boolean value = (Boolean) newValue;
|
||||||
if (preference == mEnableCheckbox) {
|
if (preference == mEnableCheckbox) {
|
||||||
boolean value = (Boolean) newValue;
|
|
||||||
if (value != mAdminActive) {
|
if (value != mAdminActive) {
|
||||||
if (value) {
|
if (value) {
|
||||||
// Launch the activity to have the user enable our admin.
|
// Launch the activity to have the user enable our admin.
|
||||||
@@ -374,7 +359,6 @@ public class DeviceAdminSample extends PreferenceActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (preference == mDisableCameraCheckbox) {
|
} else if (preference == mDisableCameraCheckbox) {
|
||||||
boolean value = (Boolean) newValue;
|
|
||||||
mDPM.setCameraDisabled(mDeviceAdminSample, value);
|
mDPM.setCameraDisabled(mDeviceAdminSample, value);
|
||||||
// Delay update because the change is only applied after exiting this method.
|
// Delay update because the change is only applied after exiting this method.
|
||||||
postReloadSummaries();
|
postReloadSummaries();
|
||||||
@@ -382,39 +366,20 @@ public class DeviceAdminSample extends PreferenceActivity {
|
|||||||
|| preference == mDisableKeyguardSecureCameraCheckbox
|
|| preference == mDisableKeyguardSecureCameraCheckbox
|
||||||
|| preference == mDisableKeyguardNotificationCheckbox
|
|| preference == mDisableKeyguardNotificationCheckbox
|
||||||
|| preference == mDisableKeyguardUnredactedCheckbox
|
|| preference == mDisableKeyguardUnredactedCheckbox
|
||||||
|| preference == mDisableKeyguardTrustAgentCheckbox
|
|| preference == mDisableKeyguardTrustAgentCheckbox) {
|
||||||
|| preference == mTrustAgentComponent
|
// Delay update because the change is only applied after exiting this method.
|
||||||
|| preference == mTrustAgentFeatures) {
|
getView().post(new Runnable() {
|
||||||
postUpdateDpmDisableFeatures();
|
@Override
|
||||||
|
public void run() {
|
||||||
|
mDPM.setKeyguardDisabledFeatures(mDeviceAdminSample,
|
||||||
|
createKeyguardDisabledFlag());
|
||||||
|
}
|
||||||
|
});
|
||||||
postReloadSummaries();
|
postReloadSummaries();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void postUpdateDpmDisableFeatures() {
|
|
||||||
getView().post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
mDPM.setKeyguardDisabledFeatures(mDeviceAdminSample,
|
|
||||||
createKeyguardDisabledFlag());
|
|
||||||
String component = mTrustAgentComponent.getText();
|
|
||||||
if (component != null) {
|
|
||||||
ComponentName agent = ComponentName.unflattenFromString(component);
|
|
||||||
if (agent != null) {
|
|
||||||
String featureString = mTrustAgentFeatures.getText();
|
|
||||||
if (featureString != null) {
|
|
||||||
List<String> features = Arrays.asList(featureString.split(","));
|
|
||||||
mDPM.setTrustAgentFeaturesEnabled(mDeviceAdminSample, agent,
|
|
||||||
features);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Log.w(TAG, "Invalid component: " + component);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void reloadSummaries() {
|
protected void reloadSummaries() {
|
||||||
super.reloadSummaries();
|
super.reloadSummaries();
|
||||||
@@ -451,17 +416,6 @@ public class DeviceAdminSample extends PreferenceActivity {
|
|||||||
R.string.keyguard_trust_agents_disabled
|
R.string.keyguard_trust_agents_disabled
|
||||||
: R.string.keyguard_trust_agents_enabled);
|
: R.string.keyguard_trust_agents_enabled);
|
||||||
mDisableKeyguardTrustAgentCheckbox.setSummary(keyguardEnableTrustAgentSummary);
|
mDisableKeyguardTrustAgentCheckbox.setSummary(keyguardEnableTrustAgentSummary);
|
||||||
|
|
||||||
final SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
|
|
||||||
final boolean trustDisabled =
|
|
||||||
(disabled & DevicePolicyManager.KEYGUARD_DISABLE_TRUST_AGENTS) != 0;
|
|
||||||
String component = prefs.getString(mTrustAgentComponent.getKey(), null);
|
|
||||||
mTrustAgentComponent.setSummary(component);
|
|
||||||
mTrustAgentComponent.setEnabled(trustDisabled);
|
|
||||||
|
|
||||||
String features = prefs.getString(mTrustAgentFeatures.getKey(), null);
|
|
||||||
mTrustAgentFeatures.setSummary(features);
|
|
||||||
mTrustAgentFeatures.setEnabled(trustDisabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Updates the device capabilities area (dis/enabling) as the admin is (de)activated */
|
/** Updates the device capabilities area (dis/enabling) as the admin is (de)activated */
|
||||||
@@ -472,8 +426,6 @@ public class DeviceAdminSample extends PreferenceActivity {
|
|||||||
mDisableKeyguardNotificationCheckbox.setEnabled(enabled);
|
mDisableKeyguardNotificationCheckbox.setEnabled(enabled);
|
||||||
mDisableKeyguardUnredactedCheckbox.setEnabled(enabled);
|
mDisableKeyguardUnredactedCheckbox.setEnabled(enabled);
|
||||||
mDisableKeyguardTrustAgentCheckbox.setEnabled(enabled);
|
mDisableKeyguardTrustAgentCheckbox.setEnabled(enabled);
|
||||||
mTrustAgentComponent.setEnabled(enabled);
|
|
||||||
mTrustAgentFeatures.setEnabled(enabled);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user